Skip to content

Commit

Permalink
fix: reuse cell style
Browse files Browse the repository at this point in the history
Close #87
  • Loading branch information
flang committed Jan 15, 2024
1 parent a79ff79 commit 482cf05
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,7 @@ private void buildRow(T item, Sheet sheet, Cell startingCell) {
Cell currentCell = startingCell;
if (startingCell.getColumnIndex() < currentColumn[0]) {
currentCell = startingCell.getRow().createCell(currentColumn[0]);
CellStyle newCellStyle = currentCell.getSheet().getWorkbook().createCellStyle();
newCellStyle.cloneStyleFrom(startingCell.getCellStyle());
currentCell.setCellStyle(newCellStyle);
currentCell.setCellStyle(startingCell.getCellStyle());

configureAlignment(column.getTextAlign(), currentCell);
}
Expand Down Expand Up @@ -402,9 +400,7 @@ private void fillHeaderOrFooter(
sheet
.getRow(sheet.getActiveCell().getRow())
.createCell(sheet.getActiveCell().getColumn());
CellStyle newCellStyle = cell.getSheet().getWorkbook().createCellStyle();
newCellStyle.cloneStyleFrom(style);
cell.setCellStyle(newCellStyle);
cell.setCellStyle(style);
}
Object value =
(isHeader
Expand Down

0 comments on commit 482cf05

Please sign in to comment.