An Introduction to the Rich Edit Control API
- 2 minutes to read
This topic presents a brief outline of the Rich Edit control’s public API.
A comprehensive API exposed via the control’s Document property complements the TdxRichEditControl component’s extensive focus on end-user capabilities. The API has a hierarchical structure corresponding to a document’s internal representation comprised of:
The document level;
The subdocument level;
The level of individual paragraphs and objects, such as inline images, tables, document fields, bookmarks, etc.
The document level corresponds to the main document body divided into sections, including subdocuments:
The Rich Edit control’s Document property represents the document API level and provides access to:
The basic document-related functionality, including the clipboard (Copy, Cut, and Paste), import/export (LoadDocument and SaveDocument), content protection/file encryption (Protect, Unprotect, and SetEncryptionPassword), and mail merge (MailMerge) operations;
The collections of document sections with individual page settings (Sections), active selections (Selections), and styles (CharacterStyles, ParagraphStyles, and TableStyles);
The control’s default formatting applied to all newly created documents (DefaultCharacterProperties and DefaultParagraphProperties);
All the subdocument functionality, including text editing and formatting, since the IdxRichEditDocument interface exposed by the Document property, is derived from IdxRichEditSubDocument.
The subdocument level corresponds to individual subdocuments, that is:
- The headers and footers are returned by the document section’s BeginUpdateHeader and BeginUpdateFooter functions, respectively.
- The subdocument displayed by a floating text box, can be accessed by the IdxRichEditTextBox.Document property. A text box, in turn, can be accessed via a shape‘s TextBox property.
All subdocuments are fully functional documents allowing you to insert, edit, format, and delete text, manage tables, hyperlinks, bookmarks, etc. However, unlike headers and footers, text boxes are unable to host floating objects (for example, shapes), including other text boxes.
The common subdocument functionality includes:
The paragraph management and customization (AppendParagraph, InsertParagraph, Paragraphs, BeginUpdateParagraphs, EndUpdateParagraphs, AddParagraphToList, AddParagraphsToList, RemoveNumberingFromParagraph, and RemoveNumberingFromParagraphs);
The capability to work with bookmarks (CreateBookmark, Bookmarks, and RemoveBookmark);
Formatted and unformatted text editing (AppendText, InsertText, AppendRtfText, InsertRtfText, Delete);
Applying different formatting to arbitrary text snippets (BeginUpdateCharacters and EndUpdateCharacters);
Hyperlink management (CreateHyperlink, Hyperlinks, and RemoveHyperlink);
Table management (InsertTable and Tables, and Delete);
Inline picture management (AppendImage, InsertImage, Images, and Delete).