Skip to content

Commit 675fc92

Browse files
dimodidimodi
authored and
dimodi
committed
docs(grid): Improve PDF export notes
1 parent 06fd288 commit 675fc92

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

_contentTemplates/grid/export.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#export-common-notes
2-
* `bool` fields are exported as `TRUE` or `FALSE` strings, because there is no boolean data type in Excel and these string values are the most common ones used in data and macros.
2+
* `bool` fields are exported as `TRUE` or `FALSE` strings, because there is no native boolean data type in exported format and these string values are the most common ones used in data and macros.
33

44
* Date and number formats are exported with the following format: `mm/dd/yyyy hh:mm:ss` plus the current app culture AM/PM specifier for dates, and `Convert.ToDouble(value)` for numbers (which uses the current thread culture). The Excel date formats are different than .NET date formats and Excel may not always recognize the column as dates, for example, if the entire date format from the .NET culture is used.
55

components/grid/export/pdf.md

+4-5
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ You can programmatically invoke the export feature of the Grid, by using the fol
194194

195195
To customize the exported file, handle the `OnBeforeExport` or `OnAfterExport` events the Grid exposes.
196196

197-
The component allows you to control the data set that will be exported. It also provides built-in customization options for the columns such as `Width`, `Title`, and more.
197+
The component allows you to control the data set that will be exported. It also provides built-in customization options for the columns such as `Width`, `Title`, and more. The [column widths in the exported PDF file must be large enough, so that the cell content fits](#notes). Text wrapping is not supported.
198198

199199
For more advanced customization the Grid lets you get the `MemoryStream` of the file. Thus, you can customize it using the [`PdfProcessing`](https://docs.telerik.com/devtools/document-processing/libraries/radpdfprocessing/overview) library that is available with your license.
200200

@@ -204,10 +204,9 @@ Read more about how to [customize the exported file](slug:grid-export-events).
204204

205205
The PDF export has the following specifics:
206206

207-
* When exporting Grid columns, the developer must provide column widths that are appropriate for exporting the data. While an Excel file allows resizing its columns, the PDF file format does not allow resizing the columns. You can change the width of the column from the [`OnBeforeExportEventArgs.Columns[0].Width property`](slug:grid-export-events#for-pdf-export), so you have full control over this value (note that it can be different from the one defined in the corresponding Grid column, thus ensuring flexibility to render the Grid columns with one width and export them with another).
208-
* Avoid exporting columns without widths—while Excel has a default width for a column, PDF requires fixed dimensions. Set specific widths to all columns when exporting (note that this is unrelated to the width of the column as the export width can be configured through the [`OnBeforeExport` event](slug:grid-export-events#for-pdf-export).
209-
* PDF does not understand units different from `px` for the column `Width`, and if you use them (such as `rem` or `%`), it will fail to parse them and will render a collapsed (hidden) column with zero width.
210-
* When exporting Grid columns, you must provide appropriate `PaperSize` and `PageOrientation` properties. For example, if you want to render 20 columns (100px each) in an A4 sheet, then this will yield unexpected results. The column dimensions in a PDF file are fixed, thus they cannot be resized as in Excel, which requires the developer to ensure proper export dimensions.
207+
* PDF export requires pixel widths for all columns. Widths in other units such as `%` or `em` cannot be translated correctly and the respective columns will collapse in the exported PDF file. The column widths for the PDF export can differ from the ones in the Grid configuration for the web browser. To set column widths for the PDF file only, use the `Width` property of the [`OnBeforeExportEventArgs.Columns`](slug:grid-export-events#for-pdf-export) members.
208+
* For performance reasons, the PDF export mechanism draws each cell value on a single line. Any content that does not fit in the available space will be clipped. Text wrapping and PDF column resizing is not supported.
209+
* Provide appropriate `PaperSize` and `PageOrientation` properties. For example, if you want to render 20 columns (100px each) in an A4 sheet, then this will yield unexpected results. The column dimensions in a PDF file are fixed, thus they cannot be resized as in Excel, which requires the developer to ensure proper export dimensions.
211210
* Exporting to PDF in UI for Blazor is different from exporting in Kendo jQuery, where the full HTML is exported. The Blazor export to PDF will export the Grid to a table, similar to an Excel table. If you want [to export to PDF as HTML, you can use a custom approach](#custom-export).
212211
* Some PDF fonts do not include Cyrillic or other non-Latin characters. In such cases, [load a compatible font explicitly](https://docs.telerik.com/devtools/document-processing/knowledge-base/pdfprocessing-implement-fontsprovider).
213212
* Templates are not exported, because there is no provision in the framework for getting them at runtime. If a column, header or group header/footer has a template or aggregates, it will be ignored. The headers will be the `Title` of the column, the data is the data from the `Field`. If you need additional information, see if you can add it in a Field in the model, or create your own PDF file. Find a <a href="https://feedback.telerik.com/blazor/1485764-customize-the-Pdf-file-before-it-gets-to-the-client" target="_blank">project example on how to generate your own exported file</a>. Find additional information on how to [export an image that is rendered in a Grid column template](slug:grid-export-image-column-excel).

0 commit comments

Comments
 (0)