Column HorizontalAlign in PDF export

2 posts, 0 answers
  1. Marcus
    Marcus avatar
    8 posts
    Member since:
    Aug 2019

    Posted 06 Jan 2020 Link to this post

    Hello,

    trying to HorizontalAlign two (of multiple) columns in a pdf export. I've tried:

    protected void btnExport_Click(object sender, EventArgs e)
    {
         // bla bla
         MyGrid.MasterTableView.GetColumn("col1").ItemStyle.HorizontalAlign = HorizontalAlign.Center;
    }

     

    and this way:

    protected void MyGrid_PreRender(object sender, EventArgs e)
    {
         // bla bla
         foreach (GridColumn col in MyGrid.MasterTableView.RenderColumns)
                    {
                        if (col.UniqueName == "col1") { col.ItemStyle.HorizontalAlign = HorizontalAlign.Center; }
                    }
    }

     

    Both do not work - what's the correct way to do this?

    Thx in advance - M.

  2. Eyup
    Admin
    Eyup avatar
    4046 posts

    Posted 09 Jan 2020 Link to this post

    Hello Marcus,

     

    The property you are looking for is called UseItemStyles:

          <telerik:RadGrid ... >
                <ExportSettings ExportOnlyData="true" UseItemStyles="true"></ExportSettings>
                <MasterTableView ... CommandItemDisplay="Top">
                    <CommandItemSettings ShowExportToPdfButton="true" />
                    <Columns>
                        <telerik:GridBoundColumn ... >
                            <ItemStyle HorizontalAlign="Right" />
    I hope this will prove helpful.

     

    Regards,
    Eyup
    Progress Telerik

    Get quickly onboarded and successful with UI for ASP.NET AJAX with the Virtual Classroom technical trainings, available to all active customers. Learn More.
Back to Top