Different value to Excel when accessing invalid reference

Hello,


I am currently evaluating Aspose.Cells for java and I’ve found a difference in its behaviour when compared to Excel. When I run the following code:

public static void main(String[] someArgs) throws Exception
{
Workbook workbook = new Workbook(“test/Test001.xls”);
workbook.getSettings().setCalcMode(CalcModeType.MANUAL);

int sheet = 0;
int row = 0;
int col = 0;

System.out.println(workbook.getWorksheets().get(sheet).getCells().get(row, col).getStringValue());
workbook.calculateFormula();
System.out.println(workbook.getWorksheets().get(sheet).getCells().get(row, col).getStringValue());
workbook.save(“test/Test001-result.xls”, FileFormatType.EXCEL_2003_XML);
}

On the attached spreadsheet (which contains in cell Sheet1!A1 an invalid reference to another cell) I get the following output:

#REF!
0

Basically the workbook originally (from Excel) contains a #REF!, and the saved resulting workbook contains a #REF! when recalculated in Excel, but a recalc in Aspose results in a zero.

Should Aspose.Cells match Excel’s behaviour as close as possible?

Hi,


Thanks for your code snippet and sample file.

After an initial test, I can notice the issue as you have mentioned. I got the same output as per your console output.

I have logged a ticket with an id “CELLSJAVA-40476” for your issue. We will look into your issue soon.


By the way, there is one flaw in your code i.e. please change your last line of code:

"workbook.save(“test/Test001-result.xls”, FileFormatType.EXCEL_2003_XML);"

to:

"workbook.save(“test/Test001-result.xls”);"

Because you are saving in XLS file format and not in SpreadsheetML(XML) file format. If you need to save to SpreadsheetML file format, then your code can be:
workbook.save(“test/Test001-result.xml”, FileFormatType.EXCEL_2003_XML);

Thank you.

Thanks for the feedback, and thanks for raising this as an issue!

Hi,

Thanks for your posting and using Aspose.Cells.

We have already logged your issue. Once, we will have some update for you, we will share it with you asap.

The issues you have found earlier (filed as CELLSJAVA-40476) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.