Questions tagged [flowdocument]

Microsoft's WPF FlowDocument technology allows to render embedded, dynamically adjusted and re-flowing document content that supports columns, pagination and search.

A flow document is designed to "reflow content" depending on window size, device resolution, and other environment variables. Flow content can be complex, consisting of various elements including text, images, tables. In addition, flow documents have a number of built in features including search, viewing modes that optimize readability, and the ability to change the size and appearance of fonts.

571 questions
41
votes
4 answers

Replace text in XamlPackage

I have some text in a RichTextBox. This text includes tags eg: [@TagName!]. I want to replace these tags with some data from a database without losing formatting (fonts, colors, image, etc). I've created a method: void…
Artur Michajluk
  • 1,899
  • 2
  • 16
  • 23
19
votes
3 answers

WPF Table Column Sizes

I'm rendering a Table in a WPF FlowDocument using code-behind. But, I've been unable to find an example that shows how to make the table use only the space needed based on content. Instead the table takes up all available width, which I don't want,…
Walt Stoneburner
  • 2,562
  • 4
  • 24
  • 37
16
votes
2 answers

How can I produce a "print preview" of a FlowDocument in a WPF application?

Various WPF applications of mine display FlowDocument's. I'm able to print them, using the approach described in the answer to Printing a WPF FlowDocument. Now I'd like to add a "print preview" capability. In the normal case, I am printing the…
Cheeso
  • 189,189
  • 101
  • 473
  • 713
15
votes
5 answers

Wavy underlines in a FlowDocument

In WPF, is there an easy way to add wavy underlines (like spelling errors in Word) to FlowDocument elements? There's the Underline class, but there seems to be no way to style it.
Tony the Pony
  • 40,327
  • 71
  • 187
  • 281
15
votes
3 answers

How to print directly, without Print Dialog in WPF?

I just want to know how I can print a flow document without showing Print Dialog in WPF. Thanks for help…
Raj
  • 3,890
  • 7
  • 52
  • 80
15
votes
3 answers

Why is this flowdocument table always printing 2 columns

I have a ListView in my WPF app that is bound to a collection of tasks to perform (A to-do list). I want the user to be able to print their list and have created the following code based on the MSDN guidelines. (This my first foray into…
Mike B
  • 2,592
  • 3
  • 33
  • 46
14
votes
2 answers

Inserting an HTML fragment into a WPF FlowDocument

I'm dynamically building a WPF FlowDocument from a datasource. One of the data elements is a fragment of HTML - I need to figure out a way to parse that and insert it into my FlowDocument. I've found HTMLToXAMLConverter which will return a XAML…
Jason
  • 86,222
  • 15
  • 131
  • 146
14
votes
3 answers

How can I get a FlowDocument Hyperlink to launch browser and go to URL in a WPF app?

The following code in a WPF app creates a hyperlink that looks and acts like a hyperlink, but doesn't do anything when clicked. What do I have to change so that when I click it, it opens the default browser and goes to the specified URL? alt text…
Edward Tanguay
  • 189,012
  • 314
  • 712
  • 1,047
13
votes
1 answer

WPF - Auto Line Number for FlowDocument?

I'm just starting on a contract generation routine for my current project and one of the requirements is that each of the lines in the contract must be numbered. The number should be located in the left margin with a vertical rule separating the…
Sonny Boy
  • 7,848
  • 18
  • 76
  • 104
13
votes
2 answers

WPF Printing - Set the Printer Automataically on WPF PrintDialog

I am trying to print a WPF FlowDocument to a particular printer, without prompting the user. The printer is a PDF converter. This works great except that it prints to the default printer: PrintDialog pd = new PrintDialog(); var doc =…
BrokeMyLegBiking
  • 5,898
  • 14
  • 51
  • 66
12
votes
5 answers

Detect if a RichTextBox is empty

What is the best way to detect if a WPF RichTextBox/FlowDocument is empty? The following works if only text is present in the document. Not if it contains UIElement's new TextRange(Document.ContentStart, Document.ContentEnd).IsEmpty
Benoit Dion
  • 163
  • 1
  • 2
  • 9
12
votes
1 answer

Convert FlowDocument to simple text

what is the most simple and elegant way how convert flowdocument to simple text?
user481758
12
votes
3 answers

TableCell split after page break : remainder split part loses original cell properties

I have an issue regarding a TableCell splitting strategy on WPF FlowDocument Table. Here is a simple code allowing to reproduce the issue : MainWindow.xaml.cs /// /// Interaction logic for MainWindow.xaml /// public partial…
Sisyphe
  • 4,626
  • 1
  • 25
  • 39
12
votes
4 answers

How can I hide a Paragraph in a FlowDocument?

Is there any way to use databinding to show or hide a Paragraph within a FlowDocument? (I want to use MVVM, but with a FlowDocument as my view.) Paragraph doesn't have a Visibility property. I'm not sure what else to look for.
Joe White
  • 94,807
  • 60
  • 220
  • 330
11
votes
7 answers

What's the best way to convert a FlowDocument into PDF

How would ya'll recommend that I convert a FlowDocument to PDF to be attached to an EMail? The FlowDocument is dynamic, not static. I would prefer to be able to store the PDF in memory as a byte[], rather than on disk, but that is negotiable. Thanks…
Joe
  • 669
  • 1
  • 8
  • 21
1
2 3
37 38