-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added append methods that accept custom styler.
- Loading branch information
1 parent
82e5448
commit 82cfaff
Showing
6 changed files
with
133 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
zulia-data/src/main/java/io/zulia/data/target/spreadsheet/excel/cell/BoldCellHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package io.zulia.data.target.spreadsheet.excel.cell; | ||
|
||
import io.zulia.data.target.spreadsheet.SpreadsheetTypeHandler; | ||
import io.zulia.data.target.spreadsheet.excel.WorkbookHelper; | ||
import org.apache.poi.ss.usermodel.CellStyle; | ||
import org.apache.poi.ss.usermodel.Font; | ||
import org.apache.poi.xssf.streaming.SXSSFCell; | ||
|
||
public class BoldCellHandler implements SpreadsheetTypeHandler<CellReference, String> { | ||
|
||
@Override | ||
public void writeType(CellReference reference, String value) { | ||
SXSSFCell cell = reference.cell(); | ||
if (value != null) { | ||
WorkbookHelper workbookHelper = reference.workbookHelper(); | ||
CellStyle linkStyle = workbookHelper.createOrGetStyle("boldStyle", style -> { | ||
Font boldFont = workbookHelper.createOrGetFont("boldFont", font -> { | ||
font.setBold(true); | ||
font.setFontHeightInPoints((short) 10); | ||
}); | ||
style.setFont(boldFont); | ||
}); | ||
cell.setCellStyle(linkStyle); | ||
cell.setCellValue(value); | ||
} | ||
else { | ||
cell.setBlank(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters