Home Subreports
New Blog Posts: Merging Reports - Part 1 and Part 2

TppImage not shown in subreport

edited November 2010 in Subreports
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

Comments

  • edited November 2010
    Hi Peter,

    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
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2010
    Txs Nico,
    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

  • edited November 2010
    Hi 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
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2010
    OK I see. I've no doubt, that the problem will disappear doing so. I feel it
    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?

  • edited November 2010
    Hi Peter,

    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
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2010
    Txs Nico,
    that helped me to solve the problem :) As expected SaveToStream /
    LodFromStream creates new TppImage Objects, while the eventhandler was
    setting the visibility of the base instances...
    Best regards,
    Peter

This discussion has been closed.