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

PDF Export Header Alignment

6 Answers 279 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Adam
Top achievements
Rank 1
Adam asked on 26 Jul 2011, 09:56 PM
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

6 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 27 Jul 2011, 05:16 AM
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.
0
Adam
Top achievements
Rank 1
answered on 27 Jul 2011, 02:17 PM
Thanks. I tweaked that and I think it's going to work for me.
0
Charles
Top achievements
Rank 1
answered on 15 Nov 2012, 08:13 PM
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 ?
0
Daniel
Telerik team
answered on 20 Nov 2012, 03:47 PM
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.
0
Charles
Top achievements
Rank 1
answered on 20 Nov 2012, 04:21 PM
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
0
Daniel
Telerik team
answered on 21 Nov 2012, 06:15 PM
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.
Tags
Grid
Asked by
Adam
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Adam
Top achievements
Rank 1
Charles
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or