Export to Word - Index was outside the bounds of the array

4 posts, 0 answers
  1. Tom
    Tom avatar
    13 posts
    Member since:
    Jun 2013

    Posted 03 Feb 2015 Link to this post

    I have several reports within my application. I was having an issue with exporting to excel so we upgraded all the reports to Q2 2014.
    All the reports work fine in the development environment however once deployed to production, the export to word function throws this error:
    "Index was outside the bounds of the array"

    All other export functions perform as expected.
    I checked the deployed version of DocumentFormat.OpenXml.dll and it is the correct version (2.0.5022.0) as well as all of the Telerik modules.

    This error occurs on all deployment installs and can be reproduced at will.

    Has anyone else run into this?
  2. Stef
    Admin
    Stef avatar
    3610 posts

    Posted 04 Feb 2015 Link to this post

    Hello Tom,

    I believe this post is related to your support ticket #902255.
    Please let us continue the discussion there and we will update this forum thread at the end with our findings for anyone concerned.

    Regards,
    Stef
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. Tom
    Tom avatar
    13 posts
    Member since:
    Jun 2013

    Posted 19 Feb 2015 in reply to Stef Link to this post

    This appears to be the result of a textbox that has no dimensions attributed to it. I'm guessing that this was originally setup as a placeholder in an early release of the software I have been working on.

    Some things of note:
        This does not fail to export successfully in any other format other than MS Word (.Docx) format.
        This does not fail while running in the Visual Studio debugger (surprise!!!!)
        This does not fail in earlier releases.

    While a non-dimensioned textbox will not cause the export to fail in the above mentioned circumstances, you might want to test by executing straight from the /bin/release/ folder to verify hat you are not subjecting your clients to the same issue.

    Hope that helps somebody.
  4. Stef
    Admin
    Stef avatar
    3610 posts

    Posted 23 Feb 2015 Link to this post

    Hi,

    For anyone concerned, the scenario in the case is a report built at run-time, where TextBox items are added dynamically. With the specific reports settings and the TextBox items added with zero width and zero height dimensions the result was " System.IndexOutOfRangeException: Index was outside the bounds of the array." in Telerik.Reporting.OpenXmlRendering.Wordprocessing.

    The solution in the specific case was to set the TextBox items Size properties to valid values as the Report Designer would not allow adding items with Size(0,0).

    The recommended approach to validate the created at run-time report structure is to serialize the final report in TRDX file and check it with the Report Explorer of the Standalone Report Designer. Also creating sample structures with Visual Studio Report Designer is helpful to get familiar with items' structure and allows you to reuse the auto-generated code from the sample report's designer.cs(vb) file.

    Regards,
    Stef
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top