Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[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]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
   [Expand]Getting Started
   [Collapse]RichEditControl Document
    [Collapse]Document Structure
      Document Model
      Document Layout
    [Expand]Document Elements
   [Expand]Fields
    Text Formatting
    Import and Export
   [Expand]Page Layout
    Printing
    Spell Checking
    AutoCorrect
    Mail Merge
    Restrictions and Protection
    Syntax Highlighting
    Traversing the Document
   [Expand]Visual Elements
    Services
    Events
    Commands
   [Expand]Member Tables
    Keyboard Shortcuts
    HTML Tag Interpretation
   [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]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]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Document Model

A document model defines the logical structure of a document reflecting its logical organization and hierarchically groups the logical entities in a document. It is illustrated in the following diagram.

The root of the document model is the object exposing the SubDocument interface. It delivers the basic document functionality that is common for the main document body, header and footer. Specific functionality belongs to its descendant, the Document interface. Use the RichEditControl.Document property to get access to the Document interface.

The document is divided into logical Document.Sections. Each section in a SectionCollection defines its own page settings, such as paper size, page orientation and margins. The SectionPage.PaperKind, SectionPage.Landscape, Section.Page and Section.Margins properties enable you to access these settings.

To insert a section into an arbitrary position, use the Document.InsertSection method.

The section consists of paragraphs. The Paragraph class represents the paragraph entity in the document model. The Section.Paragraphs property of a section gives you a collection of paragraphs in a particular section of a document. If you need to access the collection of paragraphs in a whole document, use the SubDocument.Paragraphs property.

To modify paragraph formatting, you can use either the Paragraph object or the ParagraphProperties interface. The interface is more convenient to use, since it can be easily accessed for a particular document range via the SubDocument.BeginUpdateParagraphs method. Do not forget to call the SubDocument.EndUpdateParagraphs method to finish the modification appropriately.

To insert a paragraph at an arbitrary position, use the ParagraphCollection.Insert method.

The paragraph consists of runs - groups of characters with a uniform format. This is an internal entity, not available via API. Manage the Positions and Ranges instead.

Note

For the specified DocumentPosition, use the SubDocument.GetParagraph method to get an encompassing Paragraph, use the Document.GetSection to get an encompassing Section.

The document model also includes entities that do not comprise the hierarchy, such as lists, styles, tables,inline pictures, floating objects (pictures and text boxes), bookmarks, hyperlinks and comments.

Object

Description

Collection containing an object:

Notation:

Exposed By

Lists

Represented by a specific collection of paragraphs. This collection is composed of items with a NumberingList interface. Each item is an instance of a certain abstract numbering definition, which is represented by an AbstractNumberingList interface.

NumberingListCollection

AbstractNumberingListCollection

richEditControl.Document.NumberingLists

Document.AbstractNumberingLists

NumberingList.AbstractNumberingList

ParagraphCollection.AddParagraphsToList

ParagraphStyle

CharacterStyle

Pertains to a document and belongs to a particular document model. You cannot add the style object from a style collection of one document to the style collection of another document.

ParagraphStyleCollection

CharacterStyleCollection

richEditControl.Document.ParagraphStyles

Document.CharacterStyles

Document.ParagraphStyles

CharacterStyleCollection.CreateNew

ParagraphStyleCollection.CreateNew

Table

Specific structure based on paragraphs. To change the cell content, you should operate with a corresponding paragraph.

TableCollection

ReadOnlyTableCollection

richEditControl.Document.Tables

SubDocument.Tables

TableCollection.Create

ReadOnlyTableCollection.Get

DocumentImage

Represents the inline picture entity in the document model. Occupies the range equivalent to one character, i.e., the DocumentRange.Length of the range is equal to 1.

DocumentImageCollection

ReadOnlyDocumentImageCollection

richEditControl.Document.Images

DocumentImage.Image

DocumentImageCollection.Insert

DocumentImageCollection.Append

ReadOnlyDocumentImageCollection.Get

Shape

Represents floating object (pictures and text boxes) entities in the document model. Anchored to the position, but can be placed anywhere on the page that contains the anchor - within, above and below the main document body.

ShapeCollection

ReadOnlyShapeCollection

richEditControl.Document.Shapes

SubDocument.Shapes

Shape.TextBox

ReadOnlyShapeCollection.Get

Bookmark

Represents bookmark entity in the document model. Linked to the position, so the range can have a zero length.

BookmarkCollection

ReadOnlyBookmarkCollection

richEditControl.Document.Bookmarks

SubDocument.Bookmarks

BookmarkCollection.Create

ReadOnlyBookmarkCollection.Get

Hyperlink

Represents a hyperlink entity in the document model. Can be linked to the bookmark.

HyperlinkCollection

ReadOnlyHyperlinkCollection

richEditControl.Document.Hyperlinks

SubDocument.Hyperlinks

HyperlinkCollection.Create

ReadOnlyHyperlinkCollection.Get

Comment

Represents a comment entity in the document model. Linked to the document range. Can be nested - one comment can relate to another. In this case, only the parent comment is linked to the document range, whereas the child comment is linked to its parent.

CommentCollection

ReadOnlyCommentCollection

richEditControl.Document.Comments

SubDocument.Comments

Comment.ParentComment

ReadOnlyCommentCollection.Get

Expanded See Also

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