Completed
Last Updated: 18 Jul 2023 14:26 by ADMIN
Release R2 2023 SP1
Build-dude
Created on: 27 Apr 2023 13:32
Category: GridView
Type: Bug Report
0
RadGridView: GridPrintStyle.HierarchyIndent is lost after Print Settings and hitting the button Preview

Code to replicate the issue: 

            GridPrintStyle style = new GridPrintStyle();
            style.PrintHierarchy = true;
            style.HierarchyIndent = 0;
            style.ChildViewPrintMode = ChildViewPrintMode.SelectViewToPrint;
            this.radGridView1.PrintStyle = style;

            this.radGridView1.PrintPreview();

The attached gif file illustrates how the 20px hierarchy indent is returned after hitting the preview button.

Attached Files:
1 comment
ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 27 Apr 2023 13:39

Hello, 

Thank you for reporting this issue. The possible solution that I can suggest to preserve the hierarchy indent is to use the following custom dialog:

        private void button1_Click(object sender, EventArgs e)
        {
            this.radGridView1.PrintSettingsDialogFactory = new CustomGridViewPrintSettingsDialogFactory();

            GridPrintStyle style = new GridPrintStyle();
            style.PrintHierarchy = true;
            style.HierarchyIndent = 0;
            style.ChildViewPrintMode = ChildViewPrintMode.SelectViewToPrint;
            this.radGridView1.PrintStyle = style;

            this.radGridView1.PrintPreview();
        }

        public class CustomGridViewPrintSettingsDialog : GridViewPrintSettingsDialog
        {
            public CustomGridViewPrintSettingsDialog(RadPrintDocument document) : base(document)
            {
            }

            protected override void LoadSettings()
            {
                base.LoadSettings();

                RadGridView gridView = this.PrintDocument.AssociatedObject as RadGridView;
                this.printStyleSettingControl.PrintStyle.HierarchyIndent = gridView.PrintStyle.HierarchyIndent;
            }
        }

        public class CustomGridViewPrintSettingsDialogFactory : IPrintSettingsDialogFactory
        {
            public Form CreateDialog(RadPrintDocument document)
            {
                return new CustomGridViewPrintSettingsDialog(document);
            }
        }

Please give it a try and see how it works for your scenario.

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.