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

RadGrid Export to excel/pdf with page settings

13 Answers 429 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vijayaraj
Top achievements
Rank 1
Vijayaraj asked on 16 Mar 2011, 10:11 PM
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

13 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 22 Mar 2011, 10:50 AM
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
0
Vijayaraj
Top achievements
Rank 1
answered on 08 Apr 2011, 03:53 PM
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
0
Vijayaraj
Top achievements
Rank 1
answered on 12 Apr 2011, 03:12 PM
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

0
Daniel
Telerik team
answered on 13 Apr 2011, 02:50 PM
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.

0
Vijayaraj
Top achievements
Rank 1
answered on 09 Jun 2011, 07:09 PM
Thanks, It works for me.
0
Vijayaraj
Top achievements
Rank 1
answered on 17 Jun 2011, 11:02 PM
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
0
Daniel
Telerik team
answered on 22 Jun 2011, 08:10 PM
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.

0
jagan
Top achievements
Rank 1
answered on 03 Jul 2013, 11:44 AM
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
0
Daniel
Telerik team
answered on 05 Jul 2013, 08:35 AM
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.
0
bharath
Top achievements
Rank 1
answered on 23 Aug 2013, 03:46 PM
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
0
Princy
Top achievements
Rank 2
answered on 26 Aug 2013, 06:15 AM
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

0
Marie
Top achievements
Rank 1
answered on 07 Jul 2014, 07:15 PM
Could we put the page number and the page total?
page1 : 1/3
page2: 2/3
page3: 3/3
Thanks
0
Daniel
Telerik team
answered on 08 Jul 2014, 12:54 PM
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.

 
Tags
Grid
Asked by
Vijayaraj
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Vijayaraj
Top achievements
Rank 1
jagan
Top achievements
Rank 1
bharath
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Marie
Top achievements
Rank 1
Share this question
or