Hi Dess,
Thanks for responding so quickly. Your sample project seems to work fine, but when I add in the two additional lines required in my code base the export still fails.
Two lines of code from your sample that I added into my project:
spreadExporter.ExportViewDefinition = True
spreadExporter.ExportGroupedColumns = True
For your knowledge, I had tried this prior to posting yesterday and it didn't work. I then looked at the help article that you posted, and it didn't indicate that I was missing something. Hence, my initial post about this.
Moving on... when I try to run the export, this line of code fails:
spreadExporter.RunExport(.FileName, exportRenderer)
This is the error generated:
System.ArgumentOutOfRangeException was unhandled by user code
HResult=-2146233086
Message=Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
ParamName=index
Source=mscorlib
StackTrace:
at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
at System.Collections.Generic.List`1.get_Item(Int32 index)
at Telerik.WinControls.Export.GridViewSpreadExport.ProcessGroup(ColumnGroupRowLayout columnGroupRowLayout, GridViewColumnGroup group, GroupNode node)
at Telerik.WinControls.Export.GridViewSpreadExport.CreateRowSpanCells(ColumnGroupRowLayout columnGroupRowLayout)
at Telerik.WinControls.Export.GridViewSpreadExport.AddViewDefinitionRow(GridViewRowInfo gridViewRowInfo, TableViewRowLayoutBase rowLayout, Int32 rowIndex)
at Telerik.WinControls.Export.GridViewSpreadExport.ProcessRows(ExportGridTraverser traverser, TableViewRowLayoutBase rowLayout, Int32 currentRowNum)
at Telerik.WinControls.Export.GridViewSpreadExport.ExportToStream(Stream stream)
at Telerik.WinControls.Export.GridViewSpreadExport.RunExportCall(String fileName)
at Telerik.WinControls.Export.GridViewSpreadExport.RunExport(String fileName, ISpreadExportRenderer exportRenderer)
at ******.Utilities.TelerikExportGridToExcel(RadGridView spread, String fileName, String sheetName) in ...
Does that help? Am I missing something in the code that creates the viewDefinition? The grid appears correctly. I have attached a screenshot for reference.
Any help would be appreciated.
Thanks,
Kent