Skip to content

Commit

Permalink
Add quotes to strings when writing to excel
Browse files Browse the repository at this point in the history
  • Loading branch information
agrancaric committed Jul 12, 2024
1 parent ac7e877 commit 8dcbfe2
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ private void setCellValue(Cell cell, Object value, CellStyle style) {
return;
}

if (style != null) {
cell.setCellStyle(style);
}

PoiCellHolder cellHolder = new PoiCellHolder(cell);

CellValueConverter converter = cellValueConverterList.stream()
Expand All @@ -146,14 +150,11 @@ private void setCellValue(Cell cell, Object value, CellStyle style) {

if (converter == null) {
cell.setCellValue(value.toString());
cell.getCellStyle().setQuotePrefixed(true);
}
else {
converter.setCellValue(cellHolder, value);
}

if (style != null) {
cell.setCellStyle(style);
}
}

private Map<Integer, CellStyle> createStyleMap(List<ColumnDataFormat> columnDataFormatList) {
Expand Down

0 comments on commit 8dcbfe2

Please sign in to comment.