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
20
Error exporting document: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
posted

I have an Excel exporter and a document exporter.  The excel exporter works fine, the document exporter gives me the error below using version:

Infragistics35.WebUI.UltraWebGrid.v9.2, Version=9.2.20092.2183
Infragistics35.WebUI.UltraWebGrid.ExcelExport.v9.2, Version=9.2.20092.2183
Infragistics35.WebUI.UltraWebGrid.DocumentExport.v9.2, Version=9.2.20092.2183

ASPX

    <igtblexp:UltraWebGridExcelExporter ID="UltraWebGridExcelExporter1"
        runat="server" DownloadName="ReportExport.XLS">
    </igtblexp:UltraWebGridExcelExporter>
    <igtbldocexp:UltraWebGridDocumentExporter ID="UltraWebGridDocumentExporter1"
        runat="server" DownloadName="ReportExport.PDF" TargetPaperOrientation="Landscape">
    </igtbldocexp:UltraWebGridDocumentExporter>

Code Behind

    protected void btnExportExcel_Click(object sender, ImageClickEventArgs e)
    {
        UltraWebGridExcelExporter1.Export(this.UltraWebGrid1);
    }

// first try with just one line.  (This works fine in another project)

    protected void btnExportPDF_Click(object sender, ImageClickEventArgs e)
    {
        UltraWebGridDocumentExporter1.Export(this.UltraWebGrid1);
    }

// what I have currently

    protected void btnExportPDF_Click(object sender, ImageClickEventArgs e)
    {
        UltraWebGridDocumentExporter1.ExportMode = Infragistics.WebUI.UltraWebGrid.Exporter.ExportMode.InBrowser;
        UltraWebGridDocumentExporter1.DataExportMode = Infragistics.WebUI.UltraWebGrid.DocumentExport.DataExportMode.DataInGridOnly;
        UltraWebGridDocumentExporter1.Format = Infragistics.Documents.Report.FileFormat.PDF;
        UltraWebGridDocumentExporter1.Export(this.UltraWebGrid1);
    }

 

Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

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.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index]
   System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource) +64
   System.ThrowHelper.ThrowArgumentOutOfRangeException() +15
   System.Collections.Generic.List`1.RemoveAt(Int32 index) +7498328
   Infragistics.Documents.Report.Text.Text.ComposeBody(TextComposition body, IGraphics graphics, UnitCollection units, FrameCollection frames, Indents indents, Tabs tabs, Single interval, Marker marker, Boolean flush) +4072
   Infragistics.Documents.Report.Text.Text.Measure(Composition composition, IGraphics graphics, MeasureMode mode) +3741
   Infragistics.Documents.Report.Table.TableCell.Measure(Composition composition, IGraphics graphics, MeasureMode mode) +1609
   Infragistics.Documents.Report.Table.TableRow.Measure(Composition composition, IGraphics graphics, MeasureMode mode) +2711
   Infragistics.Documents.Report.Table.Table.Measure(Composition composition, IGraphics graphics, MeasureMode mode) +8591
   Infragistics.Documents.Report.Section.Section.Measure(Projection projection, IGraphics graphics) +2737
   Infragistics.Documents.Report.Report.Measure() +956
   Infragistics.Documents.Report.Report.Publish(Stream stream, FileFormat format) +2875
   Infragistics.WebUI.UltraWebGrid.DocumentExport.UltraWebGridDocumentExporter.RenderDocumentToResponse(HtmlTextWriter writer, Control control) +437
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +256
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
   System.Web.UI.Page.Render(HtmlTextWriter writer) +29
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1266


Version Information: Microsoft .NET Framework Version:2.0.50727.3620; ASP.NET Version:2.0.50727.3618