Reporting with XML/XSLT and printing with CSS
In a few of my Windows Forms applications that require reporting facilities I employ a typical XML/XSLT method. I emit XML from my application and then use various XSLT stylesheets to translate said XML into HTML for each required report. This works well when client deployment is decentralized with no central repository to persist data. To display the report I usually interop with shdocvw.dll and put an instance of the control in a form. This gives the client the perception, albeit superficial one, of an integral reporting facility.
There have been times when I needed to display a more verbose report during preview but a more terse report on print. To facilitate this I would employ what Martin Fowler calls a Two Step View web presentation pattern in his book Patterns of Enterprise Application Architecture by applying multiple XSLT stylesheets: one for preview, and one for print. Brad Wilson speaks of using CSS for printing which I could more succinctly employ for my Two Step View pattern as opposed to having to deal with multiple XSLT stylesheet translations.
Cool!