How to display some text on a page

edited 2:22AM in FastReport 4.0
Hello All,

I am a beginner in using fast report. I am using fast report manually coded, as seen below.
I would like to do first some simple things, as add some static text on a page.
If I tried to display ex. three text memos, only the last memo is displayed. It seems to be that the previous displayed memo is overwritten by the last memo.

What do I do wrong here ???

Thanks in advance,

Johan
procedure TMainForm.bReportClick(Sender: TObject);
var
  DataPage:   TfrxDataPage;
  DataPage1:  TfrxDataPage;
  Page:       TfrxReportPage;
  Band:       TfrxBand;
  Band1:      TfrxBand;
  Band2:      TfrxBand;
  Band3:      TfrxBand;
  Band4:      TfrxBand;
  Band5:      TfrxBand;
  DataBand:   TfrxMasterData;
  Header:     TfrxMemoView;
  Header2:    TfrxMemoView;
  Veld1, Veld2, Veld3, Veld4, Veld5:  TfrxMemoView; 

//--------------------------------HEADER1----------------------------------------

begin
  frxReport1.Clear;   { clear a report }


  Page := TfrxReportPage.Create(frxReport1);    { add a page }
  Page.CreateUniqueName;   // Page1                     { create a unique name }
  Page.SetDefaults;                             { set sizes of fields, paper and orientation by default }
  Page.PaperSize := DMPAPER_A4;
  Page.Orientation := poPortrait;               { Stel orientatie in }

  Band := TfrxReportTitle.Create(Page);         { add a report title band}
  Band.CreateUniqueName;
  Band.Top    := 0;                             { both coordinates are in pixels } { it is sufficient to set the ?«Top?» coordinate and height for a band }
  Band.Height := 50;                            

  Header := TfrxMemoView.Create(Band);          { add an object to the report title band }
  Header.CreateUniqueName;
  Header.Font.Name    := 'Comic Sans MS';
  Header.Font.Color   := clBlack;
  Header.Font.Height  := 28;
  Header.HAlign       := haCenter;
  Header.Height       := 30;
  Header.Align        := baWidth;               { this object will be stretched according to band???s width }
  Header.Text         := 'Conditie Rapportage';

 //--------------------------------HEADER2---------------------------------------

  Page := TfrxReportPage.Create(frxReport1);    { add a page }
  Page.CreateUniqueName;  // Page2 { create a unique name }
  Page.SetDefaults;                     { set sizes of fields, paper and orientation by default }
  Page.PaperSize := DMPAPER_A4;

  Band1 := TfrxReportTitle.Create(Page); { add a report title band}
  Band1.CreateUniqueName;
  Band1.Top    := 0;      { both coordinates are in pixels } { it is sufficient to set the ?«Top?» coordinate and height for a band }
  Band1.Height := 50;    

  Header2 := TfrxMemoView.Create(Band1); { add an object to the report title band }
  Header2.CreateUniqueName;
  Header2.Font.Name    := 'Comic Sans MS';
  Header2.Font.Color   := clBlack;
  Header2.Font.Height  := 28;
  Header2.HAlign       := haCenter;
  Header2.Height       := 30;
  Header2.Align        := baWidth;     { this object will be stretched according to band???s width }
  Header2.Text         := 'Conditie Rapportage pagina twee';

//------------------------EINDE HEADER------------------------------------------

  Label1:= TfrxMemoView.Create(Band1); { add an object to the report title band }
  Label2 := TfrxMemoView.Create(Band1); { add an object to the report title band }
  Label3 := TfrxMemoView.Create(Band1); { add an object to the report title band }
  Label4 := TfrxMemoView.Create(Band1); { add an object to the report title band }
  Label5 := TfrxMemoView.Create(Band1); { add an object to the report title band }

  Label1.CreateUniqueName;
  Label2.CreateUniqueName;
  Label3.CreateUniqueName;
  Label4.CreateUniqueName;
  Label5.CreateUniqueName;

  Label1.Font.Name    := 'Arial';
  Label1.Font.Color   := clBlack;
  Label1.Font.Size    := 12;
  Label1.HAlign       := haLeft;
  Label1.Height       := 100;
  Label1.Align        := baWidth;     { this object will be stretched according to band???s width }
  Label1.Top          := 40;
  Label1.Text         := 'Memo Tekst Veld1';

  Label2.Font.Name    := 'Arial';
  Label2.Font.Color   := clBlack;
  Label2.Font.Size    := 12;
  Label2.HAlign       := haLeft;
  Label2.Height       := 100;
  Label2.Align        := baWidth;
  Label2.Top          := 80;
  Label2.Text         := 'Memo Tekst Veld2';

  Labe3.Font.Name    := 'Arial';
  Label3.Font.Color   := clBlack;
  Label3.Font.Size    := 12;
  Label3.HAlign       := haLeft;
  Label3.Height       := 100;
  Label3.Align        := baWidth;
  Label3.Top          := 120;
  Label3.Text         := 'Memo Tekst Veld3';

  frxReport1.ShowReport;  { show the report } 

end;

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 2:22AM
    go back and read your programmers manual again (Creating a report from code ) and you shouldl see the errors you are making.
    When you add an object to the band set all the properties for the object after you create it.
    when adding more than 1 memoview to a band you may find you need to set the left prop of the memoview
    or they will all be placed one on top of the other.
    TIP add a report designer to your project and instead of calling show report, insert a temporary call to
    design report and you will see what you have created in the designer.

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.