Set a PageTitle in GridViewPdfExport

3 posts, 1 answers
  1. Jon
    Jon avatar
    27 posts
    Member since:
    Dec 2012

    Posted 04 Jul 2017 Link to this post

    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. Answer
    Dimitar
    Admin
    Dimitar avatar
    2831 posts

    Posted 05 Jul 2017 Link to this post

    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.
  3. Jon
    Jon avatar
    27 posts
    Member since:
    Dec 2012

    Posted 05 Jul 2017 in reply to Dimitar Link to this post

    Perfect, thank you!
Back to Top