Back to Devexpress

Document Model

aspnetcore-401645-rich-edit-document-model.md

latest3.0 KB
Original Source

Document Model

  • Sep 09, 2024

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.

The RichEdit control supports the following sub-document types:

  • Main. Every document contains one “main” sub-document (see the main property).
javascript
//return the main sub-document
richEdit.document.subDocuments.main;
  • 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.
javascript
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.

ElementsPropertyExample
BookmarksbookmarksrichEdit.document.bookmarks.find("bookmarkName")[0].goTo();
FieldsfieldsrichEdit.document.fields.updateAllFields();
HyperlinkshyperlinksrichEdit.document.hyperlinks.create(hlPosition, {text: "Visit our site", url: "https://www.devexpress.com/"});
ParagraphsparagraphsrichEdit.document.paragraphs.create(richEdit.document.length - 1);
TablestablesrichEdit.document.tables.create(tblPosition, 2, 3);

See Also

Examples