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

DocumentFormat Struct

A document format.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v18.2.Core.dll

Declaration

[TypeConverter(typeof(DocumentFormatTypeConverter))]
[ComVisible(false)]
public struct DocumentFormat :
    IConvertToInt<DocumentFormat>

Remarks

The DocumentFormat structure introduces fields to specify the file format with which a workbook can be saved or from which it can be loaded. Use the ISpreadsheetComponent.SaveDocument and ISpreadsheetComponent.LoadDocument methods to specify the document format.

The following example illustrates how to save a workbook in XLSX format.

Call the SpreadsheetControl.SaveDocument with the file path as a parameter to save a workbook to the file. Specify the file format as the second parameter of the method using the DocumentFormat enumerator.

Note

Certain methods can throw unhandled exceptions if a problem occurs. Consider the situation when a document is being saved to a locked or read-only file. To prevent application failure, subscribe to the SpreadsheetControl.UnhandledException event and set the SpreadsheetUnhandledExceptionEventArgs.Handled property to true.

// Save the modified document to a file.
spreadsheetControl1.SaveDocument("Documents\\SavedDocument.xlsx", DocumentFormat.OpenXml);

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the DocumentFormat struct.

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.

See Also