DocumentVisitorBase Class
A base class implementing the IDocumentVisitor interface.
Namespace: DevExpress.XtraRichEdit.API.Native
Assembly: DevExpress.RichEdit.v24.1.Core.dll
NuGet Packages: DevExpress.RichEdit.Core, DevExpress.Win.Navigation
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();
}
}
Implements
Inheritance
Object
DocumentVisitorBase
See Also