Cannot say for certain that this is the error but my eye was drawn to the
fact that you are creating identical style objects on each iteration of your
main loop. Styles are shared and so you ought to create them outside of the
loop and then apply as necessary, something like this;

public static void main(String[] args) throws Throwable {
         int rowCount = 10000;

        Workbook wb = new SXSSFWorkbook(100); // keep 100 rows in memory,
exceeding rows will be flushed to disk
        Sheet sh = wb.createSheet();
        XSSFCellStyle style = (XSSFCellStyle) wb.createCellStyle();
       
style.setFillForegroundColor(IndexedColors.LIGHT_CORNFLOWER_BLUE.getIndex());
        style.setFillPattern(FillPatternType.SOLID_FOREGROUND);

        for(int rownum = 0; rownum < rowCount ; rownum++){
            Row row = sh.createRow(rownum);
            for(int cellnum = 0; cellnum < 15; cellnum++){
                Cell cell = row.createCell(cellnum);
                cell.setCellValue("mock");
                cell.setCellStyle(style);
            }

        }
        FileOutputStream out = new FileOutputStream("c:/sxssf.xlsx");
        wb.write(out);
        out.close();
    } 



--
View this message in context: 
http://apache-poi.1045710.n5.nabble.com/SXSSFWorkbook-with-CellStyle-format-issue-big-file-tp5710422p5710424.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to