Bug 59843 - Can't find a way to get empty rows with XSSF and SAX (Event API)
Summary: Can't find a way to get empty rows with XSSF and SAX (Event API)
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.14-FINAL
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2016-07-12 04:18 UTC by jzhao
Modified: 2016-07-18 10:05 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description jzhao 2016-07-12 04:18:33 UTC
When I create a new excel abc.xlsx
Create a new sheet "test"
Add a cell value in "C20"
Then I try to use XSSF and SAX (Event API) to read this xml.
I can only get the 1 row value.
  <row r="20" spans="3:3" x14ac:dyDescent="0.25">
    <c r="C20" t="s">

Can't find a way to get the empty rows 1~19.
I use this example to test my data.
Just change it write xml to a local file
Comment 1 Nick Burch 2016-07-12 10:13:03 UTC
Excel files are normally (mostly) sparse, so this is entirely as expected

All rows and cells come with details of what one they are, so with 2 counters you can easily spot gaps. See https://svn.apache.org/repos/asf/poi/trunk/src/examples/src/org/apache/poi/xssf/eventusermodel/XLSX2CSV.java for an easy-to-read example of doing this

Alternately, switch to the full UserModel code, and there's handy helpers there to assist you in dealing with missing cells etc
Comment 2 jzhao 2016-07-18 10:05:31 UTC
Thanks Nick, I would try with you suggestion.
Seems I forgot to check in latest examples.