Help - Search - Members - Calendar
Full Version: Conversion from 2.5 to 4.0
Fast Reports forum > Fast Reports Products > FastReport 4.0
ssnews
Hi all,

I'm trying to convert my FastReport 2.5 code into the latest FastReport 4.
I have some problems because I don't know I can change some events present into the FastReport 2.5, in particular the events associated to the TfrxReport component.

The events are the foolowing:

BeginBand,
EndBand,
BeginPage,
EndPage.

Someone can Help me please?
I hope that I was clear.

Thanks in advice,
Marco.
gordk
assuming you are working at the delphi level
for begin and end band and not inside the report.
use the onbeforeprint event it fires for every object in the report
onafterprint is the same
procedure TForm1.frxReport1BeforePrint(Sender: TfrxReportComponent);
begin
if sernder.name = 'Masterdata1' then
begin
do something (read or set a variable)
end;
end;
onbeforeprint for a page only fires once when the design page is started
Post some sample code that you are trying to convert
ssnews
Thanks for your help gordk.

Now I have some other problems...
In FastReport 2.5 there are two events called "OnBeginPage" and "OnEndPage"...I search a lot but I can't find anything similar in FastReport 4.0, and the events "OnBeforePrint" and "OnAfterPrint" can't help me. How can I do?

Always in FastRerort 2.5 the component "frPage" has the properties Left, Right, Top and Bottom margin...which are the corresponding properties in FastReport 4.0?

Thanks in advice,
Marco.
OlegK
QUOTE
Always in FastRerort 2.5 the component "frPage" has the properties Left, Right, Top and Bottom margin...which are the corresponding properties in FastReport 4.0?

LeftMargin, RightMargin, TopMargin and BottomMargin.
ssnews
Thanks OlegK, I was using the component TfrxPage and not TfrxPageReport, so I couldn't find those properties.

In every cause I have to replace the events "OnBeginPage" and "OnEndPage"...and I don't know how can I do this...

Another question...If at runtime I have to add a line inside the report, and that line has to be print inside every page, how can I do?

Thanks in advice to all,
Marco.
gordk
Marco look in the public.binaries newsgroup i posted a demo there on 3/8/2008
titled demo for newbies.
it covers a lot of concepts and should give you some insight.
the onbegin page only fires when a designpage starts it does not fire for out put pages.
if your bands do not stretch(like a preprinted form you can draw lines on an overlay band)
set designer to largeheight in design mode add the overlay(underlay) after all other bands
then add your shapes to the overlay.
ssnews
I'm trying to insert a line at runtine but I can't...following there's the code...

var
vPage: TfrxReportPage;
vLine : TfrxLineView;
begin
vPage:=frxReport1.Objects[1];

vLine:=TfrxLineView.Create(nil);
vLine.SetBounds(1,1,100,1);
vPage.Objects.Add(vLine);

frxReport1.PrepareReport;
frxReport1.ShowPreparedReport;
end;

During the prepare report appears an error who said "Invalid pointer operation", can someone say to me if I'm doing something wrong?

Thanks in advice,
Marco
OlegK
QUOTE
I'm trying to insert a line at runtine but I can't...

Use this code:
CODE
var
  vPage: TfrxReportPage;
  vLine: TfrxLineView;
begin
  vPage := frxReport1.FindObject('Page1') as TfrxReportPage;
  vLine := TfrxLineView.Create(vPage);
  vLine.SetBounds(1, 1, 100, 1);
  frxReport1.PrepareReport(true);
  frxReport1.ShowPreparedReport();
end;
ssnews
Thanks very much for your help smile.gif

Another question about the lines insertion...
Those lines that I added at runtine to the ReportPage, are printed only in the first page and not also in the other pages... Can you say me why?

Thanks in advice,
Marco.
OlegK
QUOTE
Those lines that I added at runtine to the ReportPage, are printed only in the first page and not also in the other pages... Can you say me why?

