You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by er...@gmail.com, er...@gmail.com on 2018/05/25 18:03:59 UTC

Specification Bug with rowIndex attribute for Rows?

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-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Specification Bug with rowIndex attribute for Rows?

Posted by "pj.fanning" <fa...@yahoo.com>.
Can you log an issue and provide the xlsx that causes this?



--
Sent from: http://apache-poi.1045710.n5.nabble.com/POI-User-f2280730.html

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Specification Bug with rowIndex attribute for Rows?

Posted by Andreas Beeker <ki...@apache.org>.
Hi,

regarding ECMA-376 we are still using the 1st edition :( ... and add elements of later schemas every now and then, at least for XSLF. I guess the files you are trying to process aren't generated by MS Office, right?
Although we should also handle your case correctly, if this is out in the wild, most processing is based on example files generated by MS Office and therefore we haven't realized, that the attribute is optional.

So as PJ suggested, if we have an example file and optional a side-note which program generated the files,
we can adapt the code accordingly.

Andi