I have created a flowdocument and added numerous paragraphs to it programmically. Now in the I would like to be able to reset the flow document to a blank slate resulting in everything being erased.
I have looked for things like Clear, Reset, RemoveAll, Erase. Is there a method to emptying the document?
Clear the Blocks
collection of the FlowDocument
:
document.Blocks.Clear();
The How to: Manipulate a FlowDocument through the Blocks Property includes this example, as well as other common operations (such as inserting a new paragraph at the beginning, or deleting the last block element).