Hi ,
Am using a RadGridview control to populate my data and using the ElementExporting event to customize the data while exporting to Excel.
My customization need goes like, I want to add some metadata(some info the grid like report name, date generated, owner etc , at the top A1 cell ) to the grid data that is getting exporting . beneat that my actual grid data should be shown, and it should be sorted as my need.
I could able to append the metadata using the
grdRiskClarityReport.Export(stream,
new GridViewExportOptions()
{
Format=
ExportFormat.Html,
ShowColumnHeaders =
true,
ShowColumnFooters =
true,
ShowGroupFooters =
false,
});
and my event goes like this,
private void grdRiskClarityReport_ElementExported(object sender, GridViewElementExportedEventArgs e)
{
if (e.Element == ExportElement.HeaderCell && temp== 0)
{
// if (obj != null)
{
e.Writer.Write(
String.Format(@"<tr><td style=""background-color:#CCC;"" colspan=""{0}"">","dfdfd"));
e.Writer.Write(
String.Format(@"<b>Proposal Name:</b> {0} <br />", "dfdfd")); //need to input properdata
e.Writer.Write(
String.Format(@"<b>Proposal Status:</b> {0} <br />", "dfdfd"));
e.Writer.Write(
"</td></tr>");
temp = 1;
// using the restrict the metadata to the first cell
}
}
}
Could you please provide me a sample in wpf version that serves my need ?
Thanks in advance,
Srinivas J