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/02/15 21:45:25 UTC
svn commit: r744749 - in /poi/trunk/src:
documentation/content/xdocs/changes.xml
documentation/content/xdocs/status.xml
java/org/apache/poi/ss/formula/FormulaParser.java
testcases/org/apache/poi/hssf/model/TestFormulaParser.java
Author: yegor
Date: Sun Feb 15 20:45:24 2009
New Revision: 744749
URL: http://svn.apache.org/viewvc?rev=744749&view=rev
Log:
Fixed formula parser to handle names with backslashes
Modified:
poi/trunk/src/documentation/content/xdocs/changes.xml
poi/trunk/src/documentation/content/xdocs/status.xml
poi/trunk/src/java/org/apache/poi/ss/formula/FormulaParser.java
poi/trunk/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java
Modified: poi/trunk/src/documentation/content/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/changes.xml?rev=744749&r1=744748&r2=744749&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/changes.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/changes.xml Sun Feb 15 20:45:24 2009
@@ -37,6 +37,7 @@
<!-- Don't forget to update status.xml too! -->
<release version="3.5-beta6" date="2008-??-??">
+ <action dev="POI-DEVELOPERS" type="fix">Fixed formula parser to handle names with backslashes</action>
<action dev="POI-DEVELOPERS" type="add">46660 - added Workbook getHidden() and setHidden(boolean)</action>
<action dev="POI-DEVELOPERS" type="fix">46693 - Fixed bugs serialization bugs in records: CHARTFORMAT, SHTPROPS, SXVD and SXVDEX</action>
<action dev="POI-DEVELOPERS" type="fix">46627 - Fixed offset of added images if Pictures stream contains pictures with zero length</action>
Modified: poi/trunk/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/status.xml?rev=744749&r1=744748&r2=744749&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Sun Feb 15 20:45:24 2009
@@ -34,6 +34,7 @@
<!-- Don't forget to update changes.xml too! -->
<changes>
<release version="3.5-beta6" date="2008-??-??">
+ <action dev="POI-DEVELOPERS" type="fix">Fixed formula parser to handle names with backslashes</action>
<action dev="POI-DEVELOPERS" type="add">46660 - added Workbook getHidden() and setHidden(boolean)</action>
<action dev="POI-DEVELOPERS" type="fix">46693 - Fixed bugs serialization bugs in records: CHARTFORMAT, SHTPROPS, SXVD and SXVDEX</action>
<action dev="POI-DEVELOPERS" type="fix">46627 - Fixed offset of added images if Pictures stream contains pictures with zero length</action>
Modified: poi/trunk/src/java/org/apache/poi/ss/formula/FormulaParser.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/FormulaParser.java?rev=744749&r1=744748&r2=744749&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/FormulaParser.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/FormulaParser.java Sun Feb 15 20:45:24 2009
@@ -298,7 +298,7 @@
} else {
// allow for any sequence of dots and identifier chars
// special case of two consecutive dots is best treated in the calling code
- while (IsAlNum(look) || look == '.' || look == '[' || look == ']') {
+ while (IsAlNum(look) || look == '.' || look == '[' || look == ']' || look == '\\') {
sb.append(look);
GetChar();
}
Modified: poi/trunk/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java?rev=744749&r1=744748&r2=744749&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/model/TestFormulaParser.java Sun Feb 15 20:45:24 2009
@@ -996,4 +996,25 @@
MemFuncPtg mf = (MemFuncPtg)ptgs[0];
assertEquals(15, mf.getLenRefSubexpression());
}
+
+ /** Named ranges with backslashes, e.g. 'POI\\2009' */
+ public void testBackSlashInNames() {
+ HSSFWorkbook wb = new HSSFWorkbook();
+
+ HSSFName name = wb.createName();
+ name.setNameName("POI\\2009");
+ name.setRefersToFormula("Sheet1!$A$1");
+
+ HSSFSheet sheet = wb.createSheet();
+ HSSFRow row = sheet.createRow(0);
+
+ HSSFCell cell_C1 = row.createCell(2);
+ cell_C1.setCellFormula("POI\\2009");
+ assertEquals("POI\\2009", cell_C1.getCellFormula());
+
+ HSSFCell cell_D1 = row.createCell(2);
+ cell_D1.setCellFormula("NOT(POI\\2009=\"3.5-final\")");
+ assertEquals("NOT(POI\\2009=\"3.5-final\")", cell_D1.getCellFormula());
+ }
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org