Click here to Skip to main content
15,892,737 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi,
I am using C# print method (e.Graphics.Drawstring) to print a report. There is a while loop in which each row is printed. In case there is more than 100 rows I should print 25 rows in each page with the same header columns in each page. Please help me if any have a sample code for this.

Thank you in advance.
Posted
Comments
Kornfeld Eliyahu Peter 6-Jul-15 3:13am    
We may help you if show us your code...
Richard MacCutchan 6-Jul-15 3:56am    
Are you saying that you do not know how to code a loop that breaks after each 25 iterations?
Daniel Pfeffer 6-Jul-15 4:12am    
Look at http://www.codeproject.com/Questions/68575/How-to-print-more-pages-in-C-printdocument. It should give you some ideas...

1 solution

I suggest you look at the article: An absolute beginner's guide to printing in .NET[^]

What you need to do is not put your page break in a loop but rather code your
_PrintPage
handler to print 25 rows and then to set e.HasMorePages to true if there are any more rows left to print.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900