Get cell’s value having formula after calling calculateFormula() using Aspose.Cells for Java

Hi,

I can't get the value of a cell which there is a formula attached to it, it return 0. Any idea?

Here is my code and sample files attached.

--------------------------------------------------------------------

Worksheet sheet= book.getWorksheets().getSheet("Sheet1");

Cells cell = sheet.getCells();

for(int i=4;i<8;i++){

cell.getCell(i, 1).setValue(3);

}

System.out.println(cell.getCell(8, 1).getIntValue());

--------------------------------------------------------------------------------------------------------------

Thanks & Best Regards,

Hi,

Please
call Workbook.calculateFormula() before getting the cell’s value.


e.g


--------------------------------------------------------------------


Worksheet sheet= book.getWorksheets().getSheet(“Sheet1”);


Cells cell = sheet.getCells();

for(int i=4;i<8;i++){

cell.getCell(i, 1).setValue(3);

}

book.calculateFormula();

System.out.println(cell.getCell(8, 1).getIntValue());

--------------------------------------------------------------------------------------------------------------


Thank you.

Hi,

It's working fine now. Thanks.

Thansk & Best Regards,