How to draw line every page by script?

edited July 2011 in FastReport 4.0
procedure MemoProcessRequireOnBeforePrint(Sender: TfrxComponent);
var myLine :TfrxLineView;
begin

myLine := TfrxLineView.Create(Page1);

.....


end;

==============================

But It draws line always on the first page. Can you help me?

Best regards

Comments

  • Anu de DeusAnu de Deus Hampshire, UK
    edited 4:21AM
    Put it inside a band, like a page header, or databand:

    myLine := TfrxLineView.Create(PageHeader1);

    commuch wrote: »
    procedure MemoProcessRequireOnBeforePrint(Sender: TfrxComponent);
    var myLine :TfrxLineView;
    begin

    myLine := TfrxLineView.Create(Page1);

    .....


    end;

    ==============================

    But It draws line always on the first page. Can you help me?

    Best regards
  • edited 4:21AM
    Hi Anu de Deus,

    Thank you. But I have a different line type every page. If use "TfrxLineView.Create(PageHeader1)", Every page show the all lines.

    Have you any idea? Thank you again.

    Best regards
  • Anu de DeusAnu de Deus Hampshire, UK
    edited 4:21AM
    Then you need to create a databand for each page, assign nothing as datasource to it, Recordcount=1, and use it as the parent:
    TfrxLineView.Create(DataBand1 (2,3,etc))

    commuch wrote: »
    Hi Anu de Deus,

    Thank you. But I have a different line type every page. If use "TfrxLineView.Create(PageHeader1)", Every page show the all lines.

    Have you any idea? Thank you again.

    Best regards
  • edited 4:21AM
    Hi Anu de Deus,

    Thank you for your help.

    Can you write a sample code? Bcasue I have one page in report template. The page obeject name is "Page1".

    Best regards
  • gpigpi
    edited 4:21AM
    Try to use TfrxOverlay band
    or such code (for TfrxMemoView)
    procedure TForm1.frxReport1EndDoc(Sender: TObject);
    var p: TfrxReportPage;
        m: TfrxMemoView;
        i: integer;
    begin
         frxReport1.Preview.Lock;
         for i := 0 to frxReport1.PreviewPages.Count - 1 do
           begin
             p:=TfrxReportPage(frxReport1.PreviewPages.Page[i]);
             m:=TfrxMemoView.Create(p);
             m.CreateUniqueName;
             m.SetBounds(0, 0, (p.PaperWidth  - p.RightMargin - p.LeftMargin) * fr01cm, (p.PaperHeight - p.TopMargin - p.BottomMargin) * fr01cm);
             m.Text := 'Demo';
             m.Rotation := 45;
             m.Font.Size := 128;
             m.VAlign := vaCenter;
             m.HAlign := haCenter;
             frxReport1.PreviewPages.ModifyPage(i,p);
           end;
         frxReport1.Preview.UnLock;
    end;
    
    or
    procedure TForm1.frxReport1PrintPage(Page: TfrxReportPage;
      CopyNo: Integer);
    var m: TfrxMemoView;
    begin
             m:=TfrxMemoView.Create(page);
             m.CreateUniqueName;
             m.SetBounds(0, 0, (page.PaperWidth  - page.RightMargin - page.LeftMargin) * fr01cm, (page.PaperHeight - page.TopMargin - page.BottomMargin) * fr01cm);
             m.Text := 'Demo';
             m.Rotation := 45;
             m.Font.Size := 128;
             m.VAlign := vaCenter;
             m.HAlign := haCenter;
    end;
    
  • edited 4:21AM
    Hi gpi,

    Thank you.

    Your code is delphi code. I want to use script because I use FastReport Studio version. I need your help. Thank you.

    Best regards
  • gpigpi
    edited 4:21AM
    Use TfrxOverlay band or ask your question in FR Studio forum

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.