POI  HSSF doesnt seem to support remote reference formula(supported by
excel). I am trying to do something like this:

        HSSFWorkbook wb = new HSSFWorkbook();
        HSSFSheet sheet = wb.createSheet("new sheet");
        
        HSSFRow row = sheet.createRow((short) 0);
         //Create a cell and put a value in it.

        HSSFCell mycell = row.createCell((short)0);
        mycell.setCellType(HSSFCell.CELL_TYPE_FORMULA);
        mycell.setCellFormula("BLP|M!MSFT"); //remote reference formula 

I am getting the following error:

java.lang.StringIndexOutOfBoundsException: String index out of range: 0
        at java.lang.String.charAt(String.java:444)
        at org.apache.poi.hssf.util.CellReference.<init>(CellReference.java:44)
        at 
org.apache.poi.hssf.record.formula.ReferencePtg.<init>(ReferencePtg.java:50)
        at org.apache.poi.hssf.model.FormulaParser.Ident(FormulaParser.java:320)
        at 
org.apache.poi.hssf.model.FormulaParser.Factor(FormulaParser.java:524)
        at org.apache.poi.hssf.model.FormulaParser.Term(FormulaParser.java:602)
        at 
org.apache.poi.hssf.model.FormulaParser.Expression(FormulaParser.java:651)
        at org.apache.poi.hssf.model.FormulaParser.parse(FormulaParser.java:756)
        at 
org.apache.poi.hssf.usermodel.HSSFCell.setCellFormula(HSSFCell.java:689)


I can enter the formula manually in excel and it works. CAn this be
done in HSSF?Pls help.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/

Reply via email to