Skip to main content

How to: Clone a Workbook

Important

The Workbook class is defined in the DevExpress.Docs.v26.1.dll assembly. Add this assembly to your project to use the Workbook API. You need a license for the DevExpress Office & PDF File API Subscription or DevExpress Universal Subscription to use this assembly in production code.

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