This is a migrated thread and some comments may be shown as answers.

RadPrintDocument / Print / PrintPreview

6 Answers 156 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Philip
Top achievements
Rank 1
Philip asked on 08 Mar 2016, 04:00 PM

Is it possible to start each "grouping" of data on a new page when printing?

 

I can see simple properties for printing headers at the top of each page, printing the "grouping" column but nothing stands out to perform a page break for each grouping (in my case days of the week).

6 Answers, 1 is accepted

Sort by
0
Accepted
Hristo
Telerik team
answered on 09 Mar 2016, 03:47 PM
Hello Phil,

Thank you for writing.

With the current implementation, the printing engine in RadGridView lacks this type of functionality. However, I managed to prepare a sample implementation with which you could achieve the desired result.

Basically, you would need to create a custom GridPrintStyle in order to properly calculate the number of pages. The new class will work together with a custom print renderer responsible for the actual drawing of the page. Please find attached my sample project as well a short video showing the result on my end.

I hope this helps. Please let me know if you need further assistance.

Regards,
Hristo Merdjanov
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Philip
Top achievements
Rank 1
answered on 09 Mar 2016, 04:21 PM
Absolutely great - many thanks :-)
0
Jeff
Top achievements
Rank 1
answered on 10 Mar 2016, 12:07 PM

I have been looking for this exact feature, however it doesn't seem to be functioning properly. I get the 5 pages, but everything is on the first page. I have 5 groups with 3 items. Any ideas on how to debug this?

 

Thanks,

Jeff

0
Philip
Top achievements
Rank 1
answered on 11 Mar 2016, 03:25 PM

Hi Jeff

What type is your grid view definition?  The code was for a TableViewDefinition. Is yours a ColumnsViewGroupDefinition?

Put a breakpoint in InitializePrintRenderer() to see.

If that is the case could Hristo supply a sample ColumnGroupsViewDefinitionPrintRenderer that does something similar?

Cheers

Phil

0
Philip
Top achievements
Rank 1
answered on 13 Mar 2016, 04:52 PM

Jeff

Alternatively if the view definition is a TableViewDefinition, yet the first page could fit multiple groups on it then try changing the following line:

                if ((traverser.Current is GridViewGroupRowInfo) && pageNumber > 1 && !firstRow)

to 

                if ((traverser.Current is GridViewGroupRowInfo) && pageNumber >= 1 && !firstRow)

Cheers

Phil

0
Hristo
Telerik team
answered on 14 Mar 2016, 12:26 PM
Hi guys,

Thank you for writing.

Jeff, could you please let us know in more details about your local setup and in what particular scenario you are experiencing difficulties?

Looking forward to your reply.

Regards,
Hristo Merdjanov
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
GridView
Asked by
Philip
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Philip
Top achievements
Rank 1
Jeff
Top achievements
Rank 1
Share this question
or