Hello,
for the fastreport's users.
We can define copies of the report with dinamic content using CopyName# variable, aditionaly I need to change some picture for every copy, did somebody make some thing like that?
thanks in advance
Marcelo V'ia
Dinamic picture change in FastReport
-
- Posts: 1033
- Joined: Fri Oct 07, 2005 3:33 pm
- Location: Cochabamba - Bolivia
-
- Posts: 454
- Joined: Sun Oct 30, 2005 6:37 am
- Location: Guangzhou(Canton),China
Re: Dinamic picture change in FastReport
1. code :
procedure Picture1OnBeforePrint(Sender: TfrxComponent);
begin
if callhbfunc('file',['.\sub\'+trim(<masterdata."imgid">)+'.jpg']) then
TfrxPictureView(page1.FindObject('picture1')).Picture.LoadFromFile('.\sub\'+trim(<masterdata."imgid">)+'.jpg')
else
TfrxPictureView(page1.FindObject('picture1')).Picture:=nil;
end;
begin
end .
2 .Page -- picture1 ---Event table --- onbforeprint
procedure Picture1OnBeforePrint(Sender: TfrxComponent);
begin
if callhbfunc('file',['.\sub\'+trim(<masterdata."imgid">)+'.jpg']) then
TfrxPictureView(page1.FindObject('picture1')).Picture.LoadFromFile('.\sub\'+trim(<masterdata."imgid">)+'.jpg')
else
TfrxPictureView(page1.FindObject('picture1')).Picture:=nil;
end;
begin
end .
2 .Page -- picture1 ---Event table --- onbforeprint
-
- Posts: 1033
- Joined: Fri Oct 07, 2005 3:33 pm
- Location: Cochabamba - Bolivia
Re: Dinamic picture change in FastReport
Hello,
first thanks for your response. Let me be more clear what I need.
We can define reports copy with global variable CopyName#
then we can view in every copy the value of CopyName# defined for this copy, additional I need to change some picture in the copy,
to do it we can use the OnPrintPage event from [x]harbour code (oFr:SetEventHandler( "Report", "OnPrintPage", {|copia| } ), but I need to change the picture in FR from HB code, then what I need now is how can I change the picture in FR from HB code using LoadFromFile or LoadImageFromHbRes, I think if is possible to call procedures defined in FR from HB I can solve my problem.
Thanks
Marcelo V'ia
first thanks for your response. Let me be more clear what I need.
We can define reports copy with global variable CopyName#
Code: Select all
frxglobalvariables['copyname0'] := 'PREVIEW';
frxglobalvariables['copyname1'] := 'COPY1';
frxglobalvariables['copyname2'] := 'COPY2';
frxglobalvariables['copyname3'] := 'COPY3';
to do it we can use the OnPrintPage event from [x]harbour code (oFr:SetEventHandler( "Report", "OnPrintPage", {|copia| } ), but I need to change the picture in FR from HB code, then what I need now is how can I change the picture in FR from HB code using LoadFromFile or LoadImageFromHbRes, I think if is possible to call procedures defined in FR from HB I can solve my problem.
Thanks
Marcelo V'ia
Re: Dinamic picture change in FastReport
Hello,
do you have DEMO_FWH.prg ?
I think memos and picture shows what you want.
Best regards,
Otto
do you have DEMO_FWH.prg ?
I think memos and picture shows what you want.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
********************************************************************
-
- Posts: 1033
- Joined: Fri Oct 07, 2005 3:33 pm
- Location: Cochabamba - Bolivia
Re: Dinamic picture change in FastReport
Otto,
thanks for the response, but the mentioned sample link a picture with a field in data source directly, it is not what I need
thanks any way
regards
Marcelo
thanks for the response, but the mentioned sample link a picture with a field in data source directly, it is not what I need
thanks any way
regards
Marcelo
-
- Posts: 287
- Joined: Fri Apr 14, 2006 5:52 pm
- Location: Córdoba (España)
Re: Dinamic picture change in FastReport
Not if it is really what you need , but when I insert an image from a file, what I do is the following:
I have a file in the following path :
c:\image\picture1.jpg
in the report, i put a image control and in the event OnBeforePrint of de Page indicated the following:
Page1OnBeforePrint procedure (Sender : TfrxComponent ) ;
begin
if length ( < Logo_Empresa > ) < > 0 then
Picture1.LoadFromFile ( < Logo_Empresa > ) ;
end;
<Logo_empresa> is a field that happened to the report containing the route , in this case :
C:\image\picture1.jpg
I have a file in the following path :
c:\image\picture1.jpg
in the report, i put a image control and in the event OnBeforePrint of de Page indicated the following:
Page1OnBeforePrint procedure (Sender : TfrxComponent ) ;
begin
if length ( < Logo_Empresa > ) < > 0 then
Picture1.LoadFromFile ( < Logo_Empresa > ) ;
end;
<Logo_empresa> is a field that happened to the report containing the route , in this case :
C:\image\picture1.jpg
-
- Posts: 1033
- Joined: Fri Oct 07, 2005 3:33 pm
- Location: Cochabamba - Bolivia
Re: Dinamic picture change in FastReport
Mike,
thanks for response, but this is not my problem, let me give an explanation:
when we define a FastReport variable CopyName# and we define some numbers of copies, we can get for every copy different content of the CopyName#
in this case, in the preview screen we will see "PREVIEW", in the first copy COPY1, in the second one COPY2, etc... additionaly I need to have a different picture for every copy, this is my problem.
Thanks
Marcelo Vía
thanks for response, but this is not my problem, let me give an explanation:
when we define a FastReport variable CopyName# and we define some numbers of copies, we can get for every copy different content of the CopyName#
Code: Select all
frxglobalvariables['copyname0'] := 'PREVIEW';
frxglobalvariables['copyname1'] := 'COPY1';
frxglobalvariables['copyname2'] := 'COPY2';
frxglobalvariables['copyname3'] := 'COPY3';
Thanks
Marcelo Vía
Re: Dinamic picture change in FastReport
Thank you very much ShumingWang. It worked for me.ShumingWang wrote:1. code :
procedure Picture1OnBeforePrint(Sender: TfrxComponent);
begin
if callhbfunc('file',['.\sub\'+trim(<masterdata."imgid">)+'.jpg']) then
TfrxPictureView(page1.FindObject('picture1')).Picture.LoadFromFile('.\sub\'+trim(<masterdata."imgid">)+'.jpg')
else
TfrxPictureView(page1.FindObject('picture1')).Picture:=nil;
end;
begin
end .
2 .Page -- picture1 ---Event table --- onbforeprint
Regards,
Hakan ONEMLI
Harbour & VS 2019 & FWH 20.12
Hakan ONEMLI
Harbour & VS 2019 & FWH 20.12