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

[Solved] Export to Excel - column header alignment

2 Answers 740 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Clive Hoggar
Top achievements
Rank 1
Clive Hoggar asked on 20 Nov 2009, 01:30 PM
Hi

I have a grid exporting to excel working except that the headers for text columns do
not align left, althought the horizontal-align property is set left in the grid declaration.

I have the ExportOnlyData set to false
How can I align the column headings?

Thanks

Clive

2 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 20 Nov 2009, 02:11 PM
Hello Clive,

Please try the following approach:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
    if (e.Item is GridHeaderItem && isExcelExport)
    {
        foreach (TableCell cell in e.Item.Cells)
            cell.Style["text-align"] = "left";
    }
}

Best regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Clive Hoggar
Top achievements
Rank 1
answered on 22 Nov 2009, 05:27 PM
Thanks for this!
Tags
Grid
Asked by
Clive Hoggar
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Clive Hoggar
Top achievements
Rank 1
Share this question
or