Document Model

A document model defines the logical structure of a document. Use the document property to access the information about the model.

Document Structure

Document content is divided into parts, or sub-documents, available using the subDocuments property.

RichEdit - Document Model

The RichEdit control supports the following sub-document types:

  • Main. Every document contains one “main” sub-document (see the main property).
//return the main sub-document
  • Header and Footer. A document can contain multiple headers and footers: different variants for odd/even pages, a specific version for the first page, etc. To obtain a section’s header or footer, call the getHeader or getFooter methods respectively.
var section = richEdit.document.sections.getByIndex(0);
var subDocument = section.getHeader(DevExpress.RichEdit.HeaderFooterType.Primary, true);
  • TextBox. Each text box is represented by an individual sub-document that can be placed in other sub-documents.

Structural Elements

The document model includes information about every sub-document’s structural element. Use the following properties to access element collections.

Elements Property Example
Bookmarks bookmarks richEdit.document.bookmarks.find("bookmarkName")[0].goTo();
Fields fields richEdit.document.fields.updateAllFields();
Hyperlinks hyperlinks richEdit.document.hyperlinks.create(hlPosition, {text: "Visit our site", url: ""});
Paragraphs paragraphs richEdit.document.paragraphs.create(richEdit.document.length - 1);
Tables tables richEdit.document.tables.create(tblPosition, 2, 3);
See Also