[prev in list] [next in list] [prev in thread] [next in thread] 

List:       poi-user
Subject:    RE: Help: Cells out of order when reading .xlsx spreadsheet with large number of columns
From:       "Steve Hahn" <hahn21 () llnl ! gov>
Date:       2009-05-21 18:29:04
Message-ID: 002c01c9da42$0521aec0$0f650c40$ () gov
[Download RAW message or body]

Yeah, I just put in a small bit of the output.  I expected to see the
following output, for example:
  Column 27 value: COLUMN27
But, it is showing:
  Column 27 value: COLUMN728
That means that it read the 728th column right after the 26th column, but
should have read the 27th.

-----Original Message-----
From: Chris Lott [mailto:mail09@invest-faq.com] 
Sent: Thursday, May 21, 2009 11:03 AM
To: POI Users List
Subject: Re: Help: Cells out of order when reading .xlsx spreadsheet with
large number of columns

I'm trying to understand the statement "the cells are out of order".  In 
the example I see a strictly increasing sequence in the columns that you 
get.  To me, out of order means a sequence like 1, 17, 5, 100, 20, ..

Are you trying to say that you expected a perfectly rectangular result, 
with a string in each column?  AFAIK from reading POI documentation, 
Excel seems to implement a sparse matrix for spreadsheets.  In other 
words, cells that are completely empty don't get stored.  So the 
iterator you are using is probably skipping cells that have absolutely 
nothing in them.  Is there a chance some cells are empty?

Of course you said that you typed in 2,500 values.  So if those values 
are in the sheet, then you should see them in output.

chris...

Steve Hahn wrote:
> I'm getting an error reading .xlsx files with large numbers of columns.
> PROBLEM: the cells are not being read in the correct order.  I'm not sure
if
> it is pilot error or an actual bug.  I'm using POI version 3.5-beta5 and
saw
> on the POI list of changes the following fix for version 3.5-beta5: "Fixed
> XSSFCell to properly handle cell references with column numbers up to
> XFD(POI-DEVELOPERS)".  It seems related, but since I'm using that version
it
> should be fixed.  QUESTION: can you look at the following snippet and let
me
> know if I am doing something wrong?  The snippet simply prints each cell
in
> the first row to system.out.
> 
>   try {
>     File xlsxFile = new File("xlsx_loader_test.xlsx");
>     Workbook wb = new XSSFWorkbook(xlsxFile.getAbsolutePath());
>     Sheet sheet = wb.getSheet("Sheet1");
>     Row row = sheet.getRow(0);
>     int i = 0;
>     for (Cell cell : row) {
>       System.out.println("Column " + ++i + " value: " + cell.toString());
>     }
> 
>   } catch (Exception e) {
>     e.printStackTrace();
>   }
> 
> TO REPRODUCE THE ERROR:
> 
> 1. Create a spreadsheet with the name "xlsx_loader_test.xlsx".
> 
> 2. In the worksheet "Sheet1" put in the first row the following values:
> COLUMN1, COLUMN2, ..., COLUMN2500.  Specifically, you will have "COLUMN1"
in
> A1 up to "COLUMN2500" in CRD1
> 
> 3. Cut and paste the snippet above into Java class and run it against the
> spreadsheet.
> 
> The results I received produced only 702 columns.  Below is a small
portion
> of it where the columns are out of order. It starts at column 27:
> Column 24 value: COLUMN24
> Column 25 value: COLUMN25
> Column 26 value: COLUMN26
> Column 27 value: COLUMN728
> Column 28 value: COLUMN754
> Column 29 value: COLUMN780
> Column 30 value: COLUMN806
> Column 31 value: COLUMN832 


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


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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic