flowdocument

How to write async background workers that work on WPF flowdocument

I'm trying to write a background worker that processes a flowdocument. I can't access the properties of flowdocument objects because of the thread verification. I tried to serialize the document and loaded it on the worker thread which actually solved the thread verfication issue. However, once the processing is complete I also need t...

Prevent repagination of flowdocument in FlowDocumentPageViewer

I am implementing search highlighting in a FlowDocumentPageViewer by setting the background property of selected TextRanges to yellow. Unfortunately, the viewer repaginates the entire document when the properties are changed. If you happen to be on a page towards the end of a long document, the viewer is blank for a number of seconds un...

How Can I Get a TextPointer from a mouse click in a FlowDocument

I would like to get the word that a user has clicked on in a FlowDocument. I am currently adding an event handler to every Run in the document and iterating through the TextPointers in the Run that was clicked, calling GetCharacterRect() on each one and checking if the rectangle contains the point. However, when the click occurs near t...

Defining where on the page the flowdocument I am printing will 'start' and 'end'

Dear community. I am almost done with implementing a printing functionality, but I am having trouble getting the last hurdle done with. My problem is, that I am printing some reports, consisting of a header (with information about the person the report is about), a footer (with a page number) and the content in the middle, which is a F...

Anyway to load RDL report content into a WPF FlowDocument or similar?

I would like to know if someone have created a RDL report (running it in Reporting Services), and loaded it into a WPF component like FlowDocument. Since RDL is just a XML, perhaps there's a way to parse the result and avoid using this WindowsFormsHost in order to use the Report viewer control. Would be really nice to have another cont...

Implementing footnotes in a WPF FlowDocument

What would be the best approach to display footnotes for FlowDocument content in a FlowDocumentPageViewer? My first thought was to have the contents of the footnote follow immediately after the footnote anchor within the FlowDocument, with the footnote content formatted as a Figure with VerticalAnchor set to PageBottom. This works grea...

Lists with MarkerStyle = Disc in a WPF-FlowDocument

Hi I'm trying to display a fiew lists in a FlowDocument. I Realized that when using MarkerStyle = TextMarkerStyle.Disc, the list gets less indentation then with the others. Im looking for a way to display lists with Disc-Markers but the same indentation as the other markers get, any hints? Heres a snippet that shows my problem : ...

What are my options for document layout in WPF?

Using WPF's FlowDocument, I have run in to a number of situations where I need more control over the layout of the document, from simple things (page headers and footers) to more complex (footnotes, magazine style story flow) to even more complex (literary texts with critical apparatus - one of my actual requirements). However, as far a...

How to create an outline view of a FlowDocument

I am working with a FlowDocument in a RichTextBox and I need to find a way of displaying the block hierarchy. I envisage using something like the WPF GroupBox whereby each block element is assigned a border and a non-editable identifying label. The borders will clearly show which block elements are contained within other elements and the...

How do I convert text to hyperlink in a WPF RichTextBox FlowDocument?

Hi. I'm trying to turn some text to Hyperlink while a user is typing in WPF RichTextBox. My first attempt at it involves running this code at each KeyUp: Regex r = new Regex("[A-Z]{3}"); FlowDocument doc = this.inputBox.Document; String text = new TextRange(doc.ContentStart, doc.ContentEnd).Text; foreach (Match m in r.Mat...

FlowDocument inside Window / Grid?

Hello, I need to host a FlowDocument inside a Window / Grid or in other words I don't want the Flowdocument to be the root element. Can somebody please help me how this can be done? I only found informations on how to host UIElements inside a FlowDocument, but not how to place the FlowDocument inside something else. Thanks for any hint!...

Displaying a Multi-Paged FlowDocument with repeating Headers

Hi, i am trying to add Headers / footers to a WPF FlowDocument. I Found a solution on the Internet here that is using a custom Paginator Class to do this. Unfortunately this only works when printing out the Document, which is not what I intend to do. My Idea was to use a FlowDocumentPageReader or something similar with a custom paginato...

How to set the Table.Columns of a FlowDocument in a style

Hi I have multiple FlowDocuments, all of them have a table. All tables look the same. So I want to refactor the FlowDocuments. My initial document looks like: <FlowDocument xmlns=...> <Table> <Table.Columns> <TableColumn Width="12*" /> <TableColumn Width="1.5*" /> <TableColumn Width="2*" /> <TableColum...

Inserting columns into a Table

Hello, I have a table with 3 columns. Now I want to insert another column, but I want to insert the new column after the first one. Now I'm wondering how this can be done. If I'm not wrong, the Table.Columns property isn't really representing columns, it's more representing their layout but has nothing to do with the values of the colum...

WPF Table: Disable editing of a specific cell?

Hello, given a Table with some TableCells (containing a Paragraph) in a rich text box, how can I disable editing of a specific cell? Please Note, that I don't want to disable editing of the whole table / rich text box. Thanks for any hint! ...

Lightly styled text library for WPF?

Does anyone know of a lightly-marked-up-text to styled-text formatting library (ie. something like Markdown# or Textile.NET), but which produces a native XAML document (or rather, a FlowDocument model or similar that can be displayed directly in a WPF app), to avoid the use of a WebBrowser? Bonus points for something lightweight. I'm h...

converting docx files to WPF flow documents

Hello, I have a word document with a few pictures and many lines of text (with headings) in it and want to convert this document to a flow document. So I can open it easily in my wpf application and use a rich text box to make it editable... I found this article useful. But I have some problems with adding images (Form the docx file) t...

Line breaks and indenting for the XAML of a saved FlowDocument?

Is there a way to format the XAML that is generated when a FlowDocument is saved? Currently, it is all run together on one line, and I'd like to break it up into its elements, with line breaks and indenting, to make it a little easier to read. Here is the code I am using to save a FlowDocument from a WPF RichTextBox as a XAML file: // ...

WPF: Table inside FlowDocument truncates right-most columns, why?

I have a Table with 4 columns inside a FlowDocument. I've set the width of the columns but when viewed in FlowDocumentReader, when in Page Mode or 2 Page Mode, the right most column is truncated. <FlowDocument > <Table BorderBrush="Black" BorderThickness="1"> <Table.Columns> <TableColumn Background="Red" Width="120" /> ...

Insert a Hyperlink at a specified position in a WPF FlowDocument

I'd like to insert a WPF Hyperlink element into a FlowDocument programmatically. The objective is to create a toolbar button that would take a run of text within a RichTextBox and replace it with a Hyperlink. It's the same sort of interface you see on the web for creating hyperlinks on wikis or in blogs (or on StackOverflow). I can fi...