I have a PrintDocument and its PrintPage event tied to a function that uses the Graphics object to draw to the page.
But this is very tedious. I have some company data in a settings file that I need to put on the page in a nicely formatted manner, you know, upper left is the logo, upper right is the date and then some more data in the middle...
Currently, here is how I do it:
private void handlePrintPage(object sender, PrintPageEventArgs e)
{
e.Graphics.DrawString("Foo", font, brush, new PointF(10, 10));
e.Graphics.DrawString("Bar", font, brush, new PointF(10, 30));
}
Now its not exactly like that, I have some variables like pageWidth, pageHeight that I can divide by 2 and print on the centre of the document or to the far right etc. etc.
But again, this is so tedious. Is there any better way to get data on a page for printing?
Try using Word via COM, pretty easy, no calculations required, also, just use a template and you can treat the document as some sort of array :)
This is a really good article and i have used it with Office 2010 even if its pretty old:
Hope it helps :)