Page 1 of 1

ExportingEvent works only in the designer

Posted: Wed Sep 28, 2016 3:11 pm
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

Re: ExportingEvent works only in the designer

Posted: Thu Sep 29, 2016 8:43 pm
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.

Re: ExportingEvent works only in the designer

Posted: Fri Sep 30, 2016 6:54 am
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

Re: ExportingEvent works only in the designer

Posted: Fri Sep 30, 2016 2:56 pm
by Alex K.
Hello,

In this case, you should use the following code:

Code: Select all

report.CompiledReport.ExportDocument(...);
Thank you.

Re: ExportingEvent works only in the designer

Posted: Tue Oct 04, 2016 8:27 am
by casic
Hello Aleksey,

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

Great,

Markus

Re: ExportingEvent works only in the designer

Posted: Tue Oct 04, 2016 12:55 pm
by Alex K.
Hello

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

Thank you.