//PAS
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
QuickRpt, Qrctrls, StdCtrls, Db, ADODB, ExtCtrls, Grids, DBGrids;
type
TForm1 = class(TForm)
QuickRep1: TQuickRep;
DetailBand1: TQRBand;
DataSource1: TDataSource;
ADOConnection1: TADOConnection;
ADOTable1: TADOTable;
Button1: TButton;
QRLabel1: TQRLabel;
QRLabel2: TQRLabel;
DBGrid1: TDBGrid;
procedure Button1Click(Sender: TObject);
procedure DetailBand1BeforePrint(Sender: TQRCustomBand;
var PrintBand: Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
ADOTable1.Open;
ADOTable1.First;
QuickRep1.Preview;
end;
procedure TForm1.DetailBand1BeforePrint(Sender: TQRCustomBand;
var PrintBand: Boolean);
begin
QRLabel2.caption := '';
if not ADOTable1.Eof then
begin
QRLabel1.Caption := ADOTable1.Fields[0].AsString ;
ADOTable1.next;
end;
if not ADOTable1.Eof then
begin
QRLabel2.Caption := ADOTable1.Fields[0].AsString ;
end;
end;
end.
//DFM
object Form1: TForm1
Left = 192
Top = 107
Width = 544
Height = 375
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
PixelsPerInch = 96
TextHeight = 13
object QuickRep1: TQuickRep
Left = 40
Top = 224
Width = 794
Height = 1123
Frame.Color = clBlack
Frame.DrawTop = False
Frame.DrawBottom = False
Frame.DrawLeft = False
Frame.DrawRight = False
DataSet = ADOTable1
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Arial'
Font.Style = []
Functions.Strings = (
'PAGENUMBER'
'COLUMNNUMBER'
'REPORTTITLE')
Functions.DATA = (
'0'
'0'
#39#39)
Options = [FirstPageHeader, LastPageFooter]
Page.Columns = 1
Page.Orientation = poPortrait
Page.PaperSize = A4
Page.Values = (
100
2970
100
2100
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 = 718
Height = 40
Frame.Color = clBlack
Frame.DrawTop = False
Frame.DrawBottom = False
Frame.DrawLeft = False
Frame.DrawRight = False
AlignToBottom = False
BeforePrint = DetailBand1BeforePrint
Color = clWhite
ForceNewColumn = False
ForceNewPage = False
Size.Values = (
105.833333333333
1899.70833333333)
BandType = rbDetail
object QRLabel1: TQRLabel
Left = 40
Top = 16
Width = 58
Height = 17
Frame.Color = clBlack
Frame.DrawTop = False
Frame.DrawBottom = False
Frame.DrawLeft = False
Frame.DrawRight = False
Size.Values = (
44.9791666666667
105.833333333333
42.3333333333333
153.458333333333)
Alignment = taLeftJustify
AlignToBand = False
AutoSize = True
AutoStretch = False
Caption = 'QRLabel1'
Color = clWhite
Transparent = False
WordWrap = True
FontSize = 10
end
object QRLabel2: TQRLabel
Left = 240
Top = 16
Width = 58
Height = 17
Frame.Color = clBlack
Frame.DrawTop = False
Frame.DrawBottom = False
Frame.DrawLeft = False
Frame.DrawRight = False
Size.Values = (
44.9791666666667
635
42.3333333333333
153.458333333333)
Alignment = taLeftJustify
AlignToBand = False
AutoSize = True
AutoStretch = False
Caption = 'QRLabel2'
Color = clWhite
Transparent = False
WordWrap = True
FontSize = 10
end
end
end
object Button1: TButton
Left = 112
Top = 16
Width = 75
Height = 25
Caption = '预览'
TabOrder = 1
OnClick = Button1Click
end
object DBGrid1: TDBGrid
Left = 104
Top = 56
Width = 353
Height = 153
DataSource = DataSource1
TabOrder = 2
TitleFont.Charset = DEFAULT_CHARSET
TitleFont.Color = clWindowText
TitleFont.Height = -11
TitleFont.Name = 'MS Sans Serif'
TitleFont.Style = []
end
object DataSource1: TDataSource
DataSet = ADOTable1
Left = 32
Top = 24
end
object ADOConnection1: TADOConnection
Connected = True
ConnectionString =
'Provider=Microsoft.Jet.OLEDB.4.0;Password="";User ID=Admin;Data ' +
'Source=C:/Program Files/Common Files/Borland Shared/Data/dbdemos' +
'.mdb;Mode=Share Deny None;Extended Properties="";Jet OLEDB:Syste' +
'm database="";Jet OLEDB:Registry Path="";Jet OLEDB
atabase Pass' +
'word="";Jet OLEDB:Engine Type=5;Jet OLEDB
atabase Locking Mode=' +
'1;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Tran' +
'sactions=1;Jet OLEDB:New Database Password="";Jet OLEDB:Create S' +
'ystem Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:' +
'Don'#39't Copy Locale on Compact=False;Jet OLEDB:Compact Without Rep' +
'lica Repair=False;Jet OLEDB:SFP=False'
LoginPrompt = False
Mode = cmShareDenyNone
Provider = 'Microsoft.Jet.OLEDB.4.0'
Left = 80
Top = 112
end
object ADOTable1: TADOTable
Connection = ADOConnection1
TableName = 'country'
Left = 64
Top = 208
end
end