[Bug 62711] New: Calling shiftRows corrupts file in POI 4.0

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug 62711] New: Calling shiftRows corrupts file in POI 4.0

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=62711

            Bug ID: 62711
           Summary: Calling shiftRows corrupts file in POI 4.0
           Product: POI
           Version: 4.0.0-FINAL
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: [hidden email]
          Reporter: [hidden email]
  Target Milestone: ---

Hi

This code produces a corrupt XLSX with POI 4.0 (works fine in 3.17):

ByteArrayOutputStream os = new ByteArrayOutputStream();
try (Workbook workbook = new XSSFWorkbook()) {
   Sheet worksheet =
workbook.createSheet(WorkbookUtil.createSafeSheetName("Export"));
   for (int rowNum = 0; rowNum < 900; rowNum++) {
      Row row = worksheet.createRow(rowNum);
      int colNum = 0;
      for (Object cellValue : Arrays.asList(new Object(),0,0,0,0,0,0,0,0)) {
         row.createCell(colNum++);
      }
   }
   worksheet.shiftRows(0, worksheet.getLastRowNum(), 3);
   workbook.write(os);
}

If I leave out the shiftRows, everything works fine.
It doesn't matter if I write values into the cells or not, the result is the
same.

running Java 8, POI 4.0, Windows 10, Excel 2016

Error when opening in Excel:
Removed Records: Cell information from /xl/worksheets/sheet1.xml part

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [Bug 62711] New: Calling shiftRows corrupts file in POI 4.0

Tony Falabella
This is happening to me as well.  The shiftRows function is not working
properly.  The row # seems to update properly but the cells within the row
do not have the same row # as the row they reside in so the rows get
corrupted.

In the example below I inserted 1 row (+1) - notice the row go updated but
not the cells within the row (A29 instead of A30).

       <row r="30" spans="1:17" ht="16.5" customHeight="1"
x14ac:dyDescent="0.2">
            <c r="A29" s="1" t="s">
                <v>4</v>
            </c><c r="B29" s="1" t="s">
            <v>5</v>
        </c>
        </row>

For me this makes POI 4.0 unusable for my purposes.  I'll see if I can come
up with a temp workaround to use 3.x methods for this function but ideally
maybe 4.0.2 can address properly.



--
Sent from: http://apache-poi.1045710.n5.nabble.com/POI-Dev-f2312866.html

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