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

Export to excel header row colored

1 Answer 123 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Vitaly
Top achievements
Rank 1
Iron
Iron
Vitaly asked on 19 Sep 2012, 02:30 PM
Good morning,
this is my 2nd request.
Before exporting radgrid to excel I am creating a header rowin the following event:

protected

 

 

void CfnReportGrid_ExcelMLExportRowCreated(object sender, Telerik.Web.UI.GridExcelBuilder.GridExportExcelMLRowCreatedArgs e)

 

{

 

 

if (e.RowType == Telerik.Web.UI.GridExcelBuilder.GridExportExcelMLRowType.HeaderRow)

 

{

Telerik.Web.UI.GridExcelBuilder.

 

RowElement row = new Telerik.Web.UI.GridExcelBuilder.RowElement();

 

Telerik.Web.UI.GridExcelBuilder.

 

CellElement cell = new Telerik.Web.UI.GridExcelBuilder.CellElement();

 

cell.Data.DataItem =

 

"NYC DEPARTMENT OF EDUCATION";

 

cell.StyleValue =

 

"MyHeaderStyle";

 

cell.MergeAcross = e.Row.Cells.Count - 1;

row.Cells.Add(cell);

e.Worksheet.Table.Rows.Insert(0, row);
}

And then in another event I do styling this header:

 

protected

 

 

void CfnReportGrid_ExcelMLExportStylesCreated(object sender, Telerik.Web.UI.GridExcelBuilder.GridExportExcelMLStyleCreatedArgs e)

 

{

 

  Telerik.Web.UI.GridExcelBuilder.StyleElement myStyleH = new lerik.Web.UI.GridExcelBuilder.StyleElement"MyHeaderStyle");

 

myStyleH.FontStyle.Size = 25;

myStyleH.FontStyle.Bold =

 

true;

 

System.Drawing.

 

Color col = System.Drawing.ColorTranslator.FromHtml("#2C78FF");

 

myStyleH.FontStyle.Color = col;

myStyleH.AlignmentElement.HorizontalAlignment = Telerik.Web.UI.GridExcelBuilder.HorizontalAlignmentType.Center;

 

e.Styles.Add(myStyleH);

 

 

 }

My question is:I need colored each letter of "NYC" in different color:
letter "N" in green color
letter "Y" in orange color
letter "C" in blue color
And it should by on the same line.

Thanks so much for your help.

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 24 Sep 2012, 07:18 AM
Hi Vitaly,

I am afraid the requested feature is not achievable with Export to ExcelML.

I suggest that we continue our conversation on the following thread to enable other users with similar issues to track  the discussion more easily
http://www.telerik.com/community/forums/aspnet-ajax/general-discussions/export-radgrid-to-excel.aspx

Regards,
Eyup
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
General Discussions
Asked by
Vitaly
Top achievements
Rank 1
Iron
Iron
Answers by
Eyup
Telerik team
Share this question
or