Link to home
Start Free TrialLog in
Avatar of hidrau
hidrauFlag for Brazil

asked on

Doubt about quickreport

Hello guys

I have 4 bands in my report:

1 pageheader
1 pagefooter
1 Title
1 detail

I want to do this:

In my first page, only the title must appear, it must appear in all page, that is, the heigh must be all page. After printing the first page (pagefooter) in the second page I will print the pageheader, detail and pagefooter.

My first question:
How can I size my pagetitle to have all page heigh?

Maybe there are another doubts but I need to see whether I am able to solve them  by my self

thanks

Avatar of hidrau
hidrau
Flag of Brazil image

ASKER

I also have another doubt that I haven't been able to solve it yet.

How can I start printing Pageheader - detais - pageFooter from the second page?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of bokist
bokist
Flag of Hungary image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Try to play with  Quickrep1.PageNumber , something like this :

procedure TForm1.Page_HeaderlBeforePrint(Sender: TQRCustomBand; var PrintBand: Boolean);
begin
  if Quickrep1.PageNumber >= 1  then   Quickrep1.Bands.PageHeaderBand.Height := some_height  // reduced hight
  else                                                      Quickrep1.Bands.PageHeaderBand.Height := some_height; // fill whole page  end;

procedure TForm1.DetailBeforePrint(Sender: TQRCustomBand; var PrintBand: Boolean);
begin
  PrintBand := Quickrep1.PageNumber >= 1;
end;

procedure TForm1.Page_FooterBeforePrint(Sender: TQRCustomBand; var PrintBand: Boolean);
begin
  PrintBand := Quickrep1.PageNumber >= 1;
end;

Sorry, by mistake I send my comment twice.
Avatar of hidrau

ASKER