Because
CODE
vPage := frxReport1.FindObject('Page1') as TfrxReportPage;
vLine := TfrxLineView.Create(vPage);
This code creates line only in Page1.

To create line in every page, use following code:
CODE
var
  vPage: TfrxReportPage;
  vLine: TfrxLineView;
  I: Integer;
begin
  for I := 1 to frxReport1.PagesCount - 1 do
  begin
    vPage := frxReport1.Pages[I] as TfrxReportPage;
    vLine := TfrxLineView.Create(vPage);
    vLine.SetBounds(1, 1, 100, 1);
  end;
end;
ssnews
Is there a complete conversion guide from FastReport 2.5 to 4.0?

Thanks,
Marco.
ssnews
QUOTE(ssnews @ Jan 25 2010, 03:28 PM) *
Is there a complete conversion guide from FastReport 2.5 to 4.0?

Thanks,
Marco.


I need a conversion guide because otherwise is too difficult for me to convert my code from FastReport 2.5 to 4.0...
Infact I can't find procedures like "vPage.ChangePaper" or properties like "vPage.PrnInfo.Ofx" or "vPage.PrnInfo.Ofy"...

In every case I always can't draw lines inside all pages with the following code:

CODE
var
  vPage: TfrxReportPage;
  vLine: TfrxLineView;
  I: Integer;
begin
  for I := 1 to frxReport1.PagesCount - 1 do
  begin
    vPage := frxReport1.Pages[I] as TfrxReportPage;
    vLine := TfrxLineView.Create(vPage);
    vLine.SetBounds(1, 1, 100, 1);
  end;
end;


...lines are printed only in the first page. What I have to do?

thanks in advice to all,
Regards,
Marco.
OlegK
What is your version of FastReport 4?
gpi
Try to place TfrxLineView on TfrxPageHeader band
courtneycoles27
hi! what is the latest version for fastreport right now? because i like to upgrade my old version.

thank you,
courtney
Anu de Deus
You need to specify a different name for each object in each page.
Because you are creating without specifying a name, they all get a blank name, and only the 1st one survives, and you see no exceptions being raised
Try something like this:

CODE
  for I := 1 to frxReport1.PagesCount - 1 do
  begin
    vPage := frxReport1.Pages[I] as TfrxReportPage;
    vLine := TfrxLineView.Create(vPage);
        vLine.CreateUniqueName; // << good start, but not enough because you repeat the same in other pages
        vLine.name := vLine.name + vPage.name; // considering that all pages have different names (page1, page2,etc), this will garantee its uniqueness
    vLine.SetBounds(1, 1, 100, 1);
  end;





QUOTE(ssnews @ Jan 26 2010, 07:56 AM) *
QUOTE(ssnews @ Jan 25 2010, 03:28 PM) *
Is there a complete conversion guide from FastReport 2.5 to 4.0?

Thanks,
Marco.


I need a conversion guide because otherwise is too difficult for me to convert my code from FastReport 2.5 to 4.0...
Infact I can't find procedures like "vPage.ChangePaper" or properties like "vPage.PrnInfo.Ofx" or "vPage.PrnInfo.Ofy"...

In every case I always can't draw lines inside all pages with the following code:

CODE
var
  vPage: TfrxReportPage;
  vLine: TfrxLineView;
  I: Integer;
begin
  for I := 1 to frxReport1.PagesCount - 1 do
  begin
    vPage := frxReport1.Pages[I] as TfrxReportPage;
    vLine := TfrxLineView.Create(vPage);
    vLine.SetBounds(1, 1, 100, 1);
  end;
end;


...lines are printed only in the first page. What I have to do?

thanks in advice to all,
Regards,
Marco.

OlegK
QUOTE(courtneycoles27 @ Feb 9 2010, 10:29 AM) *
hi! what is the latest version for fastreport right now? because i like to upgrade my old version.

The lastest version is 4.9.21
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.