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

Column HorizontalAlign in PDF export

1 Answer 31 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Marcus
Top achievements
Rank 1
Marcus asked on 07 Jan 2020, 01:54 AM

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.

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 09 Jan 2020, 05:01 PM

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