Fit exported excel file to one page horizontally

2 posts, 0 answers
  1. Kavita
    Kavita avatar
    39 posts
    Member since:
    Feb 2013

    Posted 25 Sep 2013 Link to this post

    Hello telerik,
    I have used Radgrid Export To Excel with format='ExcelML'.
    I want exported excel sheet to fit all columns of grid into single page horizontally so that I can print it directly.
    How can I achieve this?
  2. Kostadin
    Kostadin avatar
    1733 posts

    Posted 30 Sep 2013 Link to this post

    Hi Kavita,

    Thank you for contacting us.

    In order to fit all columns into a single page when printing you have to set WorksheetOptionsElement's FitToPage to true. Check out the following code snippet:
    protected void RadGrid1_ExcelMLWorkBookCreated(object sender, Telerik.Web.UI.GridExcelBuilder.GridExcelMLWorkBookCreatedEventArgs e)
        e.WorkBook.Worksheets[0].WorksheetOptions.FitToPage = true;

    I hope this information helps.

    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.
Back to Top