做了一个例子,可惜没法把数据库贴到这里 ,^_^
dpr:
program repquick;
uses
Forms,
repquickUnit in 'repquickUnit.pas' {Form1};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
//////////
dfm:
object Form1: TForm1
Left = 99
Top = 165
Width = 688
Height = 397
Caption = 'Form1'
Color = clBtnFace
Font.Charset = GB2312_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = '宋体'
Font.Style = []
OldCreateOrder = False
Scaled = False
PixelsPerInch = 96
TextHeight = 12
object QuickRep1: TQuickRep
Left = -28
Top = -24
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 = -12
Font.Name = '宋体'
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
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 ColumnHeaderBand1: 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
Color = clWhite
ForceNewColumn = False
ForceNewPage = False
Size.Values = (
105.833333333333
1899.70833333333)
BandType = rbColumnHeader
end
object DetailBand1: TQRBand
Left = 38
Top = 78
Width = 718
Height = 29
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 = (
76.7291666666667
1899.70833333333)
BandType = rbDetail
object QRDBText1: TQRDBText
Left = 16
Top = 3
Width = 25
Height = 17
Frame.Color = clBlack
Frame.DrawTop = False
Frame.DrawBottom = False
Frame.DrawLeft = False
Frame.DrawRight = False
Size.Values = (
44.9791666666667
42.3333333333333
7.9375
66.1458333333333)
Alignment = taLeftJustify
AlignToBand = False
AutoSize = True
AutoStretch = False
Color = clWhite
DataSet = ADOQuery1
DataField = 'DWMC'
Transparent = False
WordWrap = True
FontSize = 9
end
object QRDBText2: TQRDBText
Left = 232
Top = 3
Width = 25
Height = 17
Frame.Color = clBlack
Frame.DrawTop = False
Frame.DrawBottom = False
Frame.DrawLeft = False
Frame.DrawRight = False
Size.Values = (
44.9791666666667
613.833333333333
7.9375
66.1458333333333)
Alignment = taLeftJustify
AlignToBand = False
AutoSize = True
AutoStretch = False
Color = clWhite
DataSet = ADOQuery1
DataField = 'JHND'
Transparent = False
WordWrap = True
FontSize = 9
end
object QRDBText3: TQRDBText
Left = 388
Top = -1
Width = 25
Height = 17
Frame.Color = clBlack
Frame.DrawTop = False
Frame.DrawBottom = False
Frame.DrawLeft = False
Frame.DrawRight = False
Size.Values = (
44.9791666666667
1026.58333333333
-2.64583333333333
66.1458333333333)
Alignment = taLeftJustify
AlignToBand = False
AutoSize = True
AutoStretch = False
Color = clWhite
DataSet = ADOQuery1
DataField = 'JHLX'
Transparent = False
WordWrap = True
FontSize = 9
end
end
object QRSubDetail1: TQRSubDetail
Left = 38
Top = 107
Width = 718
Height = 21
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 = (
55.5625
1899.70833333333)
Master = QuickRep1
DataSet = ADOQuery2
PrintBefore = False
PrintIfEmpty = True
object QRShape1: TQRShape
Left = 4
Top = 0
Width = 469
Height = 21
Frame.Color = clBlack
Frame.DrawTop = False
Frame.DrawBottom = False
Frame.DrawLeft = False
Frame.DrawRight = False
Size.Values = (
55.5625
10.5833333333333
0
1240.89583333333)
Shape = qrsRectangle
end
object QRDBText4: TQRDBText
Left = 388
Top = 2
Width = 25
Height = 17
Frame.Color = clBlack
Frame.DrawTop = False
Frame.DrawBottom = False
Frame.DrawLeft = False
Frame.DrawRight = False
Size.Values = (
44.9791666666667
1026.58333333333
5.29166666666667
66.1458333333333)
Alignment = taLeftJustify
AlignToBand = False
AutoSize = True
AutoStretch = False
Color = clWhite
DataSet = ADOQuery2
DataField = 'SPLB'
Transparent = False
WordWrap = True
FontSize = 9
end
object QRDBText5: TQRDBText
Left = 232
Top = 2
Width = 25
Height = 17
Frame.Color = clBlack
Frame.DrawTop = False
Frame.DrawBottom = False
Frame.DrawLeft = False
Frame.DrawRight = False
Size.Values = (
44.9791666666667
613.833333333333
5.29166666666667
66.1458333333333)
Alignment = taLeftJustify
AlignToBand = False
AutoSize = True
AutoStretch = False
Color = clWhite
DataSet = ADOQuery2
DataField = 'SPSL'
Transparent = False
WordWrap = True
FontSize = 9
end
object QRDBText6: TQRDBText
Left = 20
Top = 2
Width = 25
Height = 17
Frame.Color = clBlack
Frame.DrawTop = False
Frame.DrawBottom = False
Frame.DrawLeft = False
Frame.DrawRight = False
Size.Values = (
44.9791666666667
52.9166666666667
5.29166666666667
66.1458333333333)
Alignment = taLeftJustify
AlignToBand = False
AutoSize = True
AutoStretch = False
Color = clWhite
DataSet = ADOQuery2
DataField = 'SPMC'
Transparent = False
WordWrap = True
FontSize = 9
end
object QRShape2: TQRShape
Left = 208
Top = 1
Width = 1
Height = 19
Frame.Color = clBlack
Frame.DrawTop = False
Frame.DrawBottom = False
Frame.DrawLeft = False
Frame.DrawRight = False
Size.Values = (
50.2708333333333
550.333333333333
2.64583333333333
2.64583333333333)
Shape = qrsRectangle
end
object QRShape3: TQRShape
Left = 317
Top = 1
Width = 1
Height = 20
Frame.Color = clBlack
Frame.DrawTop = False
Frame.DrawBottom = False
Frame.DrawLeft = False
Frame.DrawRight = False
Size.Values = (
52.9166666666667
838.729166666667
2.64583333333333
2.64583333333333)
Shape = qrsRectangle
end
end
end
object ADOConnection1: TADOConnection
Connected = True
ConnectionString =
'Provider=SQLOLEDB.1;Password=admin;Persist Security Info=True;Us' +
'er ID=sa;Initial Catalog=sale;Data Source=zzz'
LoginPrompt = False
Provider = 'SQLOLEDB.1'
Left = 40
Top = 20
end
object ADOQuery1: TADOQuery
Active = false
Connection = ADOConnection1
CursorType = ctStatic
Parameters = <>
SQL.Strings = (
'select * from T_jhqk')
Left = 124
Top = 20
end
object ADOQuery2: TADOQuery
Active = True
Connection = ADOConnection1
CursorType = ctStatic
Parameters = <>
SQL.Strings = (
'select * from T_jhmx')
Left = 204
Top = 20
end
end
///////////////////
pas:
unit repquickUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, QuickRpt, QRCtrls, ExtCtrls;
type
TForm1 = class(TForm)
QuickRep1: TQuickRep;
ColumnHeaderBand1: TQRBand;
DetailBand1: TQRBand;
QRSubDetail1: TQRSubDetail;
QRDBText1: TQRDBText;
QRDBText2: TQRDBText;
QRDBText3: TQRDBText;
QRDBText4: TQRDBText;
QRDBText5: TQRDBText;
QRDBText6: TQRDBText;
ADOConnection1: TADOConnection;
ADOQuery1: TADOQuery;
ADOQuery2: TADOQuery;
QRShape1: TQRShape;
QRShape2: TQRShape;
QRShape3: TQRShape;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
end.