Set External Links in Formulas in Aspose.Cells
Contents[ Hide ]
Sometimes, it is necessary to include links to external files in formulas, for example to evaluate a cell or range value against them. Aspose.Cells provides this feature and this document explains how to use it.
The sample code below shows how to include external files in formulas.
string FilePath = @"..\..\..\Sample Files\"; string FileName = FilePath + "Set External Links in Formula.xlsx"; //Instantiate a new Workbook. Workbook workbook = new Workbook(); //Get first Worksheet Worksheet sheet = workbook.Worksheets; //Get Cells collection Aspose.Cells.Cells cells = sheet.Cells; //Set formula with external links cells["A1"].Formula = "=SUM('[book1.xls]Sheet1'!A2, '[book1.xls]Sheet1'!A4)"; //Set formula with external links cells["A2"].Formula = "='[book1.xls]Sheet1'!A8"; //Save the workbook workbook.Save(FileName);