[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Collapse]Rich Text Editor
   [Expand]Product Information
    Product Class Structure
    Supported Formats
   [Expand]Getting Started
   [Collapse]RichEditControl Document
    [Expand]Document Structure
    [Collapse]Document Elements
      Positions and Ranges
      Characters
      Paragraphs
      Inline Pictures
      Hyperlinks and Bookmarks
      Headers and Footers
      Tables
      Range Permissions
      Sections
      Styles
      Numbered and Bulleted Lists
      Shapes
      Text Boxes
      Comments
      Checkboxes
      Document Properties
   [Expand]Fields
    Text Formatting
    Import and Export
   [Expand]Page Layout
    Printing
    Spell Checking
    AutoCorrect
    Mail Merge
    Restrictions and Protection
    Syntax Highlighting
   [Expand]Visual Elements
    Services
    Events
    Commands
    Keyboard Shortcuts
    HTML Tag Support
   [Expand]Examples
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Document Properties

RichEditControl allows you to provide a document with additional information about its author, title, editor, etc. These details are represented by document properties - metadata stored with the document.
Standard ECMA-376 (Edition 1) divides document properties into three categories: Core, Extended, and Custom. Rich Text Editor recognizes Core properties as the document's built-in properties, and both Extended and Custom properties - as custom properties. Document metadata is accessible both in code and in the User Interface.

Expanded Built-In Properties

Built-in document properties are represented by the DocumentProperties instance. To set these attributes, use the following API.

Member Description
SubDocument.BeginUpdate Enables document modification.
Document.DocumentProperties Provides access to the collection of document properties.
SubDocument.EndUpdate Finishes document update.

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E5219.

This code snippet demonstrates how to set standard document properties and show them in a document using specific fields. Calling the FieldCollection.Update updates all property fields in the document body.

Note

If the DOCPROPERTY fields are located in the text box, header or footer, they should be updated separately. Use the Section.BeginUpdateHeader - Section.EndUpdateHeader or Section.BeginUpdateFooter - Section.EndUpdateFooter paired methods to obtain the header or footer. The TextBox.Document property allows you to retrieve the text box content and update the corresponding fields.

Expanded Custom Properties

Custom properties in the RichEditControl document are represented by the DocumentCustomProperties instance. The API from the table below allows you to set custom properties for your document.

Member Description
SubDocument.BeginUpdate Enables document modification.
Document.CustomProperties Provides access to the collection of custom document properties.
DocumentCustomProperties.Add Adds a new custom property with a given name and value to the document collection.
DocumentCustomProperties.Item Sets a value of a custom property. If the property with the specified name does not exist, RichEditControl creates it automatically.
SubDocument.EndUpdate Finishes the document update.

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E5219.

The following code illustrates how to create custom document properties and place them in the document's storage. The DOCPROPERTY field is used to display property values in the document. Calling the FieldCollection.Update updates all property fields in the document body.

Note

If the DOCPROPERTY fields are located in the text box, header or footer, they should be updated separately. Use the Section.BeginUpdateHeader - Section.EndUpdateHeader or Section.BeginUpdateFooter - Section.EndUpdateFooter paired methods to obtain the header or footer. The TextBox.Document property allows you to retrieve the text box content and update the corresponding fields.


Tip

To set what document properties are going to be exported, use the DocumentExporterOptions.ExportedDocumentProperties property.

Expanded Document Properties in the User Interface

End-users can specify both built-in and custom properties using the Document Properties Dialog (invoked from the File ribbon tab). To learn how to provide the application with the Ribbon UI, refer to the How to: Create a Simple Word Processor with a Ribbon UI topic.

The Statistics dialog tab displays document properties that are updated automatically. You can specify the RichEditBehaviorOptions.DocumentPropertiesAutoUpdate property to control these properties' update.

To display document properties in the document, use special fields, the DOCPROPERTY field or a combination of the DOCVARIABLE field and the RichEditControl.CalculateDocumentVariable event handler.

Expanded See Also

Is this topic helpful?​​​​​​​