Skip to content

Commit

Permalink
Merge pull request #3 from trocco-io/update-poi
Browse files Browse the repository at this point in the history
Update poi
  • Loading branch information
giwa authored Feb 3, 2023
2 parents 1cd6974 + e9795dc commit e33f4c1
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ dependencies {
compile "org.embulk:embulk-standards:0.9.23"
compile 'org.embulk:embulk-deps-buffer:0.9.23'
// compile "YOUR_JAR_DEPENDENCY_GROUP:YOUR_JAR_DEPENDENCY_MODULE:YOUR_JAR_DEPENDENCY_VERSION"
compile group: 'org.apache.poi', name : 'poi', version: '3.17'
compile(group: 'org.apache.poi', name : 'poi-ooxml', version: '3.17') {
compile group: 'org.apache.poi', name : 'poi', version: '5.2.3'
compile(group: 'org.apache.poi', name : 'poi-ooxml', version: '5.2.3') {
exclude group: 'stax', module: 'stax-api'
}
testCompile "junit:junit:4.+"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public void run(TaskSource taskSource, Schema schema, FileInput input, PageOutpu
Workbook workbook;
try {
workbook = WorkbookFactory.create(is);
} catch (IOException | EncryptedDocumentException | InvalidFormatException e) {
} catch (IOException | EncryptedDocumentException e) {
throw new RuntimeException(e);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public PoiExcelCellFontVisitor(PoiExcelVisitorValue visitorValue) {
@Override
protected Font getAttributeSource(PoiExcelColumnBean bean, Cell cell) {
CellStyle style = cell.getCellStyle();
short index = style.getFontIndex();
int index = style.getFontIndex();
Workbook book = visitorValue.getSheet().getWorkbook();
return book.getFontAt(index);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@ protected Map<String, AttributeSupplier<CellStyle>> getAttributeSupplierMap() {
map.put("alignment", new AttributeSupplier<CellStyle>() {
@Override
public Object get(Column column, Cell cell, CellStyle style) {
return (long) style.getAlignmentEnum().getCode();
return (long) style.getAlignment().getCode();
}
});
map.put("border", new AttributeSupplier<CellStyle>() {
@Override
public Object get(Column column, Cell cell, CellStyle style) {
int n0 = style.getBorderTopEnum().getCode();
int n1 = style.getBorderBottomEnum().getCode();
int n2 = style.getBorderLeftEnum().getCode();
int n3 = style.getBorderRightEnum().getCode();
int n0 = style.getBorderTop().getCode();
int n1 = style.getBorderBottom().getCode();
int n2 = style.getBorderLeft().getCode();
int n3 = style.getBorderRight().getCode();
if (column.getType() instanceof StringType) {
return String.format("%02x%02x%02x%02x", n0, n1, n2, n3);
}
Expand All @@ -60,25 +60,25 @@ public Object get(Column column, Cell cell, CellStyle style) {
map.put("border_bottom", new AttributeSupplier<CellStyle>() {
@Override
public Object get(Column column, Cell cell, CellStyle style) {
return (long) style.getBorderBottomEnum().getCode();
return (long) style.getBorderBottom().getCode();
}
});
map.put("border_left", new AttributeSupplier<CellStyle>() {
@Override
public Object get(Column column, Cell cell, CellStyle style) {
return (long) style.getBorderLeftEnum().getCode();
return (long) style.getBorderLeft().getCode();
}
});
map.put("border_right", new AttributeSupplier<CellStyle>() {
@Override
public Object get(Column column, Cell cell, CellStyle style) {
return (long) style.getBorderRightEnum().getCode();
return (long) style.getBorderRight().getCode();
}
});
map.put("border_top", new AttributeSupplier<CellStyle>() {
@Override
public Object get(Column column, Cell cell, CellStyle style) {
return (long) style.getBorderTopEnum().getCode();
return (long) style.getBorderTop().getCode();
}
});
map.put("border_bottom_color", new AttributeSupplier<CellStyle>() {
Expand Down Expand Up @@ -154,7 +154,7 @@ public Object get(Column column, Cell cell, CellStyle style) {
map.put("fill_pattern", new AttributeSupplier<CellStyle>() {
@Override
public Object get(Column column, Cell cell, CellStyle style) {
return (long) style.getFillPatternEnum().getCode();
return (long) style.getFillPattern().getCode();
}
});
map.put("font_index", new AttributeSupplier<CellStyle>() {
Expand Down Expand Up @@ -190,7 +190,7 @@ public Object get(Column column, Cell cell, CellStyle style) {
map.put("vertical_alignment", new AttributeSupplier<CellStyle>() {
@Override
public Object get(Column column, Cell cell, CellStyle style) {
return (long) style.getVerticalAlignmentEnum().getCode();
return (long) style.getVerticalAlignment().getCode();
}
});
map.put("wrap_text", new AttributeSupplier<CellStyle>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void visitCellValue(PoiExcelColumnBean bean, Cell cell, CellVisitor visit

Column column = bean.getColumn();

CellType cellType = cell.getCellTypeEnum();
CellType cellType = cell.getCellType();
switch (cellType) {
case NUMERIC:
visitor.visitCellValueNumeric(column, cell, cell.getNumericCellValue());
Expand Down Expand Up @@ -73,7 +73,7 @@ public void visitCellValue(PoiExcelColumnBean bean, Cell cell, CellVisitor visit
}

protected void visitCellValueBlank(PoiExcelColumnBean bean, Cell cell, CellVisitor visitor) {
assert cell.getCellTypeEnum() == CellType.BLANK;
assert cell.getCellType() == CellType.BLANK;

Column column = bean.getColumn();

Expand Down Expand Up @@ -109,7 +109,7 @@ protected CellRangeAddress findRegion(PoiExcelColumnBean bean, Cell cell) {
}

protected void visitCellValueFormula(PoiExcelColumnBean bean, Cell cell, CellVisitor visitor) {
assert cell.getCellTypeEnum() == CellType.FORMULA;
assert cell.getCellType() == CellType.FORMULA;

FormulaHandling handling = bean.getFormulaHandling();
switch (handling) {
Expand All @@ -125,7 +125,7 @@ protected void visitCellValueFormula(PoiExcelColumnBean bean, Cell cell, CellVis
protected void visitCellValueFormulaCashedValue(PoiExcelColumnBean bean, Cell cell, CellVisitor visitor) {
Column column = bean.getColumn();

CellType cellType = cell.getCachedFormulaResultTypeEnum();
CellType cellType = cell.getCachedFormulaResultType();
switch (cellType) {
case NUMERIC:
visitor.visitCellValueNumeric(column, cell, cell.getNumericCellValue());
Expand Down Expand Up @@ -205,7 +205,7 @@ protected void visitCellValueFormulaEvaluate(PoiExcelColumnBean bean, Cell cell,
throw new RuntimeException(MessageFormat.format("evaluate error. formula={0}", cell.getCellFormula()), e);
}

CellType cellType = cellValue.getCellTypeEnum();
CellType cellType = cellValue.getCellType();
switch (cellType) {
case NUMERIC:
visitor.visitCellValueNumeric(column, cellValue, cellValue.getNumberValue());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,13 @@ protected void visitCell(Column column, CellVisitor visitor) {
visitCellComment(bean, cell, visitor);
return;
case CELL_TYPE:
visitCellType(bean, cell, cell.getCellTypeEnum(), visitor);
visitCellType(bean, cell, cell.getCellType(), visitor);
return;
case CELL_CACHED_TYPE:
if (cell.getCellTypeEnum() == CellType.FORMULA) {
visitCellType(bean, cell, cell.getCachedFormulaResultTypeEnum(), visitor);
if (cell.getCellType() == CellType.FORMULA) {
visitCellType(bean, cell, cell.getCachedFormulaResultType(), visitor);
} else {
visitCellType(bean, cell, cell.getCellTypeEnum(), visitor);
visitCellType(bean, cell, cell.getCellType(), visitor);
}
return;
default:
Expand Down

0 comments on commit e33f4c1

Please sign in to comment.