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
try { | |
// creates destination file | |
File file = new File("test.xlsx"); | |
// creates date cells custom style settings | |
CellStyle dateCellStyle = workbook.createCellStyle(); | |
dateCellStyle.setFillForegroundColor(IndexedColors.AQUA.getIndex()); | |
dateCellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND); | |
dateCellStyle.setDataFormat(workbook.getCreationHelper().createDataFormat().getFormat("yyyy/MM/dd")); |
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
try { | |
// creates destination file | |
File file = new File("test.xlsx"); | |
// creates MemPOI using its builder | |
MemPOI memPOI = MempoiBuilder.aMemPOI() | |
.withFile(file) | |
.addMempoiSheet(new MempoiSheet(prepStmt)) | |
.withStyleTemplate(new SummerStyleTemplate()) |
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
try { | |
// creates destination file | |
File file = new File("multisheet.xlsx"); | |
// creates sheet 1 with a PreparedStatement and the sheet name | |
MempoiSheet dogsSheet = MempoiSheetBuilder.aMempoiSheet() | |
.withSheetName("Dogs sheet") | |
.withPrepStmt(conn.prepareStatement("SELECT pet_name AS DOG_NAME, pet_race AS DOG_RACE FROM pets WHERE pet_type = 'dog'")) | |
.build(); |
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
try { | |
// creates destination file | |
File file = new File("test.xlsx"); | |
// creates MemPOI using its builder | |
MemPOI memPOI = MempoiBuilder.aMemPOI() | |
.withFile(file) | |
.addMempoiSheet(new MempoiSheet(prepStmt)) | |
.build(); |
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
try { | |
// creates MemPOI using its builder | |
MemPOI memPOI = MempoiBuilder.aMemPOI() | |
.addMempoiSheet(new MempoiSheet(prepStmt)) | |
.build(); | |
// exports to byte array | |
CompletableFuture<byte[]> fut = memPOI.prepareMempoiReportToByteArray(); | |