Hi,
I am getting an exception when using ExcelExport.UltraWebGridExcelExporter.Export and my grid has more than 256 columns. I know there is a limitation in prior versions of Excel, but is there support for XLSX format for Excel 2007 can support 2^16 columns instead of 2^8?
InvalidOperationException: The maximum number of columns in an excel worksheet is: 256] Infragistics.Excel.WorksheetColumnCollection.ThrowIndexOutOfRangeException(Int32 index) +114 Infragistics.Excel.WorksheetItemCollection`1.InternalIndexer(Int32 index) +26 Infragistics.Excel.WorksheetColumnCollection.get_Item(Int32 index) +4 Infragistics.WebUI.UltraWebGrid.ExcelExport.ExportCell.SetColumnWidth(String cellContent) +52 Infragistics.WebUI.UltraWebGrid.ExcelExport.ExportCell.Export(UltraGridExporterHelper exportHelper, UltraGridRow row) +326 Infragistics.WebUI.UltraWebGrid.ExcelExport.ExportHeader.ExportColumnCells(UltraGridExporterHelper exportHelper, UltraGridRow row, UltraGridBand band, ExportCursor tempCursor) +531 Infragistics.WebUI.UltraWebGrid.ExcelExport.ExportHeader.ProcessRows(UltraGridExporterHelper exportHelper, UltraGridRow row, UltraGridBand band) +464 Infragistics.WebUI.UltraWebGrid.ExcelExport.ExcelExporterImpl.BeginExport(UltraGridLayout exportLayout, RowsCollection rows) +480 Infragistics.WebUI.UltraWebGrid.ExcelExport.UltraGridExporterHelper.Infragistics.WebUI.UltraWebGrid.IUltraGridExporter.BeginExport(UltraGridLayout exportLayout, RowsCollection rows) +20 Infragistics.WebUI.UltraWebGrid.UltraWebGrid.Export(IUltraGridExporter exporter) +44 Infragistics.WebUI.UltraWebGrid.ExcelExport.UltraWebGridExcelExporter.Export(UltraWebGrid grid, Worksheet worksheet, Int32 startRow, Int32 startColumn) +228 Infragistics.WebUI.UltraWebGrid.ExcelExport.UltraWebGridExcelExporter.Export(UltraWebGrid grid) +82 Infragistics.WebUI.UltraWebGrid.ExcelExport.UltraWebGridExcelExporter.Export(UltraWebGrid grid, String fileSpec) +5
regards,
Rajiv.
Rajiv,
The UltraGridExcelExporter doesn't support the Excel 2007 format yet. You do have a couple of options though. NetAdvatnage for WinForms got Excel 2007 support in the last release. You could use the Infragistics.Excel library from the Windows Forms install, the assembly is Infragistics3.Excel.v8.3.dll. The drawback to this approach is that you would have to manually loop through your grid to create the Excel spreadsheet, as the Exporter will not work with this newer assembly.
Your second option is to use the events that fire from the ExcelExporter and when you hit the 255'th column, change the active worksheet, which will cause the export to continue on the new worksheet.
Hope this helps,
-Tony
Hi Tony,
I am also facing the same problem. I understand what u said to rajiv. If possible, can u place the code here?
That will help me a lot. Because i am trying to fix this problem from 4 to 5 days. I am not able to finish it.
Regards,
Vallamreddy VenuGopal
Here's the easiest approach. Split your data up into two separate grids, one containing columns 0-255, and the second grid containing the remainder of the columns. Then use the Export method which takes an instance of a worksheet, to export the two grids into separate worksheets. There's more information on how to do that in this post - http://forums.infragistics.com/forums/t/19898.aspx