Hi
When I try to export a grid with 42 columns (grid.DisplayLayout.Bands[0].Columns.Count == 42) i obtain this exception:
System.ArgumentOutOfRangeException
256 is not a valid column index in the current format. The value must be between 0 and 255.Nome parametro: columnIndexValore effettivo: 256.
Where can be the problem?
Thank in advance
This is the code with which I export the grid:
var ultraGridExcelExporter1 = new UltraGridExcelExporter(components); ultraGridExcelExporter1.Export(grid, pathTempFile); ultraGridExcelExporter1.Dispose();
Hi,
Excel 2003 and earlier has a limit of 256 columns in a worksheet. So something about your export must be exceeding that limitation. You say you have only 42 columns in your grid, so it must be something else.
Can you post the call stack of the exception so I can see what's happening when it occurs? It could be that your layout is causing those 42 grid column to be exported as more than 42 columns in Excel due to indention, hierarchical data, or using a RowLayout.
Or, it's possible that formulas or ValueList are causing the exporter to use a hidden worksheet which is exceeding the limit.
Also not that Excel2007 and up doesn't have the same limitation. So exporting to the newer format might be an option.
Thank for your reply
This is the stack exception stack:
in Infragistics.Documents.Excel.Utilities.VerifyColumnIndex(Worksheet worksheet, Int32 index, String paramName) in Infragistics.Documents.Excel.WorksheetRow.SetCellValue(Int32 columnIndex, Object value) in Infragistics.Win.UltraWinGrid.ExcelExport.ValueListExporting.ValueListManager.BuildListDataValidationRule(IValueList valueList) in Infragistics.Win.UltraWinGrid.ExcelExport.ValueListExporting.ValueListManager.GetListDataValidationRule(IValueList valueList) in Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter.ExportValueList(UltraGridColumn ugColumn, UltraGridRow row, WorksheetCell worksheetCell) in Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter.WriteValueCell(UltraGridExporterHelper exportHelper, UltraGridRow row, UltraGridColumn ugColumn, Rectangle valueCellRect) in Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter.ExportRowValuesCells(UltraGridExporterHelper exportHelper, UltraGridRow row) in Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter.WriteSingleRow(UltraGridExporterHelper exportHelper, UltraGridRow row) in Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter.ProcessSingleRow(UltraGridExporterHelper exportHelper, UltraGridRow row) in Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter.ProcessGridRowInternal(UltraGridExporterHelper exportHelper, UltraGridRow row, ProcessRowParams processRowParams) in Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExporterHelper.ProcessRow(UltraGridRow row, ProcessRowParams processRowParams) in Infragistics.Win.UltraWinGrid.RowsCollection.InternalTraverseRowsHelper(IUltraGridExporter exporter) in Infragistics.Win.UltraWinGrid.UltraGrid.Export(IUltraGridExporter exporter) in Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter.ExportHelper(UltraGrid grid, Worksheet worksheet, Int32 startRow, Int32 startColumn, Boolean asynch) in Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter.Export(UltraGrid grid, WorkbookFormat workbookFormat) in Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter.Export(UltraGrid grid, String fileName) in Gipasoft.Windows.Forms.Templates.MainStandardForm.esportaGridExcel() in c:\Progetti\Sfera\Client\Gipasoft.Sfera.WCFClient\Gipasoft.Windows.Forms.Templates\MainStandardForm.cs:riga 911
Hello,
This issue has been resolved in the latest available Service Releases as of the date of this post for Infragistics for Windows Forms 2014 Volume 1 and 2014 Volume 2.
To download the service release, log in to ‘Account’ and select ‘Keys & Downloads’. Select the appropriate tab for this product; then the license key. The available service releases (Hot Fixes) should now be listed on the page.
Please let me know if I may be of further assistance.
I have created support case CAS-144164-G7Q0V5 to track this issue. You can view this case at the following URL. I will update this thread when I have more information for you.
https://es.infragistics.com/my-account/support-activity
Please let me know if you have any other questions about this.
Okay, so this is blowing up while exporting the contents of the ValueLists into a hidden worksheet. That explains it. Your grid must have more than 256 different ValueLists in it.
This is a known bug and it will be fixed in the next service release. The exporter will create additional hidden worksheets when it needs them.
But you might want to think about reducing the number of ValueLists you are using. Why do you need so many? You should probably try to re-use the same one for multiple cells instead of assigning a new one to each cell (which is what I assume you must be doing to have created so many).
Another potential workaround is to set ExportValueLists to false on the exporter.