We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How to customize PDF Exporting options in GridDataControl?

GridDataControl allows you to export the Grid to pdf using the following extension methods ExportToPdf, ExportToPdfDocument, ExportToPdfGrid and ExportToPdfGridDocument that are in the namespace Syncfusion.Windows.Controls.Grid.Converter.

You can customize the exporting by using “ExportToPdfDocument and “ExportToPdf methods that has ExportToPdfOptions as parameter. ExportToPdfOptions provides various options to customize the exporting as per your requirement.

 The list of properties available in ExportToPdfOptions class is as follows

S. No

API Name

Description

1

ExportStyles

When set to True, ExportToPdf method exports the Grid to pdf with styles, otherwise exports the Grid to pdf without any styles (background, foreground, font etc.)

Default Value : True

2

RepeatHeaders

A Boolean variable determines whether the Header rows are placed in all pdf pages or not.

Default Value : True

3

IncludeHeaders

A Boolean variable determines whether the Header rows exports or not.

Default Value : True

4

AutoColumnWidth

When set to True’, width is automatically set based on the cell values, otherwise width is copied from Grid.

Default Value : False

5

ExportNestedGrid

A Boolean variable determines whether the ExportToPdf method exports the NestedGrid or not.

Default Value : False

6

ExcludeColumns

A List<string>. You can exclude the columns by adding the mapping name to “ExcludeColumns” API.

7

ExportAddNewRow

A Boolean variable determines whether the AddNewRow is exported or not.

DefaultValue: False

8

ExportFilterBar

A Boolean variable determines whether the FilterBar is exported or not.

Default Value : False

 

You can refer the following code sample to customize the Pdf Exporting Options.

C#

After getting the file name, you can create a new PdfDocument by exporting the Grid. Here the property ExportStyles is set as False so that when you export to pdf, styles are not exported in order to improve the export performance. You can exclude Freight column from export by adding it to ExcludeColumns property. By setting the property RepeatHeaders as False, you can avoid the repetition of headers at every page in the exported pdf.

You can change the font and style of PDFGrid before drawing to PDFdocument. You can refer the following link for more information to customize PDFGrid.

http://help.syncfusion.com/wpf/pdf

The following screenshots illustrate the exported Pdf files using ExportToPdfDocument.

When ExportStyles is set as True:

When ExportStyles is set as False:

Article ID: Published Date: Last Revised Date: Platform: Control: Product Version:
2377 07/08/2014 07/10/2014 WPF GridDataControl 12.1.0.43
Did you find this information helpful?
Add Comment
You must log in to leave a comment

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.