I've got a FlowDocument and assigned a name to one paragraph.
I want to edit the content of a paragraph (which is just one ordinary string btw.).
How to do this?
Figure and Floater are used to embed content in Flow Documents with placement properties that can be customized independent of the primary content flow.
Flow documents are designed to optimize viewing and readability. Rather than being set to one predefined layout, flow documents dynamically adjust and reflow their content based on run-time variables such as window size, device resolution, and optional user preferences.
If you want to center each line, use a TextBlock instead, and set TextAlignment="Center" .
To change the text of an existing paragraph can be done this way. (Individual formattings of the paragraph get lost!)
// myParagraph is the paragraph with the old text
while (myParagraph.Inlines.Count > 0)
myParagraph.Inlines.Remove(myParagraph.Inlines.ElementAt(0));
myParagraph.Inlines.Add(new Run("new text"));
var paragraph = new Paragraph();
paragraph.Inlines.Add(new Run(yourString));
flowDocument.Blocks.Add(paragraph);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With