Problem building bands on runtime
I have a problem. I'm trying to create a report only using code at runtime.
I'm doing this because I don't know before running how many band will i have and they are all different.
So, that's an extract of my code :
As a result, i have the masterdata band over the header band.
My question is simple :
how can I have this bands one after the other ?
Thanks for the answer.
I'm doing this because I don't know before running how many band will i have and they are all different.
So, that's an extract of my code :
  // Rapport
  FReport := TfrxReport.Create(Application);
  FReport.Clear;
  // Page du rapport
  FPage    := TfrxReportPage.Create(FReport);
  with FPage do
  begin
    SetDefaults;
    Orientation := poLandscape;
  end;
  ////////////// Instanciation de la bande titre. /////////////////////
  lBand := TfrxPageHeader.Create(aPage);
  lBand.CreateUniqueName;
  lBand.Top := 0;
  lBand.Height := 20;
  // Barre horizontale
  lMemoHorizontalBar := TfrxMemoView.Create(lBand);
  with lMemoHorizontalBar do
  begin
    // Graphisme
    Top          := 1.40 * fr1cm;
    Left          := 0;
    Height        := 0;
    Font.Color    := clBlack;
    Font.Height  := -13;
    Font.Name    := 'Arial';
    Font.Style    := [];
    Frame.Typ    := [ftBottom];
    HAlign        := haRight;
    ParentFont    := False;
    VAlign        := vaCenter;
    CreateUniqueName;
    Align := baWidth;
  end;
  // Date
  lMemoDate := TfrxMemoView.Create(lBand);
  with lMemoDate do
  begin
    CreateUniqueName;
    Text  := FDate;
    Height := 0.9 * fr1cm;
    Width  := 4.5 * fr1cm;
    left  := 10  * fr1cm;
    HAlign := haRight;
    Align  := baRight;
  end;
  // Nom
  lMemoName := TfrxMemoView.Create(lBand);
  with lMemoName do
  begin
    CreateUniqueName;
    Text  := FAuthorName;
    Height := 0.9 * fr1cm;
    Width  := 4.5 * fr1cm;
    left  := 0;
  end;
  // Titre
  lMemoTitle := TfrxMemoView.Create(lBand);
  with lMemoTitle do
  begin
    CreateUniqueName;
    Text        := FTitle;
    Height      := 0.9 * fr1cm;
    Width      := 18.50 * fr1cm;
    Align      := baCenter;
    Font.Style  := [fsBold];
    HAlign      := haCenter;   Â
  end;
  ////// Instanciation d'une bande de donn?©es.//////////
  lDataBand := TfrxMasterData.Create(aPage);
  lDataBand.CreateUniqueName;
  lDataband.PrintIfDetailEmpty := True;
  lDataband.DataSetName := '1';
  lDataband.RowCount := 1;
  lDataband.Top := 0;
  // Ajout d'un memo dans le DataBand;
    // Titre
  lMemo := TfrxMemoView.Create(lDataBand);
  with lMemo do
  begin
    CreateUniqueName;
    Text          := 'TOTO';
    StretchMode  := smMaxHeight;
    Align        := baWidth;
    Font.Style    := [];
    HAlign        := haLeft;
    AllowHTMLTags := true;
    WordWrap      := True;
  end;
  FReport.ShowReport;
As a result, i have the masterdata band over the header band.
My question is simple :
how can I have this bands one after the other ?
Thanks for the answer.
Comments
on your code, I see they are both set to 0
I have just tried this... It didn't work. Maybe I'm missing something on page or report parameters ??? I don't understand why the bands are not the one after each other. If i put lDataband.Top := 15 * fr1cm for example, the databand is still stucked at the top of the page.
Please help !
The solution :
It's very important to put the param Streched := True for each band. Great.