public static void Run()
{
// ExStart:ExtractContentUsingDocumentVisitor
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_WorkingWithDocument();
// Open the document we want to convert.
Document doc = new Document(dataDir + "Visitor.ToText.doc");
// Create an object that inherits from the DocumentVisitor class.
MyDocToTxtWriter myConverter = new MyDocToTxtWriter();
// This is the well known Visitor pattern. Get the model to accept a visitor.
// The model will iterate through itself by calling the corresponding methods
// On the visitor object (this is called visiting).
//
// Note that every node in the object model has the Accept method so the visiting
// Can be executed not only for the whole document, but for any node in the document.
doc.Accept(myConverter);
// Once the visiting is complete, we can retrieve the result of the operation,
// That in this example, has accumulated in the visitor.
Console.WriteLine(myConverter.GetText());
// ExEnd:ExtractContentUsingDocumentVisitor
}
// ExStart:MyDocToTxtWriter