PDF Export Header Alignment

7 posts, 0 answers
  1. Adam
    Adam avatar
    177 posts
    Member since:
    Oct 2012

    Posted 26 Jul 2011 Link to this post

    When my grid is displayed, my headers are aligned to the left. However, when the grid is exported, the headers are all aligned to the center. Is there a way to keep the alignment to the left when exporting to PDF?

    Thanks,
    Adam
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 27 Jul 2011 Link to this post

    Hello Adam,

    Try the following code snippet to align header item when exporting to pdf.

    C#:
    bool isexport = false;
    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
    {
     if (isexport && e.Item is GridHeaderItem)
     {
        GridHeaderItem headerItem = (GridHeaderItem)e.Item;
        foreach (TableCell cell in headerItem.Cells)
       {
         cell.Style["text-align"] = "left"
       }
     }
    }

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Adam
    Adam avatar
    177 posts
    Member since:
    Oct 2012

    Posted 27 Jul 2011 Link to this post

    Thanks. I tweaked that and I think it's going to work for me.
  5. Charles
    Charles avatar
    2 posts
    Member since:
    Oct 2011

    Posted 15 Nov 2012 Link to this post

    We are a year and a half later and this problem is still in the product! Any plan to bring a serious fix to this flaw ?
  6. Daniel
    Admin
    Daniel avatar
    4943 posts

    Posted 20 Nov 2012 Link to this post

    Hello Charles,

    Altering the default behavior is considered a breaking change. We prefer to avoid making such modifications as they will affect all users. I believe you will understand our point.

    Best regards,
    Daniel
    the Telerik team
    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 their blog feed now.
  7. Charles
    Charles avatar
    2 posts
    Member since:
    Oct 2011

    Posted 20 Nov 2012 Link to this post

    Hello Daniel,

    I agree that a breaking change is not desirable but there must be a way to fix this problem, Can't we have a specific Property within the ExportSettings\Pdf group to control the default behavior ? It sounds like an acceptable solution to every party involved.
    Thank you for your time.

    Charles
  8. Daniel
    Admin
    Daniel avatar
    4943 posts

    Posted 21 Nov 2012 Link to this post

    Hello Charles,

    Indeed, this is a better idea. I will ask our developers if they can expose a property for controlling the default header alignment when exporting RadGrid.

    Thanks,
    Daniel
    the Telerik team
    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 their blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017