Fórum Número de Página no QuickReport??? #153814
10/04/2003
0
Alguém sabe como colocar o número da página no relatório tipo assim PAGINA 1/N... Página 1 de tantas..????
Grata,
Rafaela :D
Rafaela
Curtir tópico
+ 0Posts
10/04/2003
Vega.x
Faça de acordo com o que o nosso amigo [b:7b48c675aa]Aroldo Zanela[/b:7b48c675aa] já escreveu aqui no fórum:
Supondo que você está utilizando QuickReport:
No evento OnClick você vai utilizar o prepare para obter o número da última página.
Código:
[color=red:7b48c675aa] QuickRep1.Prepare;
cPagina := qrsPagina.Caption;
QuickRep1.PreviewModal; [/color:7b48c675aa]
No evento OnPrint do QRSYSData você concatena antes de efetivamente imprimir:
Código:
[color=red:7b48c675aa]qrsPaginaPrint(sender: TObject; var Value: String);
begin
Value := ´Página: ´ + Value +´/´+cPagina;
end;[/color:7b48c675aa]
espero ter ajudado!
Gostei + 0
10/04/2003
Vega.x
[color=red:24daa91ea3]Olá Amiga![/color:24daa91ea3]
Gostei + 0
10/04/2003
Rafaela
Queria saber se alguém tem um outro jeito de fazer isso...
:wink:
Gostei + 0
10/04/2003
Vega.x
Valeuzzz
Gostei + 0
10/04/2003
Aroldo Zanela
Segue o exemplo completo, com o código em pascal e o DFM para ´desenhar´ o formulário.
Basta pressionar F9 para ver o resultado. Lembrem-se, não funciona em modo de design, ou seja, só funciona em tempo de execução.
Pascal:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Mask, Grids, DBGrids, Db, DBTables, Qrctrls, QuickRpt, ExtCtrls;
type
TForm1 = class(TForm)
Qry: TQuery;
QuickRep1: TQuickRep;
DetailBand1: TQRBand;
PageFooterBand1: TQRBand;
QRDBText1: TQRDBText;
QRSysData1: TQRSysData;
procedure FormCreate(Sender: TObject);
procedure QRSysData1Print(sender: TObject; var Value: String);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
cPagina: String;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
QuickRep1.Prepare;
cPagina := QRSysData1.Caption;
QuickRep1.PreviewModal;
end;
procedure TForm1.QRSysData1Print(sender: TObject; var Value: String);
begin
Value := ´Página: ´ + Value +´/´+cPagina;
end;
end.
DFM:
object Form1: TForm1 Left = 194 Top = 106 Width = 696 Height = 480 Caption = ´Form1´ Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = ´MS Sans Serif´ Font.Style = [] OldCreateOrder = False Scaled = False OnCreate = FormCreate PixelsPerInch = 96 TextHeight = 13 object QuickRep1: TQuickRep Left = 64 Top = 146 Width = 816 Height = 1056 Frame.Color = clBlack Frame.DrawTop = False Frame.DrawBottom = False Frame.DrawLeft = False Frame.DrawRight = False DataSet = Qry Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -13 Font.Name = ´Arial´ Font.Style = [] Functions.Strings = ( ´PAGENUMBER´ ´COLUMNNUMBER´ ´REPORTTITLE´) Functions.DATA = ( ´0´ ´0´ 3939) Options = [FirstPageHeader, LastPageFooter] Page.Columns = 1 Page.Orientation = poPortrait Page.PaperSize = Letter Page.Values = ( 100 2794 100 2159 100 100 0) PrinterSettings.Copies = 1 PrinterSettings.Duplex = False PrinterSettings.FirstPage = 0 PrinterSettings.LastPage = 0 PrinterSettings.OutputBin = Auto PrintIfEmpty = True SnapToGrid = True Units = MM Zoom = 100 object DetailBand1: TQRBand Left = 38 Top = 38 Width = 740 Height = 40 Frame.Color = clBlack Frame.DrawTop = False Frame.DrawBottom = False Frame.DrawLeft = False Frame.DrawRight = False AlignToBottom = False Color = clWhite ForceNewColumn = False ForceNewPage = False Size.Values = ( 105.833333333333 1957.91666666667) BandType = rbDetail object QRDBText1: TQRDBText Left = 62 Top = 4 Width = 72 Height = 17 Frame.Color = clBlack Frame.DrawTop = False Frame.DrawBottom = False Frame.DrawLeft = False Frame.DrawRight = False Size.Values = ( 44.9791666666667 164.041666666667 10.5833333333333 190.5) Alignment = taLeftJustify AlignToBand = False AutoSize = True AutoStretch = False Color = clWhite DataSet = Qry DataField = ´AmountPaid´ Transparent = False WordWrap = True FontSize = 10 end end object PageFooterBand1: TQRBand Left = 38 Top = 78 Width = 740 Height = 40 Frame.Color = clBlack Frame.DrawTop = False Frame.DrawBottom = False Frame.DrawLeft = False Frame.DrawRight = False AlignToBottom = False Color = clWhite ForceNewColumn = False ForceNewPage = False Size.Values = ( 105.8 1957.91666666667) BandType = rbPageFooter object QRSysData1: TQRSysData Left = 310 Top = 14 Width = 8 Height = 17 Frame.Color = clBlack Frame.DrawTop = False Frame.DrawBottom = False Frame.DrawLeft = False Frame.DrawRight = False Size.Values = ( 44.9791666666667 820.208333333333 37.0416666666667 21.1666666666667) Alignment = taLeftJustify AlignToBand = False AutoSize = True Color = clWhite Data = qrsPageNumber OnPrint = QRSysData1Print Transparent = False FontSize = 10 end end end object Qry: TQuery Active = True DatabaseName = ´DBDEMOS´ SQL.Strings = ( ´SELECT * FROM ORDERS´) Left = 72 Top = 26 end end
Gostei + 0
10/04/2003
Rafaela
Gostei + 0
10/04/2003
Aroldo Zanela
Rafaela,
Copie todo o código DFM a partir de ´object QuickRep1: TQuickRep´ (Ctrl V), vai no Delphi e Crie um novo projeto e pressione Ctrl V, isso vai adicionar os controles no formulário exatamente como eu fiz.
Gostei + 0
10/04/2003
Aroldo Zanela
Rafaela,
Copie todo o código DFM a partir de ´object QuickRep1: TQuickRep´ (Ctrl C), vai no Delphi e Crie um novo projeto e pressione Ctrl V, isso vai adicionar os controles no formulário exatamente como eu fiz.
Ctrl C e em seguida Ctrl V sobre o formulário e não sobre o código.
Gostei + 0
10/04/2003
Marioguedes
QRLabel1.Caption := IntToStr(ComponenteTQuickRep.QRPrinter.PageCount);
Essa intrução lhe dá o total de páginas de um determindo reltário e deve ser dado [b:b6084e8fd5]antes do Preview do relatório.[/b:b6084e8fd5]
Um exemplo de como uso:
fRelPosPed := TfRelPosPed.Create(Self);
fRelPosPed.qrRelPosPed.Prepare;
fRelPosPed.[b]QRLabel1.Caption := IntToStr(fRelPosPed.qrRelPosPed..QRPrinter.PageCount);
fRelPosPed.qrRelPosPed.Preview;
fRelPosPed.Close;
fRelPosPed.Free;
fRelPosPed := nil;
Entedeu?
Gostei + 0
10/04/2003
Anonymous
Leandro
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)