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

Free Support Forum - aspose.com

Cell's getValue() returns null when cell contains specific formula in Excel 2007

I’m running into an issue where com.aspose.cells.Cell’s getValue() method returns null when reading a cell with a formula containing the TEXT function or ‘&’ (concatenation char) or a simple reference (like ‘=A1’). This behavior is exhibited only in Excel 2007 and not in Excel 2003. I tried the SUM function and getValue() is able to return the correct value.

Arbitrary examples of formulae I’m facing issues with are
=A3
=TEXT(“A”,"")
="Value is “&” 25"

Anyone else experience this issue?

Hi,

I have tested your scenario but could not find the issue you have mentioned. I have a template .xlsx file which has your desired formulas into its first worksheet cells, I run the following code and it gives me perfect results.


Workbook workbook = new Workbook();
workbook.open("e:\\files\\formulaTest.xlsx",FileFormatType.EXCEL2007);
Worksheet worksheet = workbook.getWorksheets().getSheet(0);
Cells cells = worksheet.getCells();
Cell cell = cells.getCell("A1"); //The A1 cell contains =A3 formula
System.out.println(cell.getValue()); //the value is ok.....
cell = cells.getCell("C1");//The C1 cell contains the formula =TEXT("A","")
System.out.println(cell.getValue()); // the value is ok

cell = cells.getCell("C2");//The C2 cell contains the formula ="Value is "&" 25"
System.out.println(cell.getValue());// the value is ok

Which version of Aspose.Cells for Java you are using. I have tried the latest version/fix (attached). Could you try the attached version.

Thank you.

I’m using 1.9.4. Let me give my scenarios a shot with 1.9.5.29 that you’ve attached, check my results and post back.

Hi,

Well, Could you attach the screenshot(s) as I don't find them attached.

Thank you.

So 1.9.5 did the trick. All my scenarios passed. I obviously have to upgrade from 1.9.4 to 1.9.5.
Appreciate your prompt responses.
Thanks.

Hi,

Good to know that you don't find any issue.

Have a good day!

Thank you.