To start working with DevExpress office controls and use their extended document editing capabilities, load a document into the control. A document can be loaded into an office control in one of the following ways.
By default, a control is initialized with the automatically generated document (if no document is opened explicitly by code).
A new document can be created explicitly in one of the following ways:
via the UI (using the built-in ribbon’s New command)
through public API (using the control level's New method)
You can open an existing document via one of the approaches below:
through the UI (using the ribbon's Open command)
through public API (using the control level's Open methods)
To load a document, end-users can use the built-in ribbon’s New or Open commands, which is displayed in an office control by default.
The availability of the New, Open, Save and Save As ribbon commands in the document management UI is based on the concept of using the server's local file system as a document storage and defining an office control's WorkDirectory property to specify the root server folder for all document operations (such as opening or saving). In this case, all built-in File Dialogs are available for end-users by default – allowing users to navigate through files and folders within the specified folder and select documents to load or save.
If you use a custom document storage that is not based on the server file system (for instance, a database), hide the built-in ribbon's File tab and implement your custom UI for opening and saving documents, because the WorkDirectory and built-in document management ribbon commands are not in effect in this case.
The public API used to create and open documents is exposed at the level of the office control. The main API members are listed below.
Office Control Level
Creates a new empty document within an office control.
Note that the DocumentId is empty for a new document, so it cannot be accessed from a list of opened documents maintained by DocumentManager. You need to specify a unique DocumentId for newly created documents, or they will be completely lost when an end-user switches to another document (e.g., when creating another document or opening existing one).
Open method overloads
An office control opens a document specified by the method's parameters.
Note that certain Open methods (which open a document from the server file system) set the document's DocumentId automatically; the others require you to specify it manually.
Refer to the following topics to learn more on how to open documents within DevExpress office controls.