The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

DocumentIterator Class

Iterates over document elements.

Namespace: DevExpress.XtraRichEdit.API.Native

Assembly: DevExpress.RichEdit.v19.1.Core.dll


public class DocumentIterator : IEnumerator<IDocumentElement>, IDisposable, IEnumerator
Public Class DocumentIterator
    Implements IEnumerator(Of IDocumentElement), IDisposable, IEnumerator
public class DocumentIterator : IEnumerator<IDocumentElement>, IEnumerator, IDisposable
Public Class DocumentIterator
    Implements IEnumerator(Of IDocumentElement), IEnumerator, IDisposable


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())
memoEdit1.Text = visitor.Text;


See Also