<changes>
<release version="3.5-beta7" date="2009-??-??">
+ <action dev="POI-DEVELOPERS" type="fix">47606 - Fixed XSSFCell to correctly parse column indexes greater than 702 (ZZ)</action>
<action dev="POI-DEVELOPERS" type="fix">47598 - Improved formula evaluator number comparison</action>
<action dev="POI-DEVELOPERS" type="fix">47571 - Fixed XWPFWordExtractor to extract inserted/deleted text</action>
<action dev="POI-DEVELOPERS" type="fix">47548 - Fixed RecordFactoryInputStream to properly read continued DrawingRecords</action>
this.cell = cell;
this.row = row;
if (cell.getR() != null) {
- this.cellNum = parseCellNum(cell.getR());
+ this.cellNum = new CellReference(cell.getR()).getCol();
}
this.sharedStringSource = row.getSheet().getWorkbook().getSharedStringSource();
this.stylesSource = row.getSheet().getWorkbook().getStylesSource();
cell.setR(ref);
}
- /**
- * Converts A1 style reference into 0-based column index
- *
- * @param r an A1 style reference to the location of this cell
- * @return 0-based column index
- */
- protected static short parseCellNum(String r) {
- r = r.split("\\d+")[0];
- if (r.length() == 1) {
- return (short) (r.charAt(0) - 'A');
- } else {
- return (short) (r.charAt(1) - 'A' + 26 * (r.charAt(0) - '@'));
- }
- }
-
/**
* Set the cells type (numeric, formula or string)
*
assertTrue(e.getMessage().startsWith("Invalid column index (-1)"));
}
- row.createCell(maxCellNum);
-
//Test high cell bound
try {
Cell cell = row.createCell(maxCellNum + 1);
// expected during successful test
assertTrue(e.getMessage().startsWith("Invalid column index ("+(maxCellNum+1)+")"));
}
+ for(int i=0; i < maxCellNum; i++){
+ Cell cell = row.createCell(i);
+ }
+ assertEquals(maxCellNum, row.getPhysicalNumberOfCells());
+ workbook = getTestDataProvider().writeOutAndReadBack(workbook);
+ sheet = workbook.getSheetAt(0);
+ row = sheet.getRow(0);
+ assertEquals(maxCellNum, row.getPhysicalNumberOfCells());
+ for(int i=0; i < maxCellNum; i++){
+ Cell cell = row.getCell(i);
+ assertEquals(i, cell.getColumnIndex());
+ }
+
}
/**