Log In
[Expand]General Information
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]What's Installed
 [Collapse]Common Concepts
  [Expand]Web.config Modifications
  [Expand]Callback Exception Handling
  [Expand]Client-Side Functionality
  [Expand]Cookies Support
  [Expand]Appearance Customization - Theming
   Icon Collection
  [Expand]Performance Optimization
  [Expand]CSS Image Sprites
   Supported Document Types
  [Expand]Accessibility Support
   Right to Left Support
   HTML Encoding
   Binary Storage Configuration
  [Expand]SharePoint Support
   Touch Support
  [Collapse]Office Document Management
   [Collapse]Document Loading
     Opening Documents
     Sharing Documents
   [Expand]Document Saving
    Document Hibernation
   Cloud Storage Account Management
  [Expand]Web Farm and Web Garden Support
 [Expand]ASP.NET WebForms Controls
 [Expand]ASP.NET MVC Extensions
 [Expand]Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Report Server
[Expand]eXpressApp Framework
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Document Loading

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 created new document (if no document is opened explicitly by code)
  • A new document can be created explicitly in one of the following ways:
    • through the UI (using the New command of the built-in ribbon)
    • through public API (using the control level's New method)
  • An existing document can be opened 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)

Expanded UI Commands

To load a document, end-users can use the New or Open commands of the built-in ribbon, 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 a document to load or save.

If you use a custom document storage that is not based on the server file system (for instance, a database), it is recommended that you 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.

Expanded API

The public API that relates to document creation and opening is exposed at the level of the office control. The main API members are listed below.

Office Control Level

  • New method
    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. An office control remembers such a document as long as it works with the document. The document and all its content will be completely lost after the office control switches to another document (by New or Open). So, it is strongly recommended that you assign a unique DocumentId for newly created documents.

  • 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.

How would you rate this topic?​​​​​​​