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

How to change alignment of headertext in eport excel file

1 Answer 90 Views
Grid
This is a migrated thread and some comments may be shown as answers.
york
Top achievements
Rank 1
york asked on 24 Jun 2011, 02:08 AM
Hi,
I try to export radgrid to excel file. In xls file, the header text of column name is center aligned. I want to have them left aligned. How to do it? Thanks.

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 24 Jun 2011, 06:09 AM
Hello York,

You can try the following to change the header style of column by accessing columns in ItemCreated event. Hope this helps.

C#:
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";
    }
}

Thanks,
Princy.
Tags
Grid
Asked by
york
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or