Skip to main content
Row

WorkbookExtensions.Clone(IWorkbook) Method

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.v24.1.dll

NuGet Package: DevExpress.Document.Processor

Declaration

public static Workbook Clone(
    this IWorkbook workbook
)

Parameters

Name Type Description
workbook IWorkbook

An object exposing the IWorkbook interface that specifies the source workbook for copying.

Returns

Type Description
Workbook

A Workbook object that is the created copy.

Remarks

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();
See Also