Logical operators and formulas are not supported yet. Check the formula docs on
the poi site (under hssf)
Sheet reference support is not there in 1.7.0, since we wanted to get a
milestone release before starting the next round of experiments. It has just
been checked in today. Writing sheet formulas works fine .. reading returns
wrong text. It'll take a few days to be stable enuf.
Quoting Scott D Smith <[EMAIL PROTECTED]>:
> I tried using the HSSFCell method 'setCellFormula' on POI dev version 1.6.0
> and 1.7.0 where my formula contained an 'IF' statement and also where the
> formula contained a reference to a cell in another worksheet and it failed.
> Is there a different way to achieve this, or is it just not supported yet?
> I have verified that the cells and sheets referenced in the formulas are
> valid.
> Thanks in advance for your help!!!
>
>
> <code-snippet>
>
> row.createCell( (short)2 ).setCellFormula("IF(A1=1,333,444)");
> row.createCell( (short)3 ).setCellFormula("Sheet2!J3");
>
> </code-snippet>
>
>
>
> <stacktrace>
>
> java.lang.RuntimeException: Cannot Parse, sorry
> at
> org.apache.poi.hssf.record.formula.FormulaParser.Abort(FormulaParser.java:127)
> at
> org.apache.poi.hssf.record.formula.FormulaParser.Expected
(FormulaParser.java:134)
> at
> org.apache.poi.hssf.record.formula.FormulaParser.Match(FormulaParser.java:186)
> at
> org.apache.poi.hssf.record.formula.FormulaParser.Ident(FormulaParser.java:242)
Error:
>
> ) Expected
> at
> org.apache.poi.hssf.record.formula.FormulaParser.Factor
(FormulaParser.java:301)
> at
> org.apache.poi.hssf.record.formula.FormulaParser.Term(FormulaParser.java:336)
> at
> org.apache.poi.hssf.record.formula.FormulaParser.Expression
(FormulaParser.java:381)
> at
> org.apache.poi.hssf.record.formula.FormulaParser.parse(FormulaParser.java:419)
> at
> org.apache.poi.hssf.usermodel.HSSFCell.setCellFormula(HSSFCell.java:701)
> at
> com.hallmark.utils.excel.composition.TestWriteJustin.main
(TestWriteJustin.java:86)
>
> </stacktrace>
>
>
>
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>