Change image on report dependant on data?

edited September 2017 in General
Hi Team,
Win 10, D10.2.1, latest RBEnt.
Not sure of the best way to approach this.
In the Header of the report is the normal title and general information, plus there is a business image/logo.
I need to change the image/logo at run-time dependant on the value of a 1 char field , 'Code',in the Data.
e.g. Field Code value 'A' needs to have Logo x displayed, value 'B' needs Inage Y displayed.
The images are generally .bmp files. They all need to fit into the same report space.

Appreciate guidance on the best way to acieve this.

Regards & TIA,


  • edited September 2017
    My first thought is to put a couple of images on the header, sized & positioned appropriately, and then just make them
    visible, or not, in the Header BeforePrint event, depending on the Code.
  • edited September 2017
    Hi Ian,

    Your method is correct.

    Another option would be to load the image dynamically (from file or DB)
    based on your conditions from within the Band.BeforePrint or
    TppImage.OnPrint event.

    Best Regards,

    Nico Cizik
    Digital Metaphors
  • edited September 2017
    Nico Cizik (Digital Metaphors) wrote:

    Hi Nico,
    Thanks. Will stick with the method I have.
    Out of curiosity, I did try the YppImage.OnPrint method but couldn't figure out how to actually load the image from
    the file. i.e. a load or loadfrom file action. Can you point me at the methodology please?

    Regards & TIA,

  • edited September 2017
    On 05/09/2017 21:37, Ian Branch wrote:

    The report builder help file says:

    TppImage.Picture Property

    public property Picture: TPicture;

    The Picture property contains the graphical image that is printed by an
    image report control..

    For a TppDBImage, the Picture property is a run-time property only.

    For TppImage, you can set the Picture property at design-time or run-time.

    For TPicture methods, see the Delphi help
  • edited September 2017
    Hi Paul,
    Yeah, read that too.
    Strangely there is no mention of a "LoadFromFile(Filename);" for "Image1.Picture".
    So. On a whim I just did.. "Image1.Picture.LoadFromFile(filename);"
    It works. Yay team!

  • edited September 2017
    On 06/09/2017 06:53, Ian Branch wrote:

    Because "Picture" is a Delphi class (TPicture), hence my comment "For
    TPicture methods, see the Delphi help "

    ReportBuilder classes are demarcated by starting with Tpp..
This discussion has been closed.