e***@gmail.com
2018-05-25 18:03:59 UTC
Hi,
I've been trying to use an .xlsx file with Apache POI, but have ran into a problem with it. The file has 6 rows in it, and POI correctly identified that there were 6 rows. However, when I tried to get the sheet's last row number, it returned 2 instead of 5 (zero based). I did some digging around and found in the sheet.xml of the xlsx file, rows 4,5, and 6 did not have the "r" attribute (rowIndex).
For example, the rows looked like the following:
<x:row r="1">
<x:row r="2">
<x:row r="3">
<x:row>
<x:row>
<x:row>
When I appended the r attribute to rows 4,5,6 and called the "sheet.getLastRowNum()" method, this time it correctly printed 5. I did a bit research and it appears according to the ECMA-376 Documentation 5th Edition Part 1 (page 3928/3918) which defines the OOXML format, that the "r" attribute (rowIndex) is optional. However, POI seems to require that the "r" attribute is present for each row.
It seems as though this may have been something that was missed from the spec. I'm using POI 3.8, but also tried 3.14. I considered filing a bug report for this, but thought it might have been a known issue. Has anyone come across this yet? Are there any workarounds?
---------------------------------------------------------------------
To unsubscribe, e-mail: user-***@poi.apache.org
For additional commands, e-mail: user-***@poi.apache.org
I've been trying to use an .xlsx file with Apache POI, but have ran into a problem with it. The file has 6 rows in it, and POI correctly identified that there were 6 rows. However, when I tried to get the sheet's last row number, it returned 2 instead of 5 (zero based). I did some digging around and found in the sheet.xml of the xlsx file, rows 4,5, and 6 did not have the "r" attribute (rowIndex).
For example, the rows looked like the following:
<x:row r="1">
<x:row r="2">
<x:row r="3">
<x:row>
<x:row>
<x:row>
When I appended the r attribute to rows 4,5,6 and called the "sheet.getLastRowNum()" method, this time it correctly printed 5. I did a bit research and it appears according to the ECMA-376 Documentation 5th Edition Part 1 (page 3928/3918) which defines the OOXML format, that the "r" attribute (rowIndex) is optional. However, POI seems to require that the "r" attribute is present for each row.
It seems as though this may have been something that was missed from the spec. I'm using POI 3.8, but also tried 3.14. I considered filing a bug report for this, but thought it might have been a known issue. Has anyone come across this yet? Are there any workarounds?
---------------------------------------------------------------------
To unsubscribe, e-mail: user-***@poi.apache.org
For additional commands, e-mail: user-***@poi.apache.org