I am trying to create an Excel Work sheet using POI api in Java. In that Excel Work Sheet I want to have a cell with TIME alone. By setting this we can include the cell in summa
I have used the following code to generate the time cell, in Excel using POI. And I am able to use the cell in
XSSFRow row2 = sheet.createRow(25);
XSSFCell cell1 = row2.createCell(4);
XSSFCell cell2 = row2.createCell(5);
CellStyle style = wb.createCellStyle();
DataFormat df = wb.createDataFormat();
style.setDataFormat(df.getFormat("[h]:mm:ss;@"));
cell1.setCellFormula("TIME(0,15,00)"); // 00:15:00
cell1.setCellType(Cell.CELL_TYPE_FORMULA);
cell1.setCellStyle(style);
evaluator.evaluateFormulaCell(cell1);
cell2.setCellFormula("TIME(0,30,00)"); //00:30:00
cell2.setCellType(Cell.CELL_TYPE_FORMULA);
evaluator.evaluateFormulaCell(cell2);
cell2.setCellStyle(style);