Skip to main content
Row

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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.2.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