Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

How to Add New Text

This topic explains how to add new text to the document programmatically.

You can insert and append both RTF-formatted and unformatted text to the main document body, headers, footers, and text boxes via the Rich Edit control’s public API. Refer to the following code example:

Delphi
var
  ADocument: IdxRichEditDocument;
begin
  ADocument := dxRichEditControl1.Document;
  ADocument.BeginUpdate;  // You can include multipe append and/or insert text operations between the BeginUpdate and EndUpdate procedure calls
  ADocument.AppendText('The quick brown fox jumps over the lazy dog.');
  ADocument.EndUpdate;
end;

To append an RTF-formatted string and apply the document formatting to it, call the AppendRtfText function instead of AppendText. As in the previous case, you can pass the returned document range as a subdocument’s BeginUpdateCharacter function argument to modify character properties as required.