Formula Sheet Range Exception

Feb 22, 2010 at 3:53 PM
Edited Feb 22, 2010 at 4:07 PM

Hi,

The following block produces an exception.

static void Main(string[] args)
{
    HSSFWorkbook hssfworkbook = new HSSFWorkbook();
    HSSFSheet s1 = hssfworkbook.CreateSheet("Sheet1");
    s1.CreateRow(0).CreateCell(0).SetCellValue(5);
    HSSFSheet s2 = hssfworkbook.CreateSheet("Sheet2");
    s2.CreateRow(0).CreateCell(0).SetCellValue(5);
    HSSFSheet s3 = hssfworkbook.CreateSheet("Sheet3");
    s3.CreateRow(0).CreateCell(0).SetCellFormula("SUM(Sheet1:Sheet2!A1)");
}

SUM(Sheet1:Sheet2!A1) is perfectly fine for Excel.

Am I doing something wrong?

Thanks in advance.

Mar 14, 2010 at 12:26 PM

7 lines, anyone tried them yet? :-)