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

Export to Excel in Landscape for printing

3 Answers 301 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 05 Jun 2013, 02:05 PM
Is it possible to export a RadGrid to Excel so that it's page orientation is Landscape and that it's print setting is also Landscape?

3 Answers, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 10 Jun 2013, 08:44 AM
Hi Mike,

If you are using Html based on export you could hook on HtmlExporting and add the following XML Options and style.
protected void RadGrid1_HTMLExporting(object sender, GridHTMLExportingEventArgs e)
    {
        e.XmlOptions = @"<xml>
                        <x:ExcelWorkbook>
                        <x:ExcelWorksheets>
                        <x:ExcelWorksheet>
                        <x:WorksheetOptions>
                        <x:Print>
                        <x:ValidPrinterInfo/>
                        </x:Print>
                        </x:WorksheetOptions>
                        </x:ExcelWorksheet>
                        </x:ExcelWorksheets>
                        </x:ExcelWorkbook>
                        </xml>";
        e.Styles.AppendFormat("@page{{mso-page-orientation:landscape;}}");
    }

If you are using ExcelML you could check out the following forum post.

Regards,
Kostadin
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
Mike
Top achievements
Rank 1
answered on 10 Jun 2013, 12:31 PM
The problems is that I have grouping on the bottom of the page and the XML only renders the data not the grid.  So, I would have to create all new footers on the fly.
0
Kostadin
Telerik team
answered on 13 Jun 2013, 08:41 AM
Hello Michael,

I am afraid I was not able completely understand your scenario. Are you using a GroupFooterTemplate and this template is not exported? I test this scenarion on my end and it is working as expected. I attached the sample which I used to this forum thread so you could try it on your side.

Regards,
Kostadin
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.
Tags
Grid
Asked by
Mike
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Mike
Top achievements
Rank 1
Share this question
or