This question is locked. New answers and comments are not allowed.
There is an inconsistency in how the ToExcel handles binding errors versus how the toCSV and ToHTML handle them.
If you enter a UniqueName for a Grid Column, but it does not map to a field on the data source, this code works:
content = grid.ToHtml(true );
content = grid.ToCsv(true );
This code does not:
content = grid.ToExcelML(
true );
After digging a little deeper, I manually entered the code that was passing
--> content = grid.ToHtml(true );
and I saw in the output window that before the content, there is a notification for each row that had a binding error.
System.Windows.Data Error: BindingExpression path error: 'XXX' property not found on XXX
The ExcelML code simply throws an unhandled exception.
========================================================
{System.NullReferenceException: Object reference not set to an instance of an object.
at Telerik.Windows.Data.TypeExtensions.IsNullableType(Type type)
at Telerik.Windows.Data.TypeExtensions.GetNonNullableType(Type type)
at Telerik.Windows.Data.TypeExtensions.GetNumericTypeKind(Type type)
at Telerik.Windows.Data.TypeExtensions.IsNumericType(Type type)
at Telerik.Windows.Controls.ExportExtensions.GetExcelMLType(Type type)
at Telerik.Windows.Controls.ExportExtensions.GetRowValues(GridViewDataControl source, IList`1 records, StringBuilder& builder, ExportFormat format)
at Telerik.Windows.Controls.ExportExtensions.ToExcelML(GridViewDataControl source, IList`1 records, Boolean includeHeader)
at Telerik.Windows.Controls.ExportExtensions.ToExcelML(GridViewDataControl source, Boolean includeHeader)
at MyApp.Silverlight.MainPage.ExportGridDataButton_Click(Object sender, RoutedEventArgs e)}
========================================================
This may be the same issue the person reported about ExcelML here:
http://www.telerik.com/community/forums/silverlight/gridview/toexcelml-null-reference.aspx
Thanks,
Ryan Morgan
www.ArrowDesigns.com
