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
5368
Simple WebExcelExporter failing... error is internal
posted

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>

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.Click
Line 366:        WebExcelExporter1.Export(WebDataGrid1)
Line 367:    End Sub
Line 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

Parents
  • 5368
    Offline posted

    Two additional notes.

    • The error is specific to only one data list.  All other lists export without error (though none are as large as this list).
    • I wanted to rule out that something in the data was causing the error, so I did the following
      • I turned on Paging, and set page size to 1000
      • I turned off Virtual Scrolling
      • I set the DataExportMode data mode to "DataInGridOnly"
      • This results in 7 pages of data. 
        • I went through each page, and exported it to Excel.  Every page exported successfully.
      • I changed the DataExportMode back to "AllDataInDataSource". 
        • I tried the export again, and the export failed with the above error.

    Theoretically, the above process would rule out that anything with the data was causing the error.  However... on a whim...

    • I set the page size to 2000, resulting in 4 pages of data.
    • I set the DataExportMode data mode to "DataInGridOnly"
    • I ran the export on each of the 4 pages.
      • The export fails consistently when exporting the first page
      • The export succeeds consistently when exporting pages 2-4.

    Ok... so we have discovered that page size impacts the error, but not on all pages... So, I tried some different page sizes, and here is what I discovered:

    • If I set the page size to any value <=1216, then all pages export consistently.
    • If the page size is set to any value >=1217, then the first page fails to export consistently with the above error.
    • The error never occurs with any other list of data, no matter what the page size or DataExportMode are set to.

    So, this begs the question... What is the data in rows 1215-1220?

    Here is a screenshot:

     Looking at the raw data from SQL, there is nothing unique about these rows.  The empty values in the columns to the right are nulls.  There are two hidden columns, but both of those columns have only nulls or empty strings in them.

     

Reply Children