Change image on report dependant on data?
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,
Ian
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,
Ian
This discussion has been closed.
Comments
visible, or not, in the Header BeforePrint event, depending on the Code.
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.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
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,
Ian
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
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!
Regards,
Ian
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..