https://issues.apache.org/bugzilla/show_bug.cgi?id=53650
Yegor Kozlov <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #1 from Yegor Kozlov <[email protected]> --- You are overwriting an existing row which is now allowed. SXSSF is streaming forward-only API which means it can only append data to your template. Your workbook already contains rows, it can easily checked as follows: XSSFWorkbook template = new XSSFWorkbook(new FileInputStream("template.xlsx")) ; XSSFSheet sheet = template.getSheetAt(1); System.out.println(sheet.getPhysicalNumberOfRows()); System.out.println(sheet.getFirstRowNum()); System.out.println(sheet.getLastRowNum()); Your code creates a row with rowIndex=1 which gets appended after the last row in the template and it results in a corrupted workbook for two reasons: - there is a duplicate row - rows in sheet.xml are not ordered: rowIndex=1 comes after rowIndex=1976 I committed a fix in r1418264. Now SXSSF throws IllegalArgumentException if you are trying to overwrite a row already saved to disk. Yegor -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
