What to use instead of UseExternalReport

Stimulsoft Ultimate discussion
Post Reply
User avatar
tpontow
Posts: 206
Joined: Thu Sep 06, 2012 8:46 am
Location: Bonn, Germany

What to use instead of UseExternalReport

Post by tpontow »

Hello,

i have reports dynamically created in C# code. In there i also create subreport controls and link them to pages in the report where the subreport is build. So no subreport from external file is used. Everything works fine until i now upgraded to version 2014.2. I saw that the use of

Code: Select all

StiSubReport.UseExternalReport() 
is obsolete. In code i saw that is set fix to false.

So since 2014.2 the rendering process always tries to load my internal subreport from external files instead from the internal pages.

Any suggestions what i have to change in my code? How can i get the rendering process to use my internal subreport now?

Thanks and kind regards
Thorsten Pontow
Thorsten Pontow

It is easier to write an incorrect program than to understand a correct one. (Alan J. Perlis, Epigrams in programming No. 7)
User avatar
tpontow
Posts: 206
Joined: Thu Sep 06, 2012 8:46 am
Location: Bonn, Germany

Re: What to use instead of UseExternalReport

Post by tpontow »

Ok, i found out that there is a new method

Code: Select all

StiSubReport.GetExternalSubReport() 
which is called everytime. In my own StiReport-Subclass i have overwritten the following method which i calles then:

Code: Select all

protected override void OnGetSubReport(StiGetSubReportEventArgs e)
In that method i try to load from a file. but that is not what i want if have an internal subreport only. So how can i supress the call of GetExternalSubReport()? UseExternalReport-Flag is not used anymore unfortunately.
Thorsten Pontow

It is easier to write an incorrect program than to understand a correct one. (Alan J. Perlis, Epigrams in programming No. 7)
User avatar
tpontow
Posts: 206
Joined: Thu Sep 06, 2012 8:46 am
Location: Bonn, Germany

Re: What to use instead of UseExternalReport

Post by tpontow »

I found a solution or at least a workaround for my problem. In my specialized StiReport subclass for my code generated report i overwrote method

Code: Select all

OnGetSubReport()
with empty body. With that it masks the OnGetSubReport() method in my own base StiReport-subclass which tries to load subreport from file. That's not the nicest solution but it is a solution for me now :)
Thorsten Pontow

It is easier to write an incorrect program than to understand a correct one. (Alan J. Perlis, Epigrams in programming No. 7)
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: What to use instead of UseExternalReport

Post by HighAley »

Hello.

Why did you use UseExternalReport() while you don't use external sub-report?
You shouldn't subscribe on GetSubReport event.
Could you specify how do you create sub-reports?

Thank you.
User avatar
tpontow
Posts: 206
Joined: Thu Sep 06, 2012 8:46 am
Location: Bonn, Germany

Re: What to use instead of UseExternalReport

Post by tpontow »

Hello Aleksey,

the core of my problem simply was that in earlier versions of Stimulsoft.StiReport the GetSubReport event was fired only if there was a subreport component with no own report page but with external mrt-file. And now that event fires also for an internal subreport with own page.

I needed to override OnGetSubReport() because i don't open a file directly but load the subreport with memory stream from a database or some own business objects.

I now solved the problem by checking myself for internal subreports (with own page and no external mrt-file) and then leave the OnGetSubReport() method.

Kind regards
Thorsten Pontow
Thorsten Pontow

It is easier to write an incorrect program than to understand a correct one. (Alan J. Perlis, Epigrams in programming No. 7)
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: What to use instead of UseExternalReport

Post by HighAley »

Hello, Thorsten.

Thank you for the description. We will check this issue.
Let us know if you need any additional help.

Thank you.
Post Reply