TppImage not shown in subreport
I have a report with some TppImage components. The visibility of the images
is controlled by a "BeforeGenerate" event handler of the detail band
containing the images. That works fine while using the report standalone.
However, if I include the same report as a subreport into a
"container-report". - I do that using the
Report.Template.SaveToStream(myStream) /
subReport.Report.Template.LoadFromStream(myStream) approach - the images are
not shown. The "BeforeGenerate" event handler is still called, the
visibilty-flag is set correctly (as I can see in an OnPrint event handler of
the Image) but the image is not shown in the report. The other elements,
mostly of TppDBText type, are shown as expected.
I need your help,
Txs Peter
is controlled by a "BeforeGenerate" event handler of the detail band
containing the images. That works fine while using the report standalone.
However, if I include the same report as a subreport into a
"container-report". - I do that using the
Report.Template.SaveToStream(myStream) /
subReport.Report.Template.LoadFromStream(myStream) approach - the images are
not shown. The "BeforeGenerate" event handler is still called, the
visibilty-flag is set correctly (as I can see in an OnPrint event handler of
the Image) but the image is not shown in the report. The other elements,
mostly of TppDBText type, are shown as expected.
I need your help,
Txs Peter
This discussion has been closed.
Comments
Which version of ReportBuilder and Delphi are you using? Are you using RAP
for the event handlers or are you coding them in Delphi?
If you save the report to a template file, then load it manually into a
subreport, do you still get the same behavior or is this limited to using
the SaveToStream/LoadFromStream method?
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I'm using D7 and RB 11.04. The event handlers are coded in Delphi.
Not sure what you mean. At design time? If it means to have two distinct
reports, that is what I would like to avoid. Because that would double the
report layout and I would have to maintain the same report twice afterwards.
Regards
Peter
The suggestion I gave was not a solution, simply a test to try to isolate
where the problem is occurring. Instead of saving the report to a stream,
then loading it to a subreport in code, try saving the report to file and
loading it manually at design-time (in a test app perhaps) and see if you
get the same behavior.
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
must have something to do with Load/Save at runtime building new instances
of my TppImage objects and the event handler controlling the the visiblity
of the old. So I guess I have to find the right instance of the non dataware
elements inside the event handler. Any suggestions?
You can use a report object loop to gain access to all components inside a
report. From there you can check if they are data-aware and toggle their
properties manually. See the following example on how this can be done.
http://www.digital-metaphors.com/rbWiki/Delphi_Code/Layouts/Report_Object_Loop
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
that helped me to solve the problem
LodFromStream creates new TppImage Objects, while the eventhandler was
setting the visibility of the base instances...
Best regards,
Peter