Unplanned
Last Updated: 24 Jan 2024 17:02 by ADMIN
Yelena
Created on: 24 Jan 2024 16:53
Category: GridView
Type: Bug Report
0
GridViewPdfExport: Exporting a ColumnGroupViewDefinition that contains groups with multiple columns and FitToPageWidth is false can cause some of the cells to overlap, making the text unreadable

To reproduce use the code below:

DataTable table = new DataTable();
for (int i = 0; i < 20; i++)
{
    table.Columns.Add("Left" + i, typeof(int));
    table.Columns.Add("Right" + i, typeof(int));
}

for (int i = 0; i < 27; i++)
{
    List<object> parameters = new List<object>();
    for (int j = 0; j < table.Columns.Count - 2; j++)
    {
        parameters.Add(100 * i + i);
    }

    table.Rows.Add(parameters.ToArray());
}

this.radGridView1.DataSource = table;

ColumnGroupsViewDefinition def = new ColumnGroupsViewDefinition();
for (int i = 0, j = 0; i < 20; i++)
{
    var group = new GridViewColumnGroup("Group" + 3 + i);
    def.ColumnGroups.Add(group);
    group.Groups.Add(new GridViewColumnGroup("0"));
    group.Groups[0].Rows.Add(new GridViewColumnGroupRow() { MinHeight = 30});
    group.Groups[0].Rows[0].ColumnNames.Add(this.radGridView1.Columns[j].Name);
    this.radGridView1.Columns[j].Width = 58;
    j++;
    group.Groups[0].Rows[0].ColumnNames.Add(this.radGridView1.Columns[j].Name);
    this.radGridView1.Columns[j].Width = 58;
    j++;
}

radGridView1.MasterTemplate.ShowRowHeaderColumn = false;
this.radGridView1.ViewDefinition = def;

// To Export:
GridViewPdfExport pdfExport = new GridViewPdfExport(this.radGridView1);
pdfExport.FitToPageWidth = false;
pdfExport.ExportViewDefinition = true;
pdfExport.ExportVisualSettings = true;
pdfExport.RunExport(@"..\..\pdf", new PdfExportRenderer());

This is the result on the second page. Overlapped groups header cells, overlapped data cells, which results in unreadable text.

  

1 comment
ADMIN
Todor
Posted on: 24 Jan 2024 17:02

Hello,

Thank you for reporting this bug.

There are two possible ways around this problem:

  • The first is to try setting different column widths under a group of the view definition and test the PDF export so that in the exported document they stick together on the same page.
  • Another possible workaround for this problem is to set the ExportViewDefinition to false, The disadvantage of this approach is that it will remove the column group headers from the exported PDF document.

Regards,
Todor
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.