List of usage examples for org.apache.poi.xssf.streaming SXSSFSheet flushRows
public void flushRows() throws IOException
From source file:com.github.igor_kudryashov.utils.excel.ExcelWriter.java
License:Apache License
/** * Save a workbook in file//from www .j a va 2 s . c om * * @param fileName * filename * @return <code>true</code> if saved successfully, otherwise * <code>false</code> * @throws IOException */ public boolean saveToFile(String fileName) throws IOException { for (int x = 0; x < workbook.getNumberOfSheets(); x++) { SXSSFSheet sheet = workbook.getSheetAt(x); sheet.flushRows(); } // Write the output to a file FileOutputStream fileOut = new FileOutputStream(fileName); workbook.write(fileOut); fileOut.close(); // dispose of temporary files backing this workbook on disk workbook.dispose(); return (true); }