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

print only one row with its hierarchy

1 Answer 38 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Andre
Top achievements
Rank 1
Andre asked on 21 Feb 2019, 01:27 PM
how can i print only the currently selected line including its hierarchy ?
so not all lines of the grid dgvOrder but only a certain one !

my code
            GridPrintStyle style = new GridPrintStyle {
                PrintHierarchy = true
            };

            this.dgvOrder.PrintStyle = style;
            RadPrintDocument document = new RadPrintDocument {
                HeaderHeight = 50,
                HeaderFont = new Font("Arial", 16),
                Logo = Image.FromFile(@"Logo.png"),
                LeftHeader = "[Logo]",
                MiddleHeader = "",
                RightHeader = $"{Param.PrintProtocol.Order}\r\n{Param.PrintProtocol.Client}",
                ReverseHeaderOnEvenPages = true,
                FooterHeight = 55,
                FooterFont = new Font("Arial", 12),
                LeftFooter = $"Island: {Param.PrintProtocol.OperationIslandNo}\r\nKS: {Param.PrintProtocol.OperationCostCenter}\r\nOperation: {Param.PrintProtocol.Operation}",
                MiddleFooter = $"\r\n \r\n[Page #] / [Total Pages]",
                RightFooter = $"\r\n \r\nProtocol: {Param.PrintProtocol.OperationProtocolType}",
                ReverseFooterOnEvenPages = true,
                AssociatedObject = dgvOrder
            };

            RadPrintPreviewDialog dialog = new RadPrintPreviewDialog(document);
            dialog.ShowDialog();  

thanks !!

1 Answer, 1 is accepted

Sort by
0
Accepted
Hristo
Telerik team
answered on 22 Feb 2019, 05:11 PM
Hi Andre,

Thank you for writing.

It is possible to achieve the required behavior but it will require some heavy customizations in the printing engine of the grid. I am attaching a sample project demonstrating a possible approach. It will be necessary to create a custom print style along with special renderer and traverser printing only the currently selected hierarchical row. As the current row is being reset while printing, the Tag property of the row can be used to indicate this.

I hope this will help. Let me know if you have other questions.

Regards,
Hristo
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GridView
Asked by
Andre
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Share this question
or