Hi,
Using Aspose Cells for Java, version 16.12.7.
Sample code:
<pre style=“background-color: rgb(255, 255, 255); font-family: “Courier New”; font-size: 9pt;”><pre style=“font-family: “Courier New”; font-size: 9pt;”>Workbook workbook = new Workbook();
WorksheetCollection worksheets = workbook.getWorksheets();
Worksheet sheet1 = worksheets.add(“S.02.01.01.01”);
Cell cell = sheet1.getCells().get(0, 0);
cell.setFormula("=[model.xlsx]S.02.01.01.01!A1");
Worksheet sheet2 = worksheets.add(“S.03.01.01.01”);
cell = sheet2.getCells().get(0, 0);
cell.setFormula("=[model.xlsx]S.03.01.01.01!A1");
System.out.println("formula: " + cell.getFormula());
worksheets.removeAt(“Sheet1”);
workbook.save(“sheets.xlsx”);
WorksheetCollection worksheets = workbook.getWorksheets();
Worksheet sheet1 = worksheets.add(“S.02.01.01.01”);
Cell cell = sheet1.getCells().get(0, 0);
cell.setFormula("=[model.xlsx]S.02.01.01.01!A1");
Worksheet sheet2 = worksheets.add(“S.03.01.01.01”);
cell = sheet2.getCells().get(0, 0);
cell.setFormula("=[model.xlsx]S.03.01.01.01!A1");
System.out.println("formula: " + cell.getFormula());
worksheets.removeAt(“Sheet1”);
workbook.save(“sheets.xlsx”);
As you can see, two sheets are created. Both sheets contain a cell that has a formula pointing to an external workbook (“model.xlsx”).
When opening the generated workbook in Excel 2010, the formula in the first sheet (“S.02.01.01.01”) shows as expected. However, the formula in the second sheet (“S.03.01.01.01”) has unexpectedly been tranformed to a “3D” Excel formula that spans multiple sheets, looking like the following:
=’[model.xlsx]S.03.01.01.01:S.02.01.01.01’!A1
Note that you can see this happening already from the System.out.println() in the sample code.
Generated workbook is attached.
Thanks in advance,
Taras