officefileapi-devexpress-dot-spreadsheet-dot-workbookextensions-dot-clone-x28-devexpress-dot-spreadsheet-dot-iworkbook-x29.md
Creates a workbook copy.
You need a license for the DevExpress Office File API Subscription or DevExpress Universal Subscription to use this method in production code.
Namespace : DevExpress.Spreadsheet
Assembly : DevExpress.Docs.v25.2.dll
NuGet Package : DevExpress.Document.Processor
public static Workbook Clone(
this IWorkbook workbook
)
<ExtensionAttribute>
Public Shared Function Clone(
workbook As IWorkbook
) As Workbook
| Name | Type | Description |
|---|---|---|
| workbook | IWorkbook |
An object exposing the IWorkbook interface that specifies the source workbook for copying.
|
| Type | Description |
|---|---|
| Workbook |
A Workbook object that is the created copy.
|
The Clone method is an extension method of the object that exposes the IWorkbook interface (SpreadsheetControl.Document or non-visual Workbook) and is called by using instance method syntax.
The following example demonstrates how to create copies of the existing workbooks.
// Add a reference to the DevExpress.Docs.dll assembly.
using DevExpress.Spreadsheet;
// ...
// Create a new Workbook object.
Workbook workbook = new Workbook();
workbook.LoadDocument("Document.xlsx", DocumentFormat.Xlsx);
// Create a copy of the Workbook object.
Workbook copy = workbook.Clone();
// Create a copy of the document loaded into the SpreadsheetControl.
Workbook copy2 = spreadsheetControl.Document.Clone();
' Add a reference to the DevExpress.Docs.dll assembly.
Imports DevExpress.Spreadsheet
' ...
' Create a new Workbook object.
Private workbook As New Workbook()
workbook.LoadDocument("Document.xlsx", DocumentFormat.Xlsx)
' Create a copy of the Workbook object.
Dim copy As Workbook = workbook.Clone()
' Create a copy of the document loaded into the SpreadsheetControl.
Dim copy2 As Workbook = spreadsheetControl.Document.Clone()
See Also