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

print only one row with its hierarchy

1 Answer 38 Views
This is a migrated thread and some comments may be shown as answers.
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);

thanks !!

1 Answer, 1 is accepted

Sort by
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.

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.
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question