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

Radgrid Export to Word...

3 Answers 394 Views
Grid
This is a migrated thread and some comments may be shown as answers.
raaj
Top achievements
Rank 1
raaj asked on 20 May 2010, 07:32 PM
Team,

Pls. suggest me
1) while exporting radgrid data to word (am using ExportToWord() method) my client want to set Header and
Footer in the word document. Is it possible?
2) I want to Render Radgrid as a HTML to export to word (bcoz I want to apply CSS ) is it possible?

Give me the way to achieve this?

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 24 May 2010, 04:55 PM
Hello Rajesh,

1) Unfortunately headers and footers are not supported when exporting to Word format.

2) You can apply CSS formatting when exporting to Word this way:
protected void RadGrid1_GridExporting(object source, GridExportingArgs e)
{
    string cssCode = "<style type='text/css'>" +
        "tr { background-color: #bbb; }" +
        "th { background-color: #555; color: #fff; }" +
        "</style>";
    e.ExportOutput = e.ExportOutput.Replace("</head>", cssCode + "</head>");
}

Regards,
Daniel
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Ed
Top achievements
Rank 1
answered on 31 Mar 2011, 07:13 PM
Hi Telerik

1) Unfortunately headers and footers are not supported when exporting to Word format.

Any plans to work on this?  It would be ever so useful to have the headers shown in my tables when exporting a RadGrid to a Word doc ...

Ed Graham

P.S.  Thanks for tip (2): that's working very nicely for me.
0
Daniel
Telerik team
answered on 05 Apr 2011, 09:59 PM
Hello Ed,

We will investigate whether it is possible to add headers and footers in Microsoft Word HTML format.

Starting from Q1 2011 you can use the HtmlExporting event to add styles directly:
protected void RadGrid1_HTMLExporting(object sender, GridHTMLExportingEventArgs e)
{
    e.Styles.Append(...);
}

Word/Excel export (HTML-based)

Best regards,
Daniel
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
raaj
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Ed
Top achievements
Rank 1
Share this question
or