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

Row headers columns size on print

2 Answers 99 Views
PivotGrid and PivotFieldList
This is a migrated thread and some comments may be shown as answers.
Alex Dybenko
Top achievements
Rank 2
Alex Dybenko asked on 04 Oct 2016, 02:18 PM

Hi,

when I print PivotGrid - all Row headers columns have same size, is it possible to print them similar size like on the screen? Like for datacells columns, see attached

Alex

2 Answers, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 06 Oct 2016, 02:11 PM
Hi Alex,

Thank you for writing.

Indeed, the row headers are not printed with the desired width. I have logged this issue in our feedback portal and I have also added a vote for it on your behalf. You can subscribe to the item and be notified its status changes here: FIX. RadPivotGrid - row headers width should be respected when the pivot is being printed. I have also updated your Telerik points.

The issue will be fixed with our upcoming release scheduled for the end of the month. Until then you would need to use a custom PivotGridPrintStyle class and override its Initialize method: 
private void PrintPivotGrid()
{
    MyPivotGridPrintStyle style = new MyPivotGridPrintStyle();
    style.LayoutType = PivotLayout.Tabular;
    this.radPivotGrid1.PrintStyle = style;
    this.radPivotGrid1.PrintPreview();
}
public class MyPivotGridPrintStyle : PivotGridPrintStyle
{
    public override void Initialize()
    {
        base.Initialize();
 
        FieldInfo fiColumnWidths = this.GetType().BaseType.GetField("columnWidths", BindingFlags.Instance | BindingFlags.NonPublic);
        List<int> columnWidths = (List<int>)fiColumnWidths.GetValue(this);
        RadPivotGridElement pivotGrid = (RadPivotGridElement)this.GetType().BaseType.GetField("pivotGrid", BindingFlags.Instance | BindingFlags.NonPublic)
                                                                                    .GetValue(this);
 
        for (int i = 0; i < pivotGrid.RowDescriptorsArea.Children.Count; i++)
        {
            RadElement descriptor = pivotGrid.RowDescriptorsArea.Children[i];
            columnWidths[i] = descriptor.Size.Width;
        }
    }
}

I hope this helps. Please let me know if you have further questions.

Regards,
Hristo Merdjanov
Telerik by Progress
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms. For more information check out this blog post and share your thoughts.
0
Alex Dybenko
Top achievements
Rank 2
answered on 12 Oct 2016, 02:10 PM

Thanks Hristo, works fine!

 

Alex

 

Tags
PivotGrid and PivotFieldList
Asked by
Alex Dybenko
Top achievements
Rank 2
Answers by
Hristo
Telerik team
Alex Dybenko
Top achievements
Rank 2
Share this question
or