ExportingEvent works only in the designer

Stimulsoft Reports.NET discussion
Post Reply
casic
Posts: 68
Joined: Thu Jan 18, 2007 4:25 pm
Location: Germany

ExportingEvent works only in the designer

Post by casic »

Hi there,

I have created a report with some script in the ExportingEvent:

Code: Select all

ReportSummaryBand1.Enabled=True
SubReport1.Enabled=True
Me.Render(false)
The goal was to output additional information when exporting the report. This works excellent but only in the preview of the designer. In our application the same report is exported using the ExportDocument() method and then the script in the ExportingEvent is not executed. Is this a bug or I'm missing something?

Kind regards,

Markus
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: ExportingEvent works only in the designer

Post by Alex K. »

Hello,

Please try to use the same code before call the ExportDocument() method:

Code: Select all

...
StiReportSummaryBand reportSummaryBand = report.GetComponentByName("ReportSummaryBand1") as StiReportSummaryBand;
reportSummaryBand.Enabled = true;
report.Render();
report.ExportDocument()
Thank you.
casic
Posts: 68
Joined: Thu Jan 18, 2007 4:25 pm
Location: Germany

Re: ExportingEvent works only in the designer

Post by casic »

Hello Aleksey,

thank you very much for your reply. Your solution works of course but it is hard coded and so not usable for me. The goal is to have the ability inside a report to change the visibility of some components when exporting - similar the Printable-property. The problem with the Printable-property is, that the calculated space remains - in my case a whole blank page. So I tried the ExportingEvent to show some hidden components and re-render the report which works perfectly in the preview of the designer but not when using the ExportDocument() method. Where is the difference between the exporting from the preview of the report designer and using the ExportDocument() method?

Kind regards,

Markus
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: ExportingEvent works only in the designer

Post by Alex K. »

Hello,

In this case, you should use the following code:

Code: Select all

report.CompiledReport.ExportDocument(...);
Thank you.
casic
Posts: 68
Joined: Thu Jan 18, 2007 4:25 pm
Location: Germany

Re: ExportingEvent works only in the designer

Post by casic »

Hello Aleksey,

thank you very much for your hint - with CompiledReport.ExportDocument() it work's! :-)

Great,

Markus
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: ExportingEvent works only in the designer

Post by Alex K. »

Hello

We are always glad to help you!
Let us know if you need any additional help.

Thank you.
Post Reply