When the SpreadsheetControl loads a workbook containing external references, they are added to the IWorkbook.ExternalWorkbooks collection. However, the external references, created in this manner, are not "live". The references contain cached data and the SpreadsheetControl cannot update them.
To make a reference updateable, it should be replaced with a reference to a workbook instance.
Note that the use of the Workbook class instance in production code requires a license to the DevExpress Document Server or the DevExpress Universal Subscription.
This example demonstrates how to accomplish this. To create a workbook instance, load a workbook file into an instance of the Workbook class (or into another SpreadsheetControl instance).
Subsequently the ExternalWorkbookCollection.Replace method is used to replace the cached reference with a live external reference.
Note that a workbook name in the external reference should be identical to the WorkbookSaveOptions.CurrentFileName property of the referenced workbook instance when the workbook is added to the ExternalWorkbookCollection. That is, if the workbook instance is created by loading a file using a full path, the reference should contain the full path, e.g. 'C:\Temp\[Book1.xlsx]Sheet1'!B3. The string with the reference created in this manner might be too long and inconvenient in use. The Workbook.Options.Save.CurrentFileName property of a referenced workbook enables you to specify a name that is easier to read, for example, "MyExternalWorkBook". Replace the corresponding item of the ExternalWorkbookCollection with an instance of the workbook with a custom CurrentFileName, and use it in external references instead of the file name, e.g. [MyExternalWorkBook]Sheet1!B3.
To make a reference updateable, it should be replaced with a reference to a workbook instance.
Note that the use of the Workbook class instance in production code requires a license to the DevExpress Document Server or the DevExpress Universal Subscription.
This example demonstrates how to accomplish this. To create a workbook instance, load a workbook file into an instance of the Workbook class (or into another SpreadsheetControl instance).
Subsequently the ExternalWorkbookCollection.Replace method is used to replace the cached reference with a live external reference.
Note that a workbook name in the external reference should be identical to the WorkbookSaveOptions.CurrentFileName property of the referenced workbook instance when the workbook is added to the ExternalWorkbookCollection. That is, if the workbook instance is created by loading a file using a full path, the reference should contain the full path, e.g. 'C:\Temp\[Book1.xlsx]Sheet1'!B3. The string with the reference created in this manner might be too long and inconvenient in use. The Workbook.Options.Save.CurrentFileName property of a referenced workbook enables you to specify a name that is easier to read, for example, "MyExternalWorkBook". Replace the corresponding item of the ExternalWorkbookCollection with an instance of the workbook with a custom CurrentFileName, and use it in external references instead of the file name, e.g. [MyExternalWorkBook]Sheet1!B3.