Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you erase all content of a flowdocument

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?

like image 699
Jack Avatar asked Jun 08 '12 14:06

Jack


1 Answers

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).

like image 153
Bradley Grainger Avatar answered Sep 17 '22 15:09

Bradley Grainger