Click here to Skip to main content
15,887,350 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hello , I'm using the library DGVprinter to print a datagridview , is there a way that I can print different rows on seperate pages depending on the value of the cell ? for example I have a column of code in the first column of datagridview( this code can be repeated several times ) , in the printer I want each page contains the rows that have the same code , is it possible with that library ? if not , what is the alternative to achieve this ?

What I have tried:

I tried to search for other library but none have solution
Posted
Updated 22-Jun-20 21:02pm
Comments
Maciej Los 23-Jun-20 3:33am    
What if the number of rows with specific code won't fit into single page?
Member 14190053 23-Jun-20 21:47pm    
in my case the rows of the same code won't be a lot so they will fit in single page , you have a solution?
Maciej Los 23-Jun-20 21:28pm    
Please, read OG's answer to find out how to achieve that.

1 solution

You probably aren't going to find an "off the shelf" solution - it's not a "normal" requirement.
You could either modify the library - if the source is available, I've never heard of it, and don't know where you go it - or roll your own software using the PrintDocument class[^]

Generally, you don't print DataGridView or any other controls - you print the DataSource of that control: the DataTable or Collection that provides it with data.
 
Share this answer
 
Comments
Member 14190053 23-Jun-20 21:50pm    
I tried with the printdocument but it didn't work out as I wanted
OriginalGriff 23-Jun-20 21:06pm    
Then you did it wrong: you can print anything - exactly how you want it - with PrintDocument, provided you do it properly.

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