C#.NET Printing Text
Posted on 2010-09-23
I'm sure that this is simple but I can't find a good example so far.
I want to create a simple report which will be sent to the printer. I am currently using the UltraPrintPreviewDialog and UltraPrintDocument classes but I think that they work in a similar way to the standard .NET PrintDocument.
I click a button to create the report and have added header and footer text to the report and then use the ultraPrintPreviewDialog.ShowDialog to see the eport - all good so far.
I want however to add text to the body of the report - this will be a number of lines of straight text followed by two lists with a few columns in them.
I can't seem to find out WHERE I add the text to the report - do I trap the PageBodyPrinting and add the text there? If so how do I actually add the text to print and how do I deal with the situation where I have too much text to fit onto one page of the report?
I thought that there would be a simple AddLine function of the PrintDocument but this does not seem to be how this works.
Thanks for any suggestions/examples of creating a multi-page report.