We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

getStringValue() works unexpeceted


In my example i want to replace certain cell’s formula to it’s value. It works, when worsheet’s flag “Display Zeros” is true, but don’t works, when this flag is false.

public void removeFormulaTest() {
Workbook wb = new Workbook();
Worksheet ws = wb.getWorksheets().get(0);

Cell cell = ws.getCells().get(1, 1);




assertEquals(0.0, cell.getValue());

String value = cell.getStringValue();
assertEquals(“0”, value);

cell.putValue(value, true);

I expected, that getStringValue() returns zeros too (getDisplayStringValue() should not).

Can you please help me with this issue? May be there is exists some way to replace formula by it’s value?

Best regards. Alexey

Hi Alexey,

Thanks for your posting and using Aspose.Cells.

We were able to observe this issue after executing your code with the latest version. Cell.getStringValue() should return 0 for cell B2, but it is returning an empty string.

We have logged this issue in our database for investigation. We will look into it and fix this issue. Once, the issue is resolved or we have some other update for you, we will let you know asap.

This issue has been logged as CELLSJAVA-40888.


We have evaluated your issue further. Well, Cell.getStringValue() for numeric values is designed to give the result a user can get when copying cell’s value as text. For zero value with DisplayZeros=false, the text you can get from MS Excel when copying this cell is also empty. To get the actual value, please use Cell.getValue() instead. And for your requirement that replacing formulas with the calculated value, there is another convenient API, i.e., Cells.removeFormulas() that you may use it.

Thank you.

Hello. Thank for reply. There is exists a way for remove formula for specified cell (not all)?


Well, I am afraid there is no such API but you may try to use:
Sample code:


Thank you.