RadGrid Export to excel/pdf with page settings

14 posts, 0 answers
  1. Vijayaraj
    Vijayaraj avatar
    25 posts
    Member since:
    Mar 2011

    Posted 16 Mar 2011 Link to this post

    I wish to export the content in a RadGrid to excel/pdf format by setting the header and footer for each and every page. Is there any ways to accomplish that.

    - I know that there is a pageTitle property for pdf export, but Is there a way to include formatted headers than title for the grid data.
       (ie:- I would include date/time, pagenumber, company/author name, copyrights message.

    Thanks,
    Vijayaraj
  2. Daniel
    Admin
    Daniel avatar
    4943 posts

    Posted 22 Mar 2011 Link to this post

    Hello Vijayaraj,

    PageTitle property supports plain text only - it is not possible to insert anything but simple text.

    I will take that you use the HTML Excel format. In this case you can add a custom header this way:
    protected void RadGrid1_HTMLExporting(object sender, GridHTMLExportingEventArgs e)
    {
        e.Styles.Append("table @page {" +
            @"mso-header-data:'&CSAMPLE HEADER\000APage &P'; " +
            @"mso-footer-data:'Date\: &D' }"); 
    }

    &L, &R, &C - Alignment (left, right, center)
    &D, &T - Date/Time
    &P, &N - Page number/Total pages
    &B, &I - Bold/Italic

    Best regards,
    Daniel
    the Telerik team
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Vijayaraj
    Vijayaraj avatar
    25 posts
    Member since:
    Mar 2011

    Posted 08 Apr 2011 Link to this post

    Hi,

    Thank you very much, but that solution is not working for me.
    Could you please suggest me whether it requires any specific parameter.

    Thanks,
    Vijay
  5. Vijayaraj
    Vijayaraj avatar
    25 posts
    Member since:
    Mar 2011

    Posted 12 Apr 2011 Link to this post

    I actually did a work around to get data as header using the ExcelMl Export.
    if (e.Worksheet.Table.Rows.Count == 1)
     {
          RowElement row = new RowElement();
          CellElement cell = new CellElement();
          string cellText = "This is a Sample cell header";
          cell.Data.DataItem = cellText == " " ? "" : cellText;
          row.Cells.Add(cell);
          e.Worksheet.Table.Rows.Insert(0,row);
    }

    But now the problem is with the excel filter, which is visible at the first row were I have added the header. Is there a way to set the excel filter at the desired row.

    Thanks in advance.

    Cheers,
    Vijay

  6. Daniel
    Admin
    Daniel avatar
    4943 posts

    Posted 13 Apr 2011 Link to this post

    Hello Vijay,

    You can change the location of the autofilter this way:
    e.Worksheet.AutoFilter.Range="R2C1:R2C4";

    R2C1:R2C4 = Row 2, Column 1 to Row 2, Column 4

    Kind regards,
    Daniel
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  7. Vijayaraj
    Vijayaraj avatar
    25 posts
    Member since:
    Mar 2011

    Posted 09 Jun 2011 Link to this post

    Thanks, It works for me.
  8. Vijayaraj
    Vijayaraj avatar
    25 posts
    Member since:
    Mar 2011

    Posted 17 Jun 2011 Link to this post

    While exporting in ExcelML format it doesnt export the computed column and the footer. But the same works fine when i export excel in Html format.

    Is there a way to accomplish the computed column and computed footer in EXcelML exporting?

    Regards,
    Vijay
  9. Daniel
    Admin
    Daniel avatar
    4943 posts

    Posted 22 Jun 2011 Link to this post

    Hello Vijayaraj,

    Calculated values won't be exported out-of-the-box but you could add them on your own using a workaround similar to that demonstrated in the attached project.

    Best regards,
    Daniel
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  10. jagan
    jagan avatar
    6 posts
    Member since:
    Nov 2010

    Posted 03 Jul 2013 Link to this post

    Hi Daniel,

    I would like to export radgrid with header logo image with text in the left and right of the page and also page number in the footer of each and every page. Please see the attached file which is the output I need. Here the image logo is dynamically given by the user. Is it possible to get the format which I have mentioned in the screen shot for all the formats(PDF/Word/Excel) for the hierarchy grid using inbuilt telerik export methods. Currently We are using telerik File version: 2012.3.1308.35.

    Thanks,
    R.Jaganathan
  11. Daniel
    Admin
    Daniel avatar
    4943 posts

    Posted 05 Jul 2013 Link to this post

    Hello,

    This is possible with the PDF format only. You can find information about the header/footer support in our online documentation:
    PDF Export

    Regards,
    Daniel
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  12. bharath
    bharath avatar
    23 posts
    Member since:
    Jun 2011

    Posted 23 Aug 2013 Link to this post

    in radgrid export settings iam not getting <pdf>   </pdf> tags.
    iam getting only pdf ,excel, csv options..
    iwant to set page header and footer while export to pdf of radgrid data.

    /Thanks

    Bharath
  13. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 26 Aug 2013 Link to this post

    Hi Bharath,

    From Q2 2013 PDF export supports header and footer. PageHeader element holds the header cells while the PageFooter elements contains the footer cells and they are applicable to ExportSettings-Pdf tab.Please make sure that you are using the latest version.This is the code I tried and it works fine at my end using latest version.

    ASPX:
    <ExportSettings>
        <Pdf>
            <PageHeader>
                <LeftCell Text="Company Name" TextAlign="Left" />          
            </PageHeader>
            <PageFooter>
                <MiddleCell Text="<?page-number?>" />
            </PageFooter>
        </Pdf>
    </ExportSettings>

    Thanks,
    Princy

  14. Marie
    Marie avatar
    9 posts
    Member since:
    May 2014

    Posted 07 Jul 2014 in reply to Princy Link to this post

    Could we put the page number and the page total?
    page1 : 1/3
    page2: 2/3
    page3: 3/3
    Thanks
  15. Daniel
    Admin
    Daniel avatar
    4943 posts

    Posted 08 Jul 2014 Link to this post

    Hello Marie,

    I'm afraid the total number of pages value is not available due to internal limitation.
    Please excuse us for any inconvenience caused.

    Regards,
    Daniel
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017