DocumentIterator Class
Iterates over document elements.
Namespace: DevExpress.XtraRichEdit.API.Native
Assembly: DevExpress.RichEdit.v21.2.Core.dll
Declaration
Remarks
The DocumentIterator object enables you to iterate over document elements in a specified document range. To accomplish this, create a new DocumentIterator instance and call its DocumentIterator.MoveNext method until it returns false. For each step, the current document element is obtained with the DocumentIterator.Current property.
This example creates a DocumentIterator instance for the current document and calls its DocumentIterator.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 IDocumentElement.Accept method with the MyVisitor object instance as a parameter. MyVisitor object implements the IDocumentVisitor interface and overrides its IDocumentVisitor.Visit methods to perform required actions when an iterator encounters a certain document element ( an instance of the class inherited form the DocumentElementBase class).
MyVisitor visitor = new MyVisitor();
DocumentIterator iterator = new DocumentIterator(richEditControl1.Document, true);
while (iterator.MoveNext())
iterator.Current.Accept(visitor);
memoEdit1.Text = visitor.Text;
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the DocumentIterator 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.