When I export a WebDataGrid that contains only a couple of thousand records, the export works fine. The export works for most lists. However, this particular set of data that I am trying to export has 6000 records, and results in an error traced to somewhere internal to the WebExcelExporter
The WebDataGrid is visible on the page, being populated in Page_Load by a dataset that is maintained in session cache. Both elements are next to each other in the DOM, within the same WebSplitterPane which is within an UpdatePanel.
I am using version 11.1.
Here are the definitions:
<ig:WebExcelExporter ID="WebExcelExporter1" runat="server" DownloadName="StreetList" DataExportMode="AllDataInDataSource"> </ig:WebExcelExporter> <ig:WebDataGrid ID="WebDataGrid1" runat="server" Visible="False" StyleSetName="IG" AutoGenerateColumns="False" Width="100%" Height="100%"> <Columns> <ig:BoundDataField DataFieldName="RouteNo" DataType="System.String" Key="RouteNo"> <Header Text="Route" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="StNum" DataType="System.String" Key="StNum"> <Header Text="StNum" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="StName" DataType="System.String" Key="StName"> <Header Text="StName" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Apt#" DataType="System.String" Key="Apt#"> <Header Text="Unit" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Zip" DataType="System.String" Key="Zip"> <Header Text="Zip" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Pub" DataType="System.String" Key="Pub"> <Header Text="Pub" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Freq" DataType="System.String" Key="Freq"> <Header Text="Freq" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Qty" DataType="System.String" Key="Qty"> <Header Text="Qty" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Vacation" DataType="System.String" Key="Vacation"> <Header Text="Vacation" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="RouteCardComment1" DataType="System.String" Key="RouteCardComment1"> <Header Text="RouteCardComment1" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="RouteCardComment2" DataType="System.String" Key="RouteCardComment2"> <Header Text="RouteCardComment2" /> </ig:BoundDataField> </Columns> <Behaviors> <ig:Filtering> </ig:Filtering> <ig:VirtualScrolling> </ig:VirtualScrolling> </Behaviors> </ig:WebDataGrid>
<ig:WebDataGrid ID="WebDataGrid1" runat="server" Visible="False" StyleSetName="IG" AutoGenerateColumns="False" Width="100%" Height="100%"> <Columns> <ig:BoundDataField DataFieldName="RouteNo" DataType="System.String" Key="RouteNo"> <Header Text="Route" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="StNum" DataType="System.String" Key="StNum"> <Header Text="StNum" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="StName" DataType="System.String" Key="StName"> <Header Text="StName" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Apt#" DataType="System.String" Key="Apt#"> <Header Text="Unit" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Zip" DataType="System.String" Key="Zip"> <Header Text="Zip" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Pub" DataType="System.String" Key="Pub"> <Header Text="Pub" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Freq" DataType="System.String" Key="Freq"> <Header Text="Freq" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Qty" DataType="System.String" Key="Qty"> <Header Text="Qty" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="Vacation" DataType="System.String" Key="Vacation"> <Header Text="Vacation" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="RouteCardComment1" DataType="System.String" Key="RouteCardComment1"> <Header Text="RouteCardComment1" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="RouteCardComment2" DataType="System.String" Key="RouteCardComment2"> <Header Text="RouteCardComment2" /> </ig:BoundDataField> </Columns> <Behaviors> <ig:Filtering> </ig:Filtering> <ig:VirtualScrolling> </ig:VirtualScrolling> </Behaviors> </ig:WebDataGrid>
Here is the VB.Net codebehind for the export:
Protected Sub btnExporttoExcel_Click(sender As Object, e As System.EventArgs) Handles btnExporttoExcel.Click WebExcelExporter1.Export(WebDataGrid1) End Sub
Here is the error:
Server Error in '/TESTACISEATTLE' Application.-------------------------------------------------------------------------------- Index was outside the bounds of the array. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.IndexOutOfRangeException: Index was outside the bounds of the array. Source Error: Line 364:Line 365: Protected Sub btnExporttoExcel_Click(sender As Object, e As System.EventArgs) Handles btnExporttoExcel.ClickLine 366: WebExcelExporter1.Export(WebDataGrid1)Line 367: End SubLine 368:End Class Source File: D:\Webfolders\mydistrict.net_dev\ReportStreetList.aspx.vb Line: 366 Stack Trace: [IndexOutOfRangeException: Index was outside the bounds of the array.] Infragistics.Documents.Excel.GenericElementHashSet`1.IncreaseCapacity() +546 Infragistics.Documents.Excel.GenericElementHashSet`1.AddIfItemDoesntExist(T element, T& existingElement) +459 Infragistics.Documents.Excel.GenericCachedCollection`1.FindOrAdd(T element, T& equivalentElement) +24 Infragistics.Documents.Excel.GenericCacheElement.FindExistingOrAddToCache(T newElement, GenericCachedCollection`1 collection) +104 Infragistics.Documents.Excel.WorksheetCellBlock.SetCellValueInternalHelper(WorksheetRow row, Int16 columnIndex, Object valueInternal, DataType& type, CellValue& cellValue) +229 Infragistics.Documents.Excel.WorksheetCellBlock.SetCellValueInternal(WorksheetRow row, Int16 columnIndex, Object newValueInternal, Boolean checkForBlockingValues) +316 Infragistics.Documents.Excel.WorksheetRow.SetCellValueInternal(Int16 columnIndex, Object valueInternal, Boolean checkForBlockingValues) +82 Infragistics.Documents.Excel.WorksheetRow.SetCellValue(Int32 columnIndex, Object value) +51 Infragistics.Web.UI.GridControls.WebExcelExporter.ExportCell(GridRecordItem item, WorksheetRow worksheetRow, Int32 rowIndex, Int32 columnIndex, String gridCssClass, String itemCssClass) +622 Infragistics.Web.UI.GridControls.WebExcelExporter.ExportRow(GridRecord gridRecord, Worksheet worksheet, Int32& rowIndex, Int32 columnOffset, Boolean hasHiddenCols, Int32 outlineLevel, Boolean hidden, String gridCssClass, String itemCssClass) +503 Infragistics.Web.UI.GridControls.WebExcelExporter.ExportGrid(WebDataGrid grid, Worksheet worksheet, Int32& rowIndex, Int32 columnOffset, Int32 outlineLevel) +2088 Infragistics.Web.UI.GridControls.WebExcelExporter.Export(WebDataGrid grid, Worksheet worksheet, Int32 rowOffset, Int32 columnOffset) +136 Infragistics.Web.UI.GridControls.WebExcelExporter.Export(WebDataGrid grid, Worksheet worksheet) +17 Infragistics.Web.UI.GridControls.WebExcelExporter.Export(WebDataGrid grid, Workbook workbook) +125 Infragistics.Web.UI.GridControls.WebExcelExporter.Export(WebDataGrid grid) +47 ReportStreetList.btnExporttoExcel_Click(Object sender, EventArgs e) in D:\Webfolders\mydistrict.net_dev\ReportStreetList.aspx.vb:366 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563 --------------------------------------------------------------------------------Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319
Index was outside the bounds of the array. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IndexOutOfRangeException: Index was outside the bounds of the array.
Source Error:
Line 364:Line 365: Protected Sub btnExporttoExcel_Click(sender As Object, e As System.EventArgs) Handles btnExporttoExcel.ClickLine 366: WebExcelExporter1.Export(WebDataGrid1)Line 367: End SubLine 368:End Class
Source File: D:\Webfolders\mydistrict.net_dev\ReportStreetList.aspx.vb Line: 366
Stack Trace:
[IndexOutOfRangeException: Index was outside the bounds of the array.] Infragistics.Documents.Excel.GenericElementHashSet`1.IncreaseCapacity() +546 Infragistics.Documents.Excel.GenericElementHashSet`1.AddIfItemDoesntExist(T element, T& existingElement) +459 Infragistics.Documents.Excel.GenericCachedCollection`1.FindOrAdd(T element, T& equivalentElement) +24 Infragistics.Documents.Excel.GenericCacheElement.FindExistingOrAddToCache(T newElement, GenericCachedCollection`1 collection) +104 Infragistics.Documents.Excel.WorksheetCellBlock.SetCellValueInternalHelper(WorksheetRow row, Int16 columnIndex, Object valueInternal, DataType& type, CellValue& cellValue) +229 Infragistics.Documents.Excel.WorksheetCellBlock.SetCellValueInternal(WorksheetRow row, Int16 columnIndex, Object newValueInternal, Boolean checkForBlockingValues) +316 Infragistics.Documents.Excel.WorksheetRow.SetCellValueInternal(Int16 columnIndex, Object valueInternal, Boolean checkForBlockingValues) +82 Infragistics.Documents.Excel.WorksheetRow.SetCellValue(Int32 columnIndex, Object value) +51 Infragistics.Web.UI.GridControls.WebExcelExporter.ExportCell(GridRecordItem item, WorksheetRow worksheetRow, Int32 rowIndex, Int32 columnIndex, String gridCssClass, String itemCssClass) +622 Infragistics.Web.UI.GridControls.WebExcelExporter.ExportRow(GridRecord gridRecord, Worksheet worksheet, Int32& rowIndex, Int32 columnOffset, Boolean hasHiddenCols, Int32 outlineLevel, Boolean hidden, String gridCssClass, String itemCssClass) +503 Infragistics.Web.UI.GridControls.WebExcelExporter.ExportGrid(WebDataGrid grid, Worksheet worksheet, Int32& rowIndex, Int32 columnOffset, Int32 outlineLevel) +2088 Infragistics.Web.UI.GridControls.WebExcelExporter.Export(WebDataGrid grid, Worksheet worksheet, Int32 rowOffset, Int32 columnOffset) +136 Infragistics.Web.UI.GridControls.WebExcelExporter.Export(WebDataGrid grid, Worksheet worksheet) +17 Infragistics.Web.UI.GridControls.WebExcelExporter.Export(WebDataGrid grid, Workbook workbook) +125 Infragistics.Web.UI.GridControls.WebExcelExporter.Export(WebDataGrid grid) +47 ReportStreetList.btnExporttoExcel_Click(Object sender, EventArgs e) in D:\Webfolders\mydistrict.net_dev\ReportStreetList.aspx.vb:366 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
--------------------------------------------------------------------------------Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319
Hello Team,
I am also getting the same exception in Windows version of the grid control. Here are the details.
Mike,
I'm having nearly the same issue with the Winforms version of the Excel exporter. Is it likely that this is the the same, and, if so, can I expect a fix in the next SR of the Winforms package as well?
Thanks in advance. Stack trace below:
at Infragistics.Documents.Excel.GenericElementHashSet`1.AddIfItemDoesntExist(T element, T& existingElement) at Infragistics.Documents.Excel.GenericCachedCollection`1.FindOrAdd(T element, T& equivalentElement) at Infragistics.Documents.Excel.GenericCacheElement.FindExistingOrAddToCache[T](T newElement, GenericCachedCollection`1 collection) at Infragistics.Documents.Excel.WorksheetCellBlock.SetCellValueInternalHelper(WorksheetRow row, Int16 columnIndex, Object valueInternal, DataType& type, CellValue& cellValue) at Infragistics.Documents.Excel.WorksheetCellBlock.SetCellValueInternal(WorksheetRow row, Int16 columnIndex, Object newValueInternal, Boolean checkForBlockingValues) at Infragistics.Documents.Excel.WorksheetRow.SetCellValueInternal(Int16 columnIndex, Object valueInternal, Boolean checkForBlockingValues) at Infragistics.Documents.Excel.WorksheetRow.SetCellValue(Int32 columnIndex, Object value) at Infragistics.Documents.Excel.WorksheetCell.set_Value(Object value) at Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter.SetRegionRelativeToOrigin(UltraGridExporterHelper exportHelper, Rectangle rect, Object val, IWorksheetCellFormat cellFormat) at Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter.WriteValueCell(UltraGridExporterHelper exportHelper, UltraGridRow row, UltraGridColumn ugColumn, Rectangle valueCellRect) at Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter.ExportRowValuesCells(UltraGridExporterHelper exportHelper, UltraGridRow row) at Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter.WriteSingleRow(UltraGridExporterHelper exportHelper, UltraGridRow row) at Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter.ProcessSingleRow(UltraGridExporterHelper exportHelper, UltraGridRow row) at Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter.ProcessGridRowInternal(UltraGridExporterHelper exportHelper, UltraGridRow row, ProcessRowParams processRowParams) at Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExporterHelper.ProcessRow(UltraGridRow row, ProcessRowParams processRowParams) at Infragistics.Win.UltraWinGrid.RowsCollection.InternalTraverseRowsHelper(IUltraGridExporter exporter) at Infragistics.Win.UltraWinGrid.UltraGrid.Export(IUltraGridExporter exporter) at Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter.Export(UltraGrid grid, Worksheet worksheet, Int32 startRow, Int32 startColumn) at CTEC.DR.v40.Framework.ExportTemplateControl.ExportGrid(Worksheet _gridWorksheet) in D:\Projects\DR4x\4.0\Development\Framework\Shared\Controls\ExportTemplateControl.vb:line 144
Thanks Dave,
We do have people who download large datasets, which I presently force to a delimited format.
It would be really great to provide Excel as an option, and was wondering if you guys had tested the limits of the WebExcelExporter before I put it out there as a supported feature.
It sounds like internal testing hasn't been done, and I'll have to do it on this side, which I don't mind doing.
Thanks!
-Rob
Hi Rob,
I've never tried to export a million rows myself with the WebExcelExporter. If the Excel file can have that much, I would think it should work so long as the WorkBook object fits in memory and the stream can be sent down to download. If you do not know how to set the excel 2007 mode, put this on the exporter in the aspx.
WorkbookFormat="Excel2007"
If you have trouble exporting a million rows, let us know. It could indicate a problem in the control or framework.
-Dave
Gotcha... I understand that these are the Excel limits.
I was just wondering if the WebExcelExporter has the same limits. WebExcelExporter will export a million rows in Excel 2007 mode?