Document Saving
- 2 minutes to read
DevExpress office controls provide general document saving capabilities. Users can access these features at runtime through UI commands, and developers can use a public API.
An application’s document save operation can be initiated in the following ways.
- An end user selects the Save or SaveAs command in the office control UI.
- A developer calls the Save or SaveCopy methods of the public API. See the following help topic to learn more: Standard and Custom Saving.
- The AutoSave feature (which is off by default) triggers document saving after a specific period of time. Refer to the following help topic for more information: Auto-Saving.
This topic describes the main UI commands and API members that relate to document saving.
Important
Specify the ASPxRichEdit.WorkDirectory/ASPxSpreadsheet.WorkDirectory property to make the open and save document operations available.
UI Commands
To save a document, end users can use the built-in ribbon’s Save and SaveAs commands. The ribbon is displayed in an office control by default.
API
The public API used to save documents is exposed at two levels - at the office control and the DocumentManager object level. The main API members are listed below.
Office Control Level
Save method
Saves the currently edited document in its original format and location.
SaveCopy method overloads
Each method overload saves a copy of the current document. It does not affect the original document’s state. The syntax of the main overloads is as follows.
void SaveCopy(string documentPath)
void SaveCopy(Stream stream, DocumentFormat format)
Byte[] SaveCopy(DocumentFormat format)
Saving event
Enables you to handle document save operations manually to resolve multi-user conflicts, if any.
AutoSaveMode property
Specifies whether to explicitly enable auto-saving of documents opened by the office control.
AutoSaveTimeout property
Specifies the delay before the next auto-save operation is executed.
DocumentManager Level
SaveCopy method overloads (at the IDocumentInfo level)
Each method overload saves a copy of the current document. It does not affect the original document’s state. The syntax of the available overloads is as follows.
void SaveCopy(string filePath)
void SaveCopy(Stream stream)
Byte[] SaveCopy()
AutoSaving event
Enables you to handle document auto-save operations manually and resolve multi-user conflicts, if any.
Refer to the following help topics to learn more on how to process document save operations.