This is a migrated thread and some comments may be shown as answers.

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

3 Answers 381 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tom
Top achievements
Rank 1
Tom asked on 03 Feb 2015, 04:32 PM
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?

3 Answers, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 04 Feb 2015, 01:33 PM
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.

 
0
Tom
Top achievements
Rank 1
answered on 19 Feb 2015, 08:04 PM
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.
0
Stef
Telerik team
answered on 23 Feb 2015, 11:34 AM
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.

 
Tags
General Discussions
Asked by
Tom
Top achievements
Rank 1
Answers by
Stef
Telerik team
Tom
Top achievements
Rank 1
Share this question
or