I tried but it didn't print the header and footer and the details from the second band, it started printing from the first. Have you ever tried this?
object FRelLivroVale: TFRelLivroVale
  Left = 0
  Top = 0
  Width = 794
  Height = 1123
  Frame.Color = clBlack
  Frame.DrawTop = False
  Frame.DrawBottom = False
  Frame.DrawLeft = False
  Frame.DrawRight = False
  DataSet = ADOQuery1
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -13
  Font.Name = 'Arial'
  Font.Style = []
  Functions.Strings = (
    'PAGENUMBER'
    'COLUMNNUMBER'
    'REPORTTITLE')
  Functions.DATA = (
    '0'
    '0'
    '''''')
  Options = [FirstPageHeader, LastPageFooter]
  Page.Columns = 1
  Page.Orientation = poPortrait
  Page.PaperSize = A4
  Page.Values = (
    100.000000000000000000
    2970.000000000000000000
    100.000000000000000000
    2100.000000000000000000
    100.000000000000000000
    100.000000000000000000
    0.000000000000000000)
  PrinterSettings.Copies = 1
  PrinterSettings.Duplex = False
  PrinterSettings.FirstPage = 0
  PrinterSettings.LastPage = 0
  PrinterSettings.OutputBin = Auto
  PrintIfEmpty = True
  SnapToGrid = True
  Units = MM
  Zoom = 100
  object QRBand1: TQRBand
    Left = 38
    Top = 118
    Width = 718
    Height = 83
    Frame.Color = clBlack
    Frame.DrawTop = False
    Frame.DrawBottom = False
    Frame.DrawLeft = False
    Frame.DrawRight = False
    AlignToBottom = False
    BeforePrint = QRBand1BeforePrint
    Color = 13828095
    ForceNewColumn = False
    ForceNewPage = False
    Size.Values = (
      219.604166666666700000
      1899.708333333333000000)
    BandType = rbTitle
    object QRLabel3: TQRLabel
      Left = 288
      Top = 24
      Width = 67
      Height = 33
      Frame.Color = clBlack
      Frame.DrawTop = False
      Frame.DrawBottom = False
      Frame.DrawLeft = False
      Frame.DrawRight = False
      Size.Values = (
        87.312500000000000000
        762.000000000000000000
        63.500000000000000000
        177.270833333333300000)
      Alignment = taLeftJustify
      AlignToBand = False
      AutoSize = True
      AutoStretch = False
      Caption = 'Titulo'
      Color = clWhite
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -27
      Font.Name = 'Arial'
      Font.Style = []
      ParentFont = False
      Transparent = False
      WordWrap = True
      FontSize = 20
    end
  end
  object PGcab: TQRBand
    Left = 38
    Top = 38
    Width = 718
    Height = 80
    Frame.Color = clBlack
    Frame.DrawTop = False
    Frame.DrawBottom = False
    Frame.DrawLeft = False
    Frame.DrawRight = False
    AlignToBottom = False
    BeforePrint = PGcabBeforePrint
    Color = clBlue
    ForceNewColumn = False
    ForceNewPage = False
    Size.Values = (
      211.666666666666700000
      1899.708333333333000000)
    BandType = rbPageHeader
    object QRLabel1: TQRLabel
      Left = 288
      Top = 24
      Width = 125
      Height = 33
      Frame.Color = clBlack
      Frame.DrawTop = False
      Frame.DrawBottom = False
      Frame.DrawLeft = False
      Frame.DrawRight = False
      Size.Values = (
        87.312500000000000000
        762.000000000000000000
        63.500000000000000000
        330.729166666666700000)
      Alignment = taLeftJustify
      AlignToBand = False
      AutoSize = True
      AutoStretch = False
      Caption = 'cabeçalho'
      Color = clWhite
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -27
      Font.Name = 'Arial'
      Font.Style = []
      ParentFont = False
      Transparent = False
      WordWrap = True
      FontSize = 20
    end
  end
  object PGrod: TQRBand
    Left = 38
    Top = 230
    Width = 718
    Height = 72
    Frame.Color = clBlack
    Frame.DrawTop = False
    Frame.DrawBottom = False
    Frame.DrawLeft = False
    Frame.DrawRight = False
    AlignToBottom = False
    BeforePrint = PGrodBeforePrint
    Color = 8421631
    ForceNewColumn = False
    ForceNewPage = False
    Size.Values = (
      190.500000000000000000
      1899.708333333333000000)
    BandType = rbPageFooter
    object QRLabel2: TQRLabel
      Left = 312
      Top = 24
      Width = 96
      Height = 33
      Frame.Color = clBlack
      Frame.DrawTop = False
      Frame.DrawBottom = False
      Frame.DrawLeft = False
      Frame.DrawRight = False
      Size.Values = (
        87.312500000000000000
        825.500000000000100000
        63.500000000000000000
        254.000000000000000000)
      Alignment = taLeftJustify
      AlignToBand = False
      AutoSize = True
      AutoStretch = False
      Caption = 'Rodapé'
      Color = clWhite
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -27
      Font.Name = 'Arial'
      Font.Style = []
      ParentFont = False
      Transparent = False
      WordWrap = True
      FontSize = 20
    end
  end
  object PGdetails: TQRBand
    Left = 38
    Top = 201
    Width = 718
    Height = 29
    Frame.Color = clBlack
    Frame.DrawTop = False
    Frame.DrawBottom = False
    Frame.DrawLeft = False
    Frame.DrawRight = False
    AlignToBottom = False
    BeforePrint = PGdetailsBeforePrint
    Color = clWhite
    ForceNewColumn = False
    ForceNewPage = False
    Size.Values = (
      76.729166666666680000
      1899.708333333333000000)
    BandType = rbDetail
    object QRLabel4: TQRLabel
      Left = 8
      Top = 8
      Width = 26
      Height = 17
      Frame.Color = clBlack
      Frame.DrawTop = False
      Frame.DrawBottom = False
      Frame.DrawLeft = False
      Frame.DrawRight = False
      Size.Values = (
        44.979166666666670000
        21.166666666666670000
        21.166666666666670000
        68.791666666666680000)
      Alignment = taLeftJustify
      AlignToBand = False
      AutoSize = True
      AutoStretch = False
      Caption = 'Item'
      Color = clWhite
      Transparent = False
      WordWrap = True
      FontSize = 10
    end
    object QRDBText1: TQRDBText
      Left = 72
      Top = 8
      Width = 60
      Height = 17
      Frame.Color = clBlack
      Frame.DrawTop = False
      Frame.DrawBottom = False
      Frame.DrawLeft = False
      Frame.DrawRight = False
      Size.Values = (
        44.979166666666670000
        190.500000000000000000
        21.166666666666670000
        158.750000000000000000)
      Alignment = taLeftJustify
      AlignToBand = False
      AutoSize = True
      AutoStretch = False
      Color = clWhite
      DataSet = ADOQuery1
      DataField = 'CT_PECA'
      Transparent = False
      WordWrap = True
      FontSize = 10
    end
  end
  object ADOQuery1: TADOQuery
    Active = True
    ConnectionString = 
      'Provider=SQLNCLI.1;Password=cj2492;Persist Security Info=True;Us' +
      'er ID=sa;Initial Catalog=TRATOR;Data Source=10.10.1.15\sql2005'
    CursorType = ctStatic
    Parameters = <>
    SQL.Strings = (
      'select * from vale_contrato_itens'
      'where ct_id_contrato=25')
    Left = 608
    Top = 352
  end
