How to: Manipulate a FlowDocument through the Blocks Property
.NET Framework (current version)
These examples demonstrate some of the more common operations that can be performed on a FlowDocument through the Blocks property.
Dim flowDoc As New FlowDocument(New Paragraph(New Run("A bit of text content...")))
flowDoc.Blocks.Add(New Paragraph(New Run("Text to append...")))
The following example creates a new Paragraph element and inserts it at the beginning of the FlowDocument.
Dim p As New Paragraph(New Run("Text to insert..."))
The following example gets the number of top-level Block elements contained in the FlowDocument.
Dim countTopLevelBlocks As Integer = flowDoc.Blocks.Count
The following example clears all of the contents (Block elements) from the FlowDocument.