Advanced Printing with WPF
Internal mail that may help developers; read from bottom:
From: Other Ms Employee
You can refer to http://msdn2.microsoft.com/en-us/library/ms749165.aspx, this explains the two types of documents that you may use, FlowDocument or FixedPage. FlowDocument object supports automatic pagination. You could use DataTemplates that are bound to your dataset to display your data in XAML and the right “selection” of controls (StackPanel, Table, WrapPanel, …) to have this paginated on several pages. But:
· Header or Footer on each page are not automatically inserted
· A repeating row header on each page does not come out-of-the-box
What I did was generating XAML (you could do this using your XSLT transformation) and then serializing the XAML to XPS. During this process I added a header and footer (you also have the page count), so the output was an XPS document.
Feng Yuan has posted a sample of a custom paginator when serializing XAML to XPS at http://blogs.msdn.com/fyuan/archive/2007/03/10/convert-xaml-flow-document-to-xps-with-style-multiple-page-page-size-header-margin.aspx .
We are using Blend to design the forms, make sure to put the FlowDocument object into a Window object at design time, otherwise the FlowDocument will not render and later on just take out the FlowDocument node.
From: Ms Employee
I’ve built an offline reporting solution using XML serialized DataSets and XSLT. My solution is able to print either portrait or landscape automatically using an ActiveX plugin, and I am also able to control page breaks and know how many pages the report it (and display it on each page).
Can I use a WPF Browser Application to improve on this. Since one of my requirements is that they be able to just send a new XSLT (or XAML), it seems like a good fit. However, I haven’t seen a lot of documentation around getting the control that I am getting from XSLT.
Can anyone point to some good docs or examples around spiking a solution to what I am doing today? I’m not worried about databinding, just having a repeatable section, controlling page breaks, and knowing how many pages are going to be printed.