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

Export to excel - header

4 Answers 154 Views
Grid
This is a migrated thread and some comments may be shown as answers.
wnl
Top achievements
Rank 1
wnl asked on 26 May 2011, 12:48 PM
Hi,
Is it possible to style header of columns in excel in ExcelExportCellFormatting event?
I have to add border to the first row with column name in excel.

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 26 May 2011, 01:31 PM
Hello Wml,

Please review the following help article.
Word/Excel export (HTML-based).

Thanks,
Shinu.
0
wnl
Top achievements
Rank 1
answered on 26 May 2011, 01:34 PM
I know this article. My question is about concrete event - ExcelExportCellFormatting.
0
Jayesh Goyani
Top achievements
Rank 2
answered on 26 May 2011, 01:34 PM
Hi

you can add/edit style like...

protected void rgvAssignments_GridExporting(object source, GridExportingArgs e)
    {
        string customHTML = "<div width=\"100%\" style=\"text-align:center;font-size:12px;font-family:Verdana;\">Your Header message should come here </div>";

        e.ExportOutput = e.ExportOutput.Replace("<body>", String.Format("<body>{0}", customHTML));
    }


Thanks,
Jayesh Goyani
0
wnl
Top achievements
Rank 1
answered on 07 Jun 2011, 11:13 AM
Ok, your tips helped me.
I have one more problem. In RadGrid I have a currency column formatted {0:c}. After export to excel I can't count all values from that column using sum function because there is currency symbol and spaces beetwen thousands.
Is it possible to remove unwanted parts from currency during export? 
Tags
Grid
Asked by
wnl
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
wnl
Top achievements
Rank 1
Jayesh Goyani
Top achievements
Rank 2
Share this question
or