Declined
Last Updated: 13 Sep 2019 07:11 by ADMIN
ADMIN
Dess | Tech Support Engineer, Sr.
Created on: 30 Apr 2018 09:58
Category: GridView
Type: Bug Report
1
FIX. RadGridView - multi-line text is wrapped but clipped when using the GridViewPdfExport
To reproduce: please refer to the attached sample project and gif file

Workaround:

            GridViewSpreadExport spreadExporter = new GridViewSpreadExport(this.radGridView1);
            spreadExporter.ExportFormat = SpreadExportFormat.Pdf;
            spreadExporter.ExportVisualSettings = true;
            SpreadExportRenderer exportRenderer = new SpreadExportRenderer();
            spreadExporter.RunExport(exportFile, exportRenderer);
            Process.Start(exportFile);
3 comments
ADMIN
Dess | Tech Support Engineer, Sr.
Posted on: 13 Sep 2019 07:11
Hello, Luca,

Thank you for sharing an improved solution regarding the margins. Feel free to use this approach which suits your requirements best.

Should you have further questions please let me know.

 

Regards,
Dess | Tech Support Engineer, Sr.
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.
Luca
Posted on: 10 Sep 2019 14:02

Workaround 2 is not working if the grid have Horizzontal scrollbar and marign are considered only one time.

 

This is better in my opinion:

 

float pageWidth = (float)Telerik.WinControls.Export.GridExportUtils.DipToMm(this.radGridView1.Columns.Sum(c => c.Width)) + (gridViewPdfExport.PageMargins.Horizontal * 2);

ADMIN
Dimitar
Posted on: 30 Apr 2018 13:14
The export direction is from RadGridView to PdfDocument. Row heights and column widths are calculated in RadGridView and GridViewPdfExport takes the same values. When the FitToPageWidth property is true(its default value is true) all column widths from the grid are scaled to fit in the page width of GridViewPdfExport. In some cases when the width of RadGridView is bigger than the width of GridViewPdfExport Page, text may not fit and will be clipped.
In the current case, the width of RadGridView is 1099px, but the width of the exported page with margins subtracted is 650px. When the last column is scaled down there is not enough space for the text and it is clipped.

There are three possible solutions in this case:
1. Set FitToPageWidth to false;
2. Calculate the Page Width of GridViewPdfExport according to the width of RadGridView and page Margins.
- exporter.PageSize = new SizeF((float)Telerik.WinControls.Export.GridExportUtils.DipToMm(this.radGridView1.Width) + exporter.PageMargins.Horizontal, exporter.PageSize.Height);
3. Set the width of RadGridView the same as the width of the page of GridViewPdfExport and subtract horizontal margins.
- this.radGridView1.Width = (int)Telerik.WinControls.Export.GridExportUtils.MmToDip(exporter.PageSize.Width - exporter.PageMargins.Horizontal); // remove Anchor and Dock of grid before this step