I'm using the Rad Grid's ExportToPDF functionality in that i want to set left padding to header text. i tried to set programmatically but it doesn't work.
any solution for this..? please check attachment for your understanding.
1 Answer, 1 is accepted
0
Doncho
Telerik team
answered on 02 Dec 2020, 12:26 PM
Hi Pritam,
You can try setting the desired styles in the ItemCommand event when ExportToPdf command is fired.
Here is a sample for looping through all header cells applying some custom styles:
protectedvoidRadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
if (e.CommandName == RadGrid.ExportToPdfCommandName)
{
var columns = RadGrid1.MasterTableView.Columns;
foreach (GridColumn col in columns)
{
var headerCell = RadGrid1.MasterTableView.GetHeaderCellByColumnUniqueName(col.UniqueName);
headerCell.HorizontalAlign = HorizontalAlign.Left;
headerCell.Style.Add("padding-left", "5px");
}
}
}
Please give it a try and let me know if how it goes!
Kind regards,
Doncho
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.