ppImage and PNG files.
I have a really weird situation. I've got a Delphi application that
uses ReportBuilder with ppImages in several reports. Originally, it did
not support PNG files. Several moons ago, the Boss & I did "something"
that made it possible to use the Image.Picture.LoadFromFile to load a
.png file to display (a logo) in the report. It works great.
I recently wrote a .DLL library thaat also uses ReportBuilder, and has
similar reports that use the ppImage. The DLL loads & works great ...
EXCEPT ... if I give LoadFromFile a .PNG file name, I get back "Unknown
picture file extension (.png)", and the process fails.
Even weirder ... if, while in the Report Designer, I load a PNG file
into the ppImage, it accepts it and displays it in the Designer. When I
compile & run the DLL, and run the App, nothing displays at runtime. (In
other words, it appears the "Design-time" environment recognizes PNGs,
but the Run-time doesn't.
I'm still using Delphi 7 (we plan an upgrade in the coming year ...
sometime). What do I need to do in my library project to get it to
accept PNGs (that I/we apparently did to the main project and forgot...)?
Apologetically ignorant,
Lane Campbell
uses ReportBuilder with ppImages in several reports. Originally, it did
not support PNG files. Several moons ago, the Boss & I did "something"
that made it possible to use the Image.Picture.LoadFromFile to load a
.png file to display (a logo) in the report. It works great.
I recently wrote a .DLL library thaat also uses ReportBuilder, and has
similar reports that use the ppImage. The DLL loads & works great ...
EXCEPT ... if I give LoadFromFile a .PNG file name, I get back "Unknown
picture file extension (.png)", and the process fails.
Even weirder ... if, while in the Report Designer, I load a PNG file
into the ppImage, it accepts it and displays it in the Designer. When I
compile & run the DLL, and run the App, nothing displays at runtime. (In
other words, it appears the "Design-time" environment recognizes PNGs,
but the Run-time doesn't.
I'm still using Delphi 7 (we plan an upgrade in the coming year ...
sometime). What do I need to do in my library project to get it to
accept PNGs (that I/we apparently did to the main project and forgot...)?
Apologetically ignorant,
Lane Campbell
This discussion has been closed.
Comments
ReportBuilder does not natively support the .png image format (nor does
Delphi). You must be using a third party TGraphic descendent such as
TPNGImage or GraphicEx. Take a look at the following article on how to add
new image formats to ReportBuilder.
http://www.digital-metaphors.com/rbWiki/RCL/Images/Image_Formats
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
***************************
Thanks ... this may just be what I need to do ... Monday ...
Long day,
Lane Campbell
Delphi 2009 includes support for PNG.
If you are using Delphi 2009, add ppPNG to the 'uses' clause of your
application to include RB PNG support.
--
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
********************
Nico,
It's Monday, I tried registering the class TdxPNGImage, which we have
from unit dxGDIPlusClasses (which I believe we got from DevEx). I wrote
a short unit , RegPng, based on your example code from the article.
**********************************************
unit uRegPng;
interface
uses
ppCtrls, dxGDIPlusClasses;
implementation
initialization
ppRegisterGraphicClass('PNG',TdxPNGImage);
finalization
ppUnregisterGraphicClass(TdxPNGImage);
end.
***************************************************
I ran it, and it still didn't work. Gave me the same error message.
What's weird is, in the designer, I can preload a PNG file into the
ppImage in the report, and in the Object Inspector Picture property, it
shows TdxPNGImage as the loaded type. Yet when I run it, the picture
still doesn't display -- not in the Previewer, nor in the printed output.
Is it because I'm doing this inside a DLL? The parent App that CALLS the
DLL has reports that accept PNGs and work fine. (???)
Still perplexed
*********************
Folks,
Still haven't got an answer that works inside the DLL (what's odd is
that the application that CALLS the DLL displays PNGs without a
problem). I've got customers & a boss leaning on me for an answer, and
I'm still clueless.
Has anybody else encountered this sort of problem? Any clues? Ideas?