Skip to content

Create a DocumentIterator instance to iterate over document content and change formatting.

License

Notifications You must be signed in to change notification settings

DevExpress-Examples/wpf-richedit-use-document-iterator-and-visitor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rich Text Editor for WPF - How to Use the Document Iterator and Visitor to Iterate Over Document Elements

Implementation Details

This example creates a DocumentIterator instance for the current document and calls its MoveNext method to iterate over document elements. A Visitor pattern is implemented to process a document element. The implementation is done by calling each element's Accept method with the MyVisitor object instance as a parameter. MyVisitor is a custom class that descends from the DocumentVisitorBase class. MyVisitor class contains a method that processes DocumentText elements to enclose Bold text in asterisks and return all characters without formatting. Paragraph ends are replaced with newline symbols, other document elements are skipped.

You can customize the MyVisitor class to perform any operation with any type of element that the DocumentIterator encounters.

Files to Review

More Examples

Documentation

About

Create a DocumentIterator instance to iterate over document content and change formatting.

Topics

Resources

License

Stars

Watchers

Forks