>Anyone written any reports in WPF yet?
>
>It's a bit weird, FlowDocuments take block elements like paragraphs and tables. But don't offer much in the way of "real" pagination capabilities and fixed layout.
>
>Fixed documents don't use block elements. they use UIElements, so no paragraphs/tables etc. The layout can be pretty fixed but in order to get sizes for layout you have to do:
>
fixedPage.Measure(sz);
>fixedPage.Arrange(new Rect(new Point(), sz));
>fixedPage.UpdateLayout();
>
every time you wan to get your size information. (I'm worried it may be slow.)
>
>After about 50 false starts figuring out various ways to do this. I'm creating a fixed XPS document using grids and textblocks.
>
>Was curious if anyone else had tried writing reports in WPF and if they had any luck with it?
It's a bit lonely here in the WPF section. I'm talking to myself again. <g>
Just wanted to update this for anyone in the future trying to write WPF reports . I could not find any good references on how to do it. I did find a lot of references that say it's way to hard and you should not try this at home. But the technique I came up with is working very well so far and does not appear to have a significant downside to it, so I thought I would share.
The basic layout is this:
FixedDocument
PageContent
FixedPage
Canvas
Grid <- Body Grid
Border <- Cell
TextBox <-Text
I do the update layout calls above after each row is added to the grid and then I check the BodyGrid.ActualHeight to see if it's time for a new page.
When I'm done I have a text based XPS document that I can view or print.
HTH someone in the future.