Update cells with External Links

Hi,


I am trying to read an Xlsx file with formula with external liks. Unfortunately, Aspose does not refresh cells values before exporting.
I used the latest version v7.4.2.

Please help, many thanks.

Hi,


Well, Aspose.Cells may not accurately update the formulas to get the calculated results in the template having external links or datasource etc., but, I think you may try to use Workbook.UpdateLinkedDataSource() method and try open your underlying source workbook in it, it may sort your issue out.

Sample code:

//this workbook has an external reference to “e:\test\source.xlsx”
Workbook wb = new Workbook(“e:\test\dest.xlsx”);
Workbook wbSrc = new Workbook(“e:\test\source.xlsx”);
wbSrc.Worksheets[0].Cells[“C8”].PutValue(10);
wbSrc.CalculateFormula();
MessageBox.Show(wbSrc.Worksheets[0].Cells[“C9”].StringValue);
//wb.Initialize();
wbSrc = new Workbook(“e:\test\source.xlsx”);
wb.UpdateLinkedDataSource(new Workbook[] { wbSrc });
wb.CalculateFormula();
MessageBox.Show(wb.Worksheets[0].Cells[“C10”].StringValue);
wb.Save(“e:\test\outdest.xlsx”);