You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Jessica Johnson <je...@internetmi.com> on 2007/02/01 21:45:09 UTC
problem creating hyperlink function
Hi all,
I'm trying to set up a hyperlink to another cell in the same excel document.
Here's my code:
curCell = curRow.createCell((short) 0);
curCell.setCellType(HSSFCell.CELL_TYPE_FORMULA);
String formula = "=HYPERLINK(\"[20070201022403641.xls]'Company
Specific'!A3\", "Branded")";
curCell.setCellFormula(formula);
The hyperlink formula works fine if I paste it into excel, but poi is
throwing an exception. Partial stack trace is here:
java.lang.RuntimeException: Cannot Parse, sorry : Integer 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.GetNum(FormulaParser.java:239)
at org.apache.poi.hssf.model.FormulaParser.Factor(FormulaParser.java:479)
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)
Does anyone know of a workaround for this problem?
Thanks in advance for any ideas you all might have.
jessica
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: problem creating hyperlink function
Posted by Jessica Johnson <je...@internetmi.com>.
I figured it out. In case anyone else gets stumped here, the leading
"=" should not in the formula.
jessica
On 2/1/07, Jessica Johnson <je...@internetmi.com> wrote:
> Hi all,
>
> I'm trying to set up a hyperlink to another cell in the same excel document.
>
> Here's my code:
>
> curCell = curRow.createCell((short) 0);
> curCell.setCellType(HSSFCell.CELL_TYPE_FORMULA);
> String formula = "=HYPERLINK(\"[20070201022403641.xls]'Company
> Specific'!A3\", "Branded")";
> curCell.setCellFormula(formula);
>
> The hyperlink formula works fine if I paste it into excel, but poi is
> throwing an exception. Partial stack trace is here:
>
> java.lang.RuntimeException: Cannot Parse, sorry : Integer 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.GetNum(FormulaParser.java:239)
> at org.apache.poi.hssf.model.FormulaParser.Factor(FormulaParser.java:479)
> 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)
>
> Does anyone know of a workaround for this problem?
>
> Thanks in advance for any ideas you all might have.
>
> jessica
>
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/