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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to