Skip to main content
A newer version of this page is available. .

How to: Clone a Workbook

Important

The Workbook class is defined in the DevExpress.Docs.v19.2.dll assembly. Add this assembly to your project to use the workbook functionality. You need a license to the DevExpress Office File API or DevExpress Universal Subscription to use this assembly in production code. Refer to the DevExpress Subscription page for pricing information.

The following example demonstrates how to use the WorkbookExtensions.Clone method to create a workbook copy.

Use the WorkbookExtensions.Clone method overload with the copyFormulas parameter set to false to create a copy that replaces formulas with their calculated results.

// 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();