frxPicture-Component doesnt operate properly
Hello,
i want to report about a problem (bug) with TfrxPictureView.
I intend to bring a series of pictures into a report.
In FR-IDE:
frxMasterData.OnBeforePrint
It is of different effect
if I enter a Filename into a Picture1:TfrxPictureView
1.
by Picture1.Picture.LoadFromFile('D:\Pictures\Pict1.bmp')
and
2.
by Picture1.Picture.LoadFromFile(Memo1.Text)
respectivly.
remarked:
Memo1.TfrxMemoView I use to transfer fileName from Delphi into FastReport.
in 1.
Picture1.Picture.LoadFromFile('D:\Pictures\Pict1.bmp')
Picture1 will be shown.
in 2.
Picture1.Picture.LoadFromFile(Memo1.Text)
Picture1 will not be shown.
The content of Memo1.text is correct, I had tested it.
Anything must be wrong here?!
I am hesitated .
Many thanks for help
EB
i want to report about a problem (bug) with TfrxPictureView.
I intend to bring a series of pictures into a report.
In FR-IDE:
frxMasterData.OnBeforePrint
It is of different effect
if I enter a Filename into a Picture1:TfrxPictureView
1.
by Picture1.Picture.LoadFromFile('D:\Pictures\Pict1.bmp')
and
2.
by Picture1.Picture.LoadFromFile(Memo1.Text)
respectivly.
remarked:
Memo1.TfrxMemoView I use to transfer fileName from Delphi into FastReport.
in 1.
Picture1.Picture.LoadFromFile('D:\Pictures\Pict1.bmp')
Picture1 will be shown.
in 2.
Picture1.Picture.LoadFromFile(Memo1.Text)
Picture1 will not be shown.
The content of Memo1.text is correct, I had tested it.
Anything must be wrong here?!
I am hesitated .
Many thanks for help
EB
Comments
requires a string and needs string delimiters so build your string correctly
Picture1.Picture.LoadFromFile('+(Memo1.Text)+');
or
Picture1.Picture.LoadFromFile('+(vartostr(Memo1.value))+');
but both proposals doesnt operate
in case 1
Compiler gives:
unknown PictureFileextention (.text)+)' occurred
in case 2
compiler gives:
unknown PictureFileextention (.value))+)' occurred
Than Compiler stops in unit fs_igraphicsrtti
row 182
TPicture(Instance).LoadFromFile(Caller.Params[0])
I dont understand Yout proposal.
What the +-signs means?
Thanks
EB.
Try this instead:
I'd tested Your code.
In the showmessage not the content of memo occurred, the variablename of the Memo (element), transferring the Filename, will be shown.
e.g. there any Problem with variable conversion exsist.
Many thanks for ideas.
EB
will get back to you.
the reason you only see the expression that is in the memo view is that is what is there before it is handled so use the oadevent of the memo to get the value or use the datafield directly
picture1.loadfromfile(<dataset."fieldname">);
also remember that to retrieve a value from memo1's memo it must have been processed before the pictureview is processed.
ie hardcoded
procedure Picture1OnBeforePrint(Sender: TfrxComponent);
var
mylink:string;
begin
mylink:= 'C:\logo.jpg';
showmessage(mylink);
picture1.loadfromfile(mylink);
end;
will work
you need to use the trim function to strip any leading or trailing spaces.
picture1.picture.loadfromfile(trim(memo1.text));
this will work if memo1 contains text like c:\logo.jpg
and allow expresions is turned off
however since your memo contains [datasetname."fieldname"] you may need to work in the oad event of memo1 and retrieve memo1.value and set the filelink prop of the pictureview.
ill test this later after i create a table and field
begin
picture1.loadfromfile(trim(memo1.text));
end;
works fine if the memo contains [datasetname."fieldname"]
but Your efforts are without of success, unfortunatly.
Now I'm looking for another solution, printing a lot of *.bmp-Pictures into a NoDatabaseReport.
Should it possible to load the *.bmp-Pictures in the Delphi Code, but not in the FastReport Code ?
In DelphiTreff Forum I had found such an idea.
Looking please into http://forum.delphi-treff.de/showthread.php?t=1501.
Now my question:
In the FR4 Trial I doesnt find the TfrView.
Should it possible, that TfrView only exists in the puchased version of FR4, and not in the Trial Version ?
Than I intend to test this way.
Have You another, better ideas solving this problem properly ?
Thankfull, my dream is to solve this problem before Eastern ++ my dream ..
Many thanks and hopes
EB
1 the article you referenced is about fr2 not fr4
2 using the trim function works fine here.
remember report engine handles top down according to band type and l to r in the band in order of creation.
so your memoview must come before your picture.
yes you can do it from delphi in the tfrxreport component on before print event.
if sender.name = 'Picture1' then
begin
tfrxpictureview(sender).picture.loadfromfile(path&filename);
end;
after several exersices I have found a possibility loading a series of *.bmp Pictures into a FR.
My way is only by using the Delphi IDE, not code in the FR4.
There the code is:
Now this Code operates till one residuing problem:
If in Runtime I open the PrintDialog in FrxReport1.Prewiew, the correct FileName will be shown, but the correct PathName will not be shown.
Where I can give its the correct Path?
Thanks
EB