Declined
Last Updated: 30 Apr 2018 14:44 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);
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
1 comment
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