asp.netexcelteleriktelerik-gridtelerik-ajax

Telerik RadGrid export to excel gives paper format Letter and I need A4


I have not found where to set this setting. I have really tried, maybe it does not exist.

Cheers.


Solution

  • There is a configuration option to handle this export formatting when you are using ExcelML export.

    Configure the ExportSettings for your AJAX Grid similar to the following:

    <ExportSettings ExportOnlyData="true" OpenInNewWindow="true" Excel-Format="ExcelML" />
    

    Handle the OnExcelMLWorkBookCreated event, and you can set the papersize with the following property:

    protected void grid_ExcelMLWorkBookCreated(object sender, Telerik.Web.UI.GridExcelBuilder.GridExcelMLWorkBookCreatedEventArgs e)
    {
        e.WorkBook.Worksheets[0].WorksheetOptions.Print.PaperSize = System.Drawing.Printing.PaperKind.A4;
    }
    

    Here is a link to the RadGrid ExcelML Export documentation.