end

---------------------------------------------------------------------
.pas
unit RelLivroVale;

interface

uses Windows, SysUtils, Messages, Classes, Graphics, Controls,
  StdCtrls, ExtCtrls, Forms, QuickRpt, QRCtrls, DB, ADODB;

type
  TFRelLivroVale = class(TQuickRep)
    QRBand1: TQRBand;
    PGcab: TQRBand;
    PGrod: TQRBand;
    QRLabel1: TQRLabel;
    QRLabel2: TQRLabel;
    QRLabel3: TQRLabel;
    PGdetails: TQRBand;
    QRLabel4: TQRLabel;
    QRDBText1: TQRDBText;
    ADOQuery1: TADOQuery;
    procedure QRBand1BeforePrint(Sender: TQRCustomBand;
      var PrintBand: Boolean);
    procedure PGdetailsBeforePrint(Sender: TQRCustomBand;
      var PrintBand: Boolean);
    procedure PGcabBeforePrint(Sender: TQRCustomBand;
      var PrintBand: Boolean);
    procedure PGrodBeforePrint(Sender: TQRCustomBand;
      var PrintBand: Boolean);
  private
      v: Boolean;
  public

  end;

var
  FRelLivroVale: TFRelLivroVale;

implementation

{$R *.DFM}

procedure TFRelLivroVale.QRBand1BeforePrint(Sender: TQRCustomBand; var PrintBand: Boolean);
begin
  QRBand1.Height := 800; // This is my pageTitle
end;

procedure TFRelLivroVale.PGdetailsBeforePrint(Sender: TQRCustomBand; var PrintBand: Boolean);
begin
  V := FRelLivroVale.PageNumber >1;
  PrintBand := V
end;

procedure TFRelLivroVale.PGcabBeforePrint(Sender: TQRCustomBand;
  var PrintBand: Boolean);
begin
  V := FRelLivroVale.PageNumber >1;
  PrintBand := V
end;

procedure TFRelLivroVale.PGrodBeforePrint(Sender: TQRCustomBand;
  var PrintBand: Boolean);
begin
  V := FRelLivroVale.PageNumber >1;
  PrintBand :=   V
end;

end.

Open in new window

Avatar of hidrau

ASKER

I tried to use >=1 and the last > 1

Sorry, where I'm now  Delphi is not installed  - I will test the code tomorrow morning.
Avatar of hidrau

ASKER

Ok, I will wait friend, do you believe that I have tried many things and nothing up to now
Avatar of hidrau

ASKER

Hi bokist:

I figured out how to make it :)

I used your clue and I added in the event of after print of the title this option:

quickreport1.newpage

And It worked very fine

Thanks for you help even though
Avatar of hidrau

ASKER

thanks
Hi hidrau!
Glad to helped a wee bit.
Thank's for the points.