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