You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ye...@apache.org on 2009/08/05 19:02:04 UTC
svn commit: r801305 - in /poi/trunk/src:
documentation/content/xdocs/status.xml
ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java
testcases/org/apache/poi/ss/usermodel/BaseTestRow.java
Author: yegor
Date: Wed Aug 5 17:02:04 2009
New Revision: 801305
URL: http://svn.apache.org/viewvc?rev=801305&view=rev
Log:
Fixed XSSFCell to correctly parse column indexes greater than 702 (ZZ), see Bugzilla #47606
Modified:
poi/trunk/src/documentation/content/xdocs/status.xml
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java
poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestRow.java
Modified: poi/trunk/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/status.xml?rev=801305&r1=801304&r2=801305&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Wed Aug 5 17:02:04 2009
@@ -33,6 +33,7 @@
<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>
Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java?rev=801305&r1=801304&r2=801305&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java Wed Aug 5 17:02:04 2009
@@ -97,7 +97,7 @@
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();
@@ -648,21 +648,6 @@
}
/**
- * 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)
*
* @throws IllegalArgumentException if the specified cell type is invalid
Modified: poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestRow.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestRow.java?rev=801305&r1=801304&r2=801305&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestRow.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestRow.java Wed Aug 5 17:02:04 2009
@@ -160,8 +160,6 @@
assertTrue(e.getMessage().startsWith("Invalid column index (-1)"));
}
- row.createCell(maxCellNum);
-
//Test high cell bound
try {
Cell cell = row.createCell(maxCellNum + 1);
@@ -170,6 +168,19 @@
// 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());
+ }
+
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org