You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2004/05/04 00:54:10 UTC

DO NOT REPLY [Bug 28754] New: - Quotes within formula string gives "Cannot parse" error

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28754>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28754

Quotes within formula string gives "Cannot parse" error

           Summary: Quotes within formula string gives "Cannot parse" error
           Product: POI
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: HSSF
        AssignedTo: poi-dev@jakarta.apache.org
        ReportedBy: new_connie@hotmail.com


Excel allows quotes within string - but escapes it with a " before that.

So, the formula -
   =RIGHT("test""ing", 3)
is allowed in excel and returns the string "ing".

Trying to do the same using HSSF gives an error.

The call -
   cell.setCellFormula("RIGHT(\"test\"\"ing\", 3)");

The stacktrace -
java.lang.RuntimeException: Cannot Parse, sorry : ) Expected
Error: ) Expected
	at org.apache.poi.hssf.model.FormulaParser.Abort(FormulaParser.java:117)
	at org.apache.poi.hssf.model.FormulaParser.Expected
(FormulaParser.java:124)
	at org.apache.poi.hssf.model.FormulaParser.Match(FormulaParser.java:184)
	at org.apache.poi.hssf.model.FormulaParser.function
(FormulaParser.java:316)
	at org.apache.poi.hssf.model.FormulaParser.Ident(FormulaParser.java:265)
	at org.apache.poi.hssf.model.FormulaParser.Factor
(FormulaParser.java:474)
	at org.apache.poi.hssf.model.FormulaParser.Term(FormulaParser.java:548)
	at org.apache.poi.hssf.model.FormulaParser.Expression
(FormulaParser.java:596)
	at org.apache.poi.hssf.model.FormulaParser.parse(FormulaParser.java:700)
	at org.apache.poi.hssf.usermodel.HSSFCell.setCellFormula
(HSSFCell.java:678)
	at emr.test.Test.setSecondRow(Test.java:88)
	at emr.test.Test.main(Test.java:116)
Exception in thread "main" 

cheers
Conrad

PS I'm using version 2.5 (the version combobox in poi bugzilla doesn't have 
that option!)

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