This is a migrated thread and some comments may be shown as answers.

Set a PageTitle in GridViewPdfExport

2 Answers 100 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 04 Jul 2017, 08:26 PM
Is it possible to set a PageTitle when using the GridViewPdfExport, similar to when using ExportToPdf (see http://docs.telerik.com/devtools/winforms/gridview/exporting-data/export-to-pdf#page-title)? I can't find a similar property. I'm using the CellPaint and CellFormatting events of the GridViewPdfExport to render Charts in my Grid during export, so I can't just switch export methods. I would like to be able to put a title on the page or grid in the PDF. And unfortunately the GridView does not yet support a title or caption, either. (See https://feedback.telerik.com/Project/154/Feedback/Details/112101-add-radgridview-add-caption.)

2 Answers, 1 is accepted

Sort by
0
Accepted
Dimitar
Telerik team
answered on 05 Jul 2017, 06:07 AM
Hi Jon, 

You can use the header to display the title. Here is  an example:
private void radButton1_Click(object sender, EventArgs e)
{
    Telerik.WinControls.Export.GridViewPdfExport pdfExporter = new Telerik.WinControls.Export.GridViewPdfExport(this.radGridView1);
 
    pdfExporter.ShowHeaderAndFooter = true;
    pdfExporter.HeaderHeight = 30;
    pdfExporter.HeaderFont = new Font("Arial", 22);
    pdfExporter.MiddleHeader = "My Title";
 
    string fileName = "d:\\ExportedData.pdf";
    pdfExporter.RunExport(fileName, new Telerik.WinControls.Export.PdfExportRenderer());
}

I hope this will be useful.

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Jon
Top achievements
Rank 1
answered on 05 Jul 2017, 01:14 PM
Perfect, thank you!
Tags
GridView
Asked by
Jon
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Jon
Top achievements
Rank 1
Share this question
or