Please feel free to correct me if I am wrong or mistaken.
The cell form representation you see in Microsoft Excel is not the true
physical representation _on_file_. POI works directly _on_xls_file_,
this is where I think you are getting the mixed up.
In xls file format, cell is not created unless it has been used or
contains something. That is why you are not seeing a full 22 cells
because the blank cells are simply not present!! Please note the
difference from the Microsoft Excel graphical representation, which puts
things in the location (causing blank cell).
p.s. If you think about it closely, why waste the data structure storing
blank cells?
Now that the theoretical piece is done, if you are using the usermodel
the way that you can get the last of anything is the follow.
http://poi.apache.org/apidocs/index.html
From HSSFSheet lookup function that says getLastRowNum() to get last
row in a sheet
From HSSFRow lookup function that says getLastCellNum() to get last
cell in a row
To find out whether if the cells are empty do a loop through the area
that's less than getLastRowNum() or getLastCellNum() if any return
"null" then they are of type CELL_BLANK.
Hope this helps.
Andy
Tom Holmes Jr. wrote:
I'm reading in an Excel file successfully. I can get the
POIFileSystem, the Workbook, and the Worksheet.
I can get all the rows, and now I am trying to get a row (HSSFRow). The
first row is headers, and there are 22 columns, so I get these 22
fields. The other rows are all data.
However, some of these rows have blank/null values in those columns. So,
when I get row.getPhysicalNumberOfCells(), I don't get 22 columns.
I am using a switch to check for all the cell types, and I am looking
for a CELL_BLANK value and I don't see it.
Is there something I need to do to fix this? Thanks!
Tom
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]