ResponseAsExcel2007 throws StackoverflowException

Stimulsoft Reports.WEB discussion
Post Reply
martinxmueller
Posts: 8
Joined: Fri Oct 26, 2012 10:12 am

ResponseAsExcel2007 throws StackoverflowException

Post by martinxmueller »

Hallo,
i have a report that contains a StiGroupHeaderBand with a large amount of components of type StiText. The report has more than 150 columns and about 900 StiText instances within the StiGroupHeaderBand. (The header has 6 lines.)

Calling the method StiReportResponse.ResponseAsExcel2007(this, stimulReport, mysettings) causes a StackoverflowException.
Is there any other possibility to create a header with such a large number of lines and columns ?

Best regards

Martin
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: ResponseAsExcel2007 throws StackoverflowException

Post by HighAley »

Hello.

Please, send us your report template with data to reproduce the issue and we'll try to optimize our product.

Thank you.
martinxmueller
Posts: 8
Joined: Fri Oct 26, 2012 10:12 am

Re: ResponseAsExcel2007 throws StackoverflowException

Post by martinxmueller »

I generate the columns dynamically in C#.
I have a small template (myreport.mrt), designed with Stimul Reportdesigner.
At runtime, the expected number of columns is calculated.
In our WebApplication, running with IIS 7, columns are generated in the following manner:

CreateReport(..)
{
var HeaderDT = _reportdata.Tables["ZuKoMatrixHeadline"]; // _reportdata is our Reportdataset
var zukomatrixDT = _reportdata.Tables["ZuKoMatrix"];

stimulReport = new StiReport();
byte[] reportLayout = reportingService.GetLayout(_reportDef.Id); // myreport.mrt
stimulReport.Load(reportLayout);

stimulReport.RegData(_reportdata);
stimulReport.Dictionary.Synchronize();

var stiReportPage = stimulReport.Pages[0];
var stiGroupHeaderBand = stiReportPage.Components["GroupHeader0"] as StiGroupHeaderBand;
string DataField = "";

:
// know we create header columns for 6 rows
// row 1
StiText HeaderTextMaster;
HeaderTextMaster = stiGroupHeaderBand.Components["Header_T_1_7"] as StiText;
pageWidth = CreateHeaderLine(HeaderDT, 0, stiGroupHeaderBand, HeaderTextMaster, "T_", "D_", pageWidth);
stiReportPage.Width = pageWidth;

:
// row 6
HeaderTextMaster = stiGroupHeaderBand.Components["Header_T_6_7"] as StiText;
CreateHeaderLine(HeaderDT, 5, stiGroupHeaderBand, HeaderTextMaster, "T_", "D_", 0);
}

int CreateHeaderLine(DataTable headerTable, int ht_rix, StiGroupHeaderBand stiGroupHeaderBand, ...)
{
// here we create and add StiText instances in a loop
for (int c = 0; c < headerTable.Columns.Count; c++)
{
StiText DataText = ... create a new instance that shows a value from the header datatable
data expression is something like that:
"{ MatrixHeadline.DataTable.Rows[" + ht_rix + "][\"" + colname + "\"]";

// ... make a special border

// ... add StiText to HeaderBand
stiGroupHeaderBand.Components.Add(DataText);
pageWidth = pageWidth + DataText.Width;
}
return pageWidth;
}
}

.. later on, the IIS worker process stops with StackOverflowException when
StiReportResponse.ResponseAsExcel2007(this, stimulReport, ..)
is called.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: ResponseAsExcel2007 throws StackoverflowException

Post by HighAley »

Hello.

Is the report being shown in Viewer? If there is any error then try to enable caching.

If the error is on export only then try to set next option:

Code: Select all

StiOptions.Export.UseCacheModeForStiMatrix = true
This mode is in development now but there are already several improvements.

Thank you.
martinxmueller
Posts: 8
Joined: Fri Oct 26, 2012 10:12 am

Re: ResponseAsExcel2007 throws StackoverflowException

Post by martinxmueller »

Hello,

unfortunately, the flag StiOptions.Export.UseCacheModeForStiMatrix does not exist in our version (StimulsoftReports.Net_2012.2).
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: ResponseAsExcel2007 throws StackoverflowException

Post by HighAley »

Hello.

This option was added in our last prerelease build. Please, check it.

Thank you.
martinxmueller
Posts: 8
Joined: Fri Oct 26, 2012 10:12 am

Re: ResponseAsExcel2007 throws StackoverflowException

Post by martinxmueller »

Hello,

as workaround for our problem, i reduced the number of header rows. That does not look nice, but it works.
The compilation of the dynamically created report is slowly. When i look in the profiler result, i see that searching in large lists for a certain object needs a lot of time. Probably, if you would use dictionaries instead of lists the runtime behaviour would be better.
Our report example:
In ExportExcel -> WriteSheet the method GetXFNumber() is called 122408 times. The method searches in a ArrayList for a certain object, that causes 16360241 calls of the Equals() method. That's eating the most of runtime. If it would be possible to use a dictionary (map) instead of a list, the needed time for finding an object would only be a fraction.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: ResponseAsExcel2007 throws StackoverflowException

Post by HighAley »

Hello.

We are constantly working on the optimization of our products.

Thank you.
Post Reply