DocumentVisitorBase Class
A base class implementing the IDocumentVisitor interface.
Namespace: DevExpress.XtraRichEdit.API.Native
Assembly: DevExpress.RichEdit.v20.2.Core.dll
Declaration
Remarks
Use the DocumentVisitorBase instead of your custom implementation to keep up with the actual state of the IDocumentVisitor interface in the event of possible modifications in the future.
Example
MyVisitor is a DocumentVisitorBase class descendant which provides a method that processes DocumentText elements to do the following.
- Enclose the bold text in asterisks
- Return all characters without formatting
- Replace the paragraph ends with newline symbols
Other document elements are skipped.
public class MyVisitor : DocumentVisitorBase
{
readonly StringBuilder buffer;
public MyVisitor() { this.buffer = new StringBuilder(); }
protected StringBuilder Buffer { get { return buffer; } }
public string Text { get { return Buffer.ToString(); } }
public override void Visit(DocumentText text) {
string prefix = (text.TextProperties.FontBold) ? "**" : "";
Buffer.Append(prefix);
Buffer.Append(text.Text);
Buffer.Append(prefix);
}
public override void Visit(DocumentParagraphEnd paragraphEnd) {
Buffer.AppendLine();
}
}
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the DocumentVisitorBase class.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.