Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
225
Exception when exporting a grid with more than 256 columns
posted

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.

Parents
  • 19308
    posted

    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

Reply Children