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

Free Support Forum - aspose.com

Is there a feature which allows you to force all formulas that result in error OR zero to blank?

Basically, I have a spreadsheet that has a bunch of formulas that reference other cells, some of which maybe blank and as a result some formulas result in zero OR error: #DIV/0!, #VALUE!

I would like to force all these to blank.
I would think this is a common use case.

If there is no such feature, is there a recommended way to handle this scenario.

Hi,


Well, there is no such feature available for your custom needs either in MS Excel or in Aspose.Cells. You may accomplish the task easily by using your own code. Please refer to the following code segment and may add/update your code accordingly.
e.g
Sample code:
…

workbook.calculateFormula();
//write the data area of the worksheet etc.
Range range = worksheet.getCells().getMaxDisplayRange();

Iterator iter = range.iterator();
while(iter.hasNext())
{
Cell cell = (Cell)iter.next();
if (cell.isFormula())
{
if (cell.isErrorValue())
{
cell.setValue(null);
//cell.putValue("");
}


}
}

Hope, this helps a bit.


Thank you.