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
Yes. In Excel 97-2003, the limit on the number of rows was 2^16, or 65,536. In Excel 2007 and later, the limit is 2^20, or 1,048,576 rows.
Thank you both very much... looking forward to the next service release!
Also, what is the upper limit of rows that WebExcelExporter can export into a worksheet? Does the excel file version affect this count?
Thanks, - Rob
Hello Rob,
I created a support ticket on your behalf regarding this
CAS-69557-KNGGCK
I will link it to the development issue in order to be notified when the Service release is available.
This issue has already been reported and fixed (bug id 82020) on 7/21/11. The bug fix will be available in the next SR.
Hi Rob,
I wonder if this a problem with the exporter or the Excel Engine. From the stack trace, it may be the latter. I have two requests. Is it possible to filter out the data so that just those rows in question are in the grid? Then try to export them. And if those are the trouble rows, the only way we may be able to debug this issue is if we can get to reproduce it over here. If you can get code to create identical data in a DataTable per say and the issue persists, that would be awesome if you could get that to use. Or even a small website with just that data. Let me know.
regards,David Young