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

Document Saving

  • 2 minutes to read

DevExpress office controls provide general-purpose document saving capabilities. They are introduced to end-users through built-in UI commands and are available to developers through a public API.

In an application, a document save operation can be initiated in the following cases.

  • 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 Standard and Custom Saving topic to learn more.
  • The AutoSave feature (which is off by default) triggers document saving after a specific period of time. Refer to the Auto-Saving topic for more information.

This topic describes the main UI commands and API members that relate to document saving.

UI Commands

To save a document, end-users can use the Save and SaveAs commands of the built-in ribbon, which is displayed in an office control by default.

Document Management UI

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 office control‘s currently edited document in a specific manner and does not affect the original document state. The syntaxes of the main overloads are given below.

    • void SaveCopy(string documentPath)
    • void SaveCopy(Stream stream, DocumentFormat format)
    • Byte[] SaveCopy(DocumentFormat format)
  • Saving event

    Enables you to handle document save operations in a custom manner and resolve multi-user conflicts, if any.

  • AutoSaveMode property

    Specifies whether to explicitly enable auto-saving of documents opened by this particular office control.

  • AutoSaveTimeout property

    Specifies a delay after which the next auto-save operation will be performed.

DocumentManager Level

  • SaveCopy method overloads (at the IDocumentInfo level)

    Each method overload saves a copy of this particular open document in a specific manner and does not affect the original document state. The syntaxes of the available overloads are given below.

    • void SaveCopy(string filePath)
    • void SaveCopy(Stream stream)
    • Byte[] SaveCopy()
  • AutoSaving event

    Enables you to handle document auto-save operations in a custom manner and resolve multi-user conflicts, if any.

Refer to the following topics to learn more on how to process document save operations.