Skip to main content
.NET Framework 4.5.2+

ExternalWorkbook Interface

An external workbook.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v23.1.Core.dll


public interface ExternalWorkbook :


A workbook can be a non-visual object, such as the Workbook, or the document loaded into the spreadsheet control (available via the SpreadsheetControl.Document property).

The following code snippet demonstrates how to create an external workbook, fill it with data and add to the ExternalWorkbookCollection.

View Example

Dim externalWorkbook As New Workbook()
externalWorkbook.Worksheets(0).Import(CreateDataTable(10), False, 0, 0)
externalWorkbook.Options.Save.CurrentFileName = "ExternalDocument.xlsx"
For Each item As IWorkbook In spreadsheetControl1.Document.ExternalWorkbooks
    If item.Options.Save.CurrentFileName = externalWorkbook.Options.Save.CurrentFileName Then
    End If
Next item

Subsequently the external workbook can be referenced in cell formulas. The following code inserts reference to the external workbook contained in the IWorkbook.ExternalWorkbooks collection.

View Example

If spreadsheetControl1.Document.ExternalWorkbooks.Count = 0 Then
    MessageBox.Show("Add a workbook to the ExternalWorkbooks collection")
End If
Dim extWorkbook As IWorkbook = DirectCast(spreadsheetControl1.Document.ExternalWorkbooks(0), IWorkbook)
Dim extWorkbookName As String = extWorkbook.Options.Save.CurrentFileName
Dim sFormula As String = String.Format("=[{0}]Sheet1!A1", extWorkbookName)
spreadsheetControl1.Document.Worksheets(0).Cells("A1").Formula = sFormula

For more information on workbooks in the SpreadsheetControl, see the Workbook document.

See Also