public void RemoveHiddenContentFromDocument()
{
// Open the document we want to remove hidden content from.
Document doc = new Document(MyDir + "Font.Hidden.doc");
// Create an object that inherits from the DocumentVisitor class.
RemoveHiddenContentVisitor hiddenContentRemover = new RemoveHiddenContentVisitor();
// 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).
// We can run it over the entire the document like so:
doc.Accept(hiddenContentRemover);
// Or we can run it on only a specific node.
Paragraph para = (Paragraph)doc.GetChild(NodeType.Paragraph, 4, true);
para.Accept(hiddenContentRemover);
// Or over a different type of node like below.
Table table = (Table)doc.GetChild(NodeType.Table, 0, true);
table.Accept(hiddenContentRemover);
doc.Save(MyDir + @"\Artifacts\Font.Hidden.doc");
Assert.AreEqual(13, doc.GetChildNodes(NodeType.Paragraph, true).Count); //ExSkip
Assert.AreEqual(1, doc.GetChildNodes(NodeType.Table, true).Count); //ExSkip
}