Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating something printable in C#

Just wondering if anyone could tell me of a simple way to create files for printing? At the moment I'm just scripting HTML, but I'm wondering if there isn't some easier way of doing it that would give me more control over what it being printed? Something along the lines of an Access printout, or Excel printout - where I could decide how to lay things out and almost "Mail merge" the details in via programming.

Basically, I want to create something for print that can have tables encasing it, and could be longer or shorter for each record depending upon the number of foreign keys (e.g. one staff member could have 10 jobs today, or just 3. I want to create a document that will generate and print).

Any ideas/advice/opinions? Thank you!

EDIT: Wow, thanks for all the responses! For this particular task, FlowDocuments seems to be the closest to what I'm actually after so I'll play with that. Either way I have several really good options now.

EDIT 2: After some playing, iTextSharp has become the choice for me. For anyone wondering in the future, here is a link to a great and simple tutorial: http://www.mikesdotnetting.com/Category/20

Thanks again!

like image 414
David Archer Avatar asked Feb 26 '10 13:02

David Archer


2 Answers

I would create a PDF file which can be viewed just about anywhere and will maintain formatting. Take a look here: http://itextsharp.sourceforge.net/

like image 127
David Radcliffe Avatar answered Sep 30 '22 13:09

David Radcliffe


There's always FlowDocuments. Check out the overview at MSDN http://msdn.microsoft.com/en-us/library/aa970909.aspx and see if they match what you want to do. They're pretty easy to print and can be serialized to xaml. Might not be exactly what you're after, but they're pretty useful.

like image 41
wasatz Avatar answered Sep 30 '22 12:09

wasatz