Workbook.SaveDocument(String, DocumentFormat) Method
Saves the document to a file, specifying the document format.
You require a license to the DevExpress Office File API or DevExpress Universal Subscription to use this method in production code.
Namespace: DevExpress.Spreadsheet
Assembly: DevExpress.Docs.v18.2.dll
Declaration
Parameters
Name | Type | Description |
---|---|---|
fileName | String | A string value specifying the path to a file into which to save the document. |
format | DocumentFormat | One of the DocumentFormat enumeration values. |
Remarks
Use the Workbook.Options.Export property that returns the WorkbookExportOptions object to set global export options, or handle the Workbook.BeforeExport event to specify options for an individual export action.
Example
Call the Workbook.SaveDocument method with the passed file path to save a workbook to the file. Specify the file format as the second parameter of the method using the DocumentFormat enumerator.
// Add a reference to the DevExpress.Docs.dll assembly.
using DevExpress.Spreadsheet;
// ...
Workbook workbook = new Workbook();
// ...
// Save the modified document to the file.
workbook.SaveDocument("Documents\\SavedDocument.xlsx", DocumentFormat.Xlsx);
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the SaveDocument(String, DocumentFormat) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.