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

How to: Clone a Workbook

Important

The Universal Subscription or an additional Office File API Subscription is required to use this example in production code. Refer to the DevExpress Subscription page for pricing information.

The following example demonstrates how to use the WorkbookExtensions.Clone extension method to create a workbook copy. To enable workbook extensions, add a reference to the DevExpress.Docs.v19.1.dll assembly and explicitly import the DevExpress.Spreadsheet namespace into the code with a using directive (Imports in Visual Basic).

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 copy of the document loaded into the SpreadsheetControl.
Workbook copy = spreadsheetControl.Document.Clone();