Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF: Best method for printing paginated datagrids

Boy did I get an education looking into this. I guess I've been spoiled by Powerbuilder, which has fantastic functionality for this out of the box.

Does anyone seriously write custom documentpaginator objects to handle reporting needs for their LOB apps? I want to be able to print "for free" and not have to code like crazy just to take whats on the screen and throw it on paper.

How are people doing this? Does anyone have a recommended 3rd party for allowing printing of largish datagrids?

Thanks

like image 932
FauxReal Avatar asked Jun 09 '10 20:06

FauxReal


1 Answers

Paginating datagrids is a huge, huge pain. Simply drawing the grid on a page will not work as you have to handle things like fixed layout, expanding cells horizontally and vertically to show all data, word wrapping, splitting columns and rows into the page margin, splitting cells that overflow a page into multiple pages. Remember you can't scroll or resize a control on a piece of paper. Even if you find a magic control that can do all that, a grid with borders, shadows, and backgrounds that look good on a screen won't look good on paper.

For an old WinForms app that printed datagrids we implemented a completely separate report API for printouts. We printed the underlying ADO.Net dataSource using the free ReportViewer control. A tutorial is at gotreportviewer.com.

like image 190
Dour High Arch Avatar answered Sep 19 '22 13:09

Dour High Arch