Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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"));
- // creates MemPOI using its builder and requests the export
- MempoiBuilder.aMemPOI()
- .withWorkbook(workbook)
- .withFile(file)
- .addMempoiSheet(new MempoiSheet(prepStmt))
- .withStyleTemplate(new AquaStyleTemplate())
- .withNumberCellStyle(workbook.createCellStyle()) // to remove default style you can just override it with a new empty one
- .withDateCellStyle(dateCellStyle) // override default date cell style with the new one
- .build()
- .prepareMempoiReportToFile()
- .get();
- } catch (ExecutionException e) {
- System.out.println(e.getCause().getMessage());
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement