When creating a spreadsheet using Aspose.Cells version 21.3 with a shared VLOOKUP formula (i.e. using the setSharedFormula method), Excel fails to open the spreadsheet correctly. The error message is:
"We found a problem with some content in ’VLookupTest.xlsx’. Do you want us to try to recover as much as we can? If you trust the source of this workbook, click Yes."
However, when creating a spreadsheet using Aspose.Cells version 21.3 without a shared VLOOKUP formula (i.e. using the setFormula method instead of the setSharedFormula method), Excel opens the spreadsheet no problem.
Is this a bug or am I doing something wrong? Here is my sample code:
final Workbook wb = new Workbook();
wb.getWorksheets().add();
final Worksheet ws1 = wb.getWorksheets().get(0);
final Worksheet ws2 = wb.getWorksheets().get(1);
final Cell ws2CellA1 = ws2.getCells().get(“A1”);
ws2CellA1.setValue(“BHX”);
final Cell ws2CellB1 = ws2.getCells().get(“B1”);
ws2CellB1.setValue(“England”);
final Cell ws1CellA1 = ws1.getCells().get(“A1”);
ws1CellA1.setValue(“BHX”);
final Cell ws1CellB1 = ws1.getCells().get(“B1”);
ws1CellB1.setSharedFormula("=VLOOKUP(A1,Sheet2!A:B,2,FALSE)", 1, 1); // THIS DOES NOT WORK
// ws1CellB1.setFormula("=VLOOKUP(A1,Sheet2!A:B,2,FALSE)"); // THIS WORKS
wb.save(“VLookupTest.xlsx”);