print only one row with its hierarchy

2 posts, 1 answers
  1. Andre
    Andre avatar
    41 posts
    Member since:
    Feb 2018

    Posted 21 Feb 2019 Link to this post

    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 !!
  2. Answer
    Hristo avatar
    1520 posts

    Posted 22 Feb 2019 Link to this post

    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.
Back to Top