Free Support Forum - aspose.com

External reference

Hello,

Im trying with “Aspose.Cells” and I’ve got a question.

I´ve got a file named “file1.xls” and it is referenced to cells in "file2.xls"

Does “Aspose.Cells” support an external reference to cells in another workbook?

if it does, may you send me some example?

Thanks.

Hi,

Yes, Aspose.Cells does support external references. See a simple sample code for your reference:

Sample code:


//this workbook has an external reference to “D:\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\out_dest.xlsx”);

Thank you.

Hi,

When I am trying to open a file with external reference.
Me.GridDesktop1.ImportExcelFile(“E:\tmp\prueba_aspose\libro1.xls”)
Ive got #REF error ?

how can I asign Aspose.Cells.Workbook to Aspose.Cells.GriddeskTop ?

Me.GridDesktop1 = Workbook

How can I fix it ?

Thanks.

Hi,

Well, I am afraid, Aspose.Cells.GridDesktop control does not support external references. The feature is only available in Aspose.Cells component.

Also, since Aspose.Cells library and Aspose.Cells.GridDesktop are different components (one is control and other is library) and have different architectures and attributes, so the conversion is not possible.

Thanks,