Radgrid export pdf download

Radgrid export pdf download

radgrid export pdf download

Formatting Exports from Telerik RadGrid (PDF, Word, format an export from a RadGrid. Enter your Download PDF Page 1. You can customize the HTML that is. Download free 30-day trial. Export to PDF. Overview. RadGridView can export its contents to PDF using two separate mechanisms. The GridViewPdfExport. End users can intuitively export content from RadGrid and convert it to a PDF file. Find more New to Telerik UI for ASP.NET AJAX? Download free 30-day trial.

Radgrid export pdf download - realize

Export to PDF

Overview

RadGridView can export its contents to PDF using two separate mechanisms.

  • The GridViewPdfExport object utilizes the powerful RadPdfProcessing library and exports RadGridView`s data natively to the PDF format.

  • The ExportToPdf object on the other hand first renders RadGridView as an XHTML table and the export process will convert that table to a PDF document. That said, Export to PDF supports all of the ExportToHTML settings, but it also adds some PDF specific ones.

Exporting Data using GridViewPdfExport object

The GridViewPdfExport functionality is located in the TelerikExport.dll assembly. You need to include the following namespace in order to access the types contained in TelerikExport :

  • Telerik.WinControls.Export

The ExportToPdf functionality is located in the TelerikData.dll assembly. You need to include the following namespace in order to access the types contained in TelerikData :

  • Telerik.WinControls.UI.Export

Initialization

Before running export to PDF, you have to initialize the GridViewPdfExport class. The constructor takes one parameter: RadGridView which will be exported:

GridViewPdfExport initialization

File Extension

The FileExtension property allows you to change the default (*.pdf) file extension of the exported file:

Setting the file extension

Hidden columns and rows option

GridViewPdfExport uses the default enumeration of hidden column and row settings. You can choose one of the three options by setting HiddenColumnOption and HiddenRowOption properties. However, PDF do not support real hidden columns, so choosing the ExportAsHidden will not behave the same as ExportAlways.

  • ExportAlways

  • DoNotExport (default)

  • ExportAsHidden (brings the same result as ExportAlways option)

Setting the HiddenColumnOption

Header and Footer

Before applying customizations to the headers and footers we need to enable them:

Enabling headers and footers

Customizing headers and footers

The HeaderExported event can be used to perform custom drawing in the header. The following example shows how you can draw a two line header.

Using the HeaderExported event

Summaries export option

The SummariesExportOption property to specifies how to export summary items. There are four options to choose:

  • ExportAll (default)

  • ExportOnlyTop

  • ExportOnlyBottom

  • DoNotExport

Setting summary items

Fit to page

Use this property to make the grid fits to the PDF page width.

Setting FitToPageWidth

Scale

You can use Scale to change the grid size on the PDF. For example if Scale = 1.2f means the grid will be 20% bigger.

Setting scale

PDF Export Settings

The PDFExportSettings property supports various settings on PDF file level. You can set the following:

Using export settings

ExportViewDefinition

Gets or sets a value indicating whether to export the view definition.

ChildViewExportMode: Defines which child view of a hierarchy row to be exported. Available modes are:

  • ExportFirstView: The exporter exports the first view.

  • ExportCurrentlyActiveView: The exporter exports the view that is active in the grid.

  • ExportAllViews: All child views are exported.

  • SelectViewToExport: In this mode the ChildViewExporing event is fired. The event allows to choose the view to export in row by row basis.

PDF Export Settings

The PDFExportSettings property supports various settings on PDF file level. You can set the following:

Using export settings

Exporting to PDF

Two methods are responsible for exporting data to PDF. Both receive as a parameter the file name.

  • RunExport: Runs synchronously.

Running export

The RunExport method has several overloads allowing the user to export using a stream as well:

Running export synchronously using a stream

  • RunExportAsync: Runs on a thread different than the UI thread.

Running export asynchronously

The RunExportAsync method has several overloads allowing the user to export using a stream as well:

Events

  • CellFormatting: Fires for every cell which is being exported

  • CellPaint: Fires when a cell is being drawn

Exporting Data using ExportToPDF object

Initialization

Before running export to PDF, you have to initialize the ExportToPDF class. The constructor takes one parameter: RadGridView which will be exported:

ExportToPDF initialization

File Extension

The FileExtension property allows you to change the default (*.pdf) file extension of the exported file:

Setting the FileExtension

Hidden columns and rows option

ExportToPDF uses the default enumeration of hidden column and row settings. You can choose one of the three options by setting HiddenColumnOption and HiddenRowOption properties. However, PDF do not support real hidden columns, so choosing the ExportAsHidden will not behave the same as ExportAlways.

  • ExportAlways

  • DoNotExport (default)

  • ExportAsHidden  (brings the same result as ExportAlways option)

Setting the HiddenColumnOption

Exporting Visual Settings

Using the ExportToPDF class allows you to export the visual settings (themes) to the PDF file. ExportToPDF also provides a visual representation of the alternating row color. This feature works only if EnableAlternatingRow property is set to true. Note that it does not transfer the alternating row settings that come from the theme of the control. RadGridView will also export the conditional formatting to the PDF file. You can enable exporting visual settings through the ExportVisualSettings property. The default value of this property is false.

Setting the ExportVisualSettings

Page Title

You can add a page title which will be presented on every page of the PDF document through __PageTitle__property.

Setting the PageTitle

Summaries export option

You can use SummariesExportOption property to specify how to export summary items. There are four options to choose:

  • ExportAll (default)

  • ExportOnlyTop

  • ExportOnlyBottom

  • DoNotExport

Setting the SummariesExportOption

Fit to page

Use this property to make the grid fits to the PDF page width.

Setting the FitToPageWidth

Scale

You can use Scale to change the grid size on the PDF. For example if Scale = 1.2f means the grid will be 20% bigger.

Setting the Scale

TableBorderThickness

This property controls the thickness of the table border. The default value is 0 and border is not drawn.

Setting the TableBorderTickness

PDF Export Settings

The PDFExportSettings property supports various settings on PDF file level. You can set the following:

  • Author

  • Creator

  • EnableAdd

  • EnableCopy

  • EnableModify

  • EnablePrinting

  • FontType

  • Keywords

  • Page Margins: PageBottomMargin, PageTopMargin, PageLeftMargin, PageRightMargin, PageFooterMargin

  • Page Size: PageHeight and PageWidth

  • Producer

  • Subject

  • Title

Setting the PDFDocumentSettings

RunExport method

Exporting data to PDF is done through the RunExport method of ExportToPDF object. The RunExport method accepts the following parameter:

  • fileName - the name of the exported file

Consider the code sample below:

Exporting to PDF format

Events

HTMLCellFormating event: Since the the export process first renders RadGridView in XHTML format you can use the event which comes from ExportToHTML class: HTMLCellFormatting. It gives access to a single cell  HTML element that allows you to make additional formatting for every HTML cell related to the exported RadGridView:

Handling the HTMLCellFormatting event

Fonts / Unicode support

ExportToPDF supports all left-to-right languages when the appropriate Unicode font is set. The most common international font is Arial Unicode MS, because it covers all Unicode characters. Of course, you can use other-specific fonts such as Batang for Korean, SimSun for Chinese, MS Mincho for Japanese, etc.

Источник: [https://torrent-igruha.org/3551-portal.html]
radgrid export pdf download

Radgrid export pdf download

0 thoughts to “Radgrid export pdf download”

Leave a Reply

Your email address will not be published. Required fields are marked *