How to: Clone a Workbook

Important

The Workbook class is defined in the DevExpress.Docs.v21.2.dll assembly. Add this assembly to your project to use the Workbook API. You need an active license for the DevExpress Office 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();