Dear Developers,
Here's a code which exports a RadGridView:
```
private void grid1_ElementExported(object sender, GridViewElementExportedEventArgs e)
{
if (e.Element == ExportElement.Row)
{
GetData_Result obj = e.Context as GetData_Result;
if (obj != null)
{
e.Writer.Write(String.Format(@"<tr><td colspan=""{0}"">", grid1.Columns.Count));
// Here's row details for row being exported
e.Writer.Write("</td></tr>");
}
}
}
private void bExport_Click(object sender, RoutedEventArgs e)
{
SaveFileDialog dialog = new SaveFileDialog()
{
DefaultExt = extension,
Filter = String.Format("{1} files (*.{0})|*.{0}|All files (*.*)|*.*", "xls", "Excel"),
FilterIndex = 1
};
if (dialog.ShowDialog() == true)
{
using (Stream stream = dialog.OpenFile())
{
grid1.Export(stream,
new GridViewExportOptions()
{
Format = ExportFormat.Html, // Is it possible to use another format in this situation?
ShowColumnHeaders = true,
ShowColumnFooters = true,
ShowGroupFooters = false
});
}
Process.Start(new ProcessStartInfo(dialog.FileName));
}
}
```
RowDetails is a DataTemplate which is filled by a method below when "+" button is clicked.
```
private void grid1_RowDetailsVisibilityChanged(object sender, Telerik.Windows.Controls.GridView.GridViewRowDetailsEventArgs e)
{
if (e.Visibility != Visibility.Visible)
return;
GetDataD_Result data = e.Row.Item as GetDataD_Result;
dvm = new DetailsViewModel(data.Id);
e.DetailsElement.DataContext = dvm;
}
```
So, is possible to get an access to this DataTemplate of RwoDetails while exporting for each row?
Thank you!
Best regards