Conversion from 2.5 to 4.0

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.

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 9:23AM
    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
  • edited 9:23AM
    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.
  • edited 9:23AM
    wrote:
    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.
  • edited 9:23AM
    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.
  • gordkgordk St.Catherines On. Canada.
    edited 9:23AM
    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.
  • edited 9:23AM
    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
  • edited January 2010
    wrote:
    I'm trying to insert a line at runtine but I can't...
    Use this 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;
    
  • edited 9:23AM
    Thanks very much for your help [img]style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="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.[/img]
  • edited January 2010
    wrote:
    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
    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:
    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;
    
  • edited January 2010
    Is there a complete conversion guide from FastReport 2.5 to 4.0?

    Thanks,
    Marco.
  • edited 9:23AM
    ssnews wrote: »
    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:
    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.
  • edited 9:23AM
    What is your version of FastReport 4?
  • gpigpi
    edited 9:23AM
    Try to place TfrxLineView on TfrxPageHeader band
  • hi! what is the latest version for fastreport right now? because i like to upgrade my old version.

    thank you,
    courtney
  • Anu de DeusAnu de Deus Hampshire, UK
    edited 9:23AM
    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:
      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;
    



    ssnews wrote: »
    ssnews wrote: »
    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:
    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.
  • edited February 2010
    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

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.