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

styles not reflecting in ElementExporting event

3 Answers 55 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Prithvi
Top achievements
Rank 1
Prithvi asked on 14 Mar 2012, 10:45 AM
Hi,

when the ext is xml and format is ExportFormat.ExcelML, stlyes written in ElementExporting are not getting reflected in the Excel file.


public void rtlvForExport_ElementExporting(object sender, GridViewElementExportingEventArgs e)
{
if (e.Element == ExportElement.Cell
&& e.Value !=
null

 

&& e.Value.GetType() ==

 

this.SModel.RecordClassType)

 

{e.Value =

 

"";}
if (e.Element == ExportElement.HeaderCell)

 

{e.Background =

 

Colors.LightGray;

 

e.Foreground =

 

Colors.Black;

 

e.FontSize = 15;

e.FontWeight =

 

FontWeights.Bold;
}

 

 

 

else if ((e.Element == ExportElement.Cell) && (e.Value != null))

 

{e.TextAlignment =

 

TextAlignment.Center;

 

e.TextAlignment =

 

TextAlignment.Center; ;

 

e.VerticalAlignment =

 

VerticalAlignment.Center;
}

 

 

 

else if ((e.Element == ExportElement.Cell) && (e.Value.Equals("MANUFACTURED")))

 

{

e.Background =

 

Colors.Magenta;

 

e.Foreground =

 

Colors.Black;

 

}

}

3 Answers, 1 is accepted

Sort by
0
Prithvi
Top achievements
Rank 1
answered on 14 Mar 2012, 10:46 AM
Please help me ASAP

Thanks,
Prithvi
0
Dimitrina
Telerik team
answered on 14 Mar 2012, 04:08 PM
Hello,

 You should use the ExportFormat.Html to get the styles applied.

Kind regards,
Didie
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Gopinath
Top achievements
Rank 2
answered on 06 Dec 2012, 04:20 PM
thanks a lot it solved my problem too!!!
Tags
GridView
Asked by
Prithvi
Top achievements
Rank 1
Answers by
Prithvi
Top achievements
Rank 1
Dimitrina
Telerik team
Gopinath
Top achievements
Rank 2
Share this question
or