unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, StdCtrls, QRCtrls, QuickRpt, ExtCtrls;
type
TForm1 = class(TForm)
ADODataSet1: TADODataSet;
ADODataSet1a: TStringField;
ADODataSet1b: TIntegerField;
QuickRep1: TQuickRep;
DetailBand1: TQRBand;
QRGroup1: TQRGroup;
QRBand1: TQRBand;
QRDBText1: TQRDBText;
QRDBText2: TQRDBText;
QRExpr1: TQRExpr;
Button1: TButton;
QRLabel1: TQRLabel;
ColumnHeaderBand1: TQRBand;
QRLabel2: TQRLabel;
QRLabel3: TQRLabel;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
ADODataSet1.CreateDataSet;
ADODataSet1.Append;
ADODataSet1.FieldByName('a').AsString := '水果';
ADODataSet1.FieldByName('b').AsInteger := 1;
ADODataSet1.Append;
ADODataSet1.FieldByName('a').AsString := '水果';
ADODataSet1.FieldByName('b').AsInteger := 2;
ADODataSet1.Append;
ADODataSet1.FieldByName('a').AsString := '水果';
ADODataSet1.FieldByName('b').AsInteger := 2;
ADODataSet1.Append;
ADODataSet1.FieldByName('a').AsString := '服装';
ADODataSet1.FieldByName('b').AsInteger := 3;
ADODataSet1.Append;
ADODataSet1.FieldByName('a').AsString := '服装';
ADODataSet1.FieldByName('b').AsInteger := 1;
ADODataSet1.Append;
ADODataSet1.FieldByName('a').AsString := '服装';
ADODataSet1.FieldByName('b').AsInteger := 4;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
QuickRep1.Preview;
end;
end.
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
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object QuickRep1: TQuickRep
Left = 144
Top = 32
Width = 794
Height = 1123
Frame.Color = clBlack
Frame.DrawTop = False
Frame.DrawBottom = False
Frame.DrawLeft = False
Frame.DrawRight = False
DataSet = ADODataSet1
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
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 = 72
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 = rbDetail
object QRDBText1: TQRDBText
Left = 32
Top = 16
Width = 8
Height = 17
Frame.Color = clBlack
Frame.DrawTop = False
Frame.DrawBottom = False
Frame.DrawLeft = False
Frame.DrawRight = False
Size.Values = (
44.9791666666667
84.6666666666667
42.3333333333333
21.1666666666667)
Alignment = taLeftJustify
AlignToBand = False
AutoSize = True
AutoStretch = False
Color = clWhite
DataSet = ADODataSet1
DataField = 'a'
Transparent = False
WordWrap = True
FontSize = 10
end
object QRDBText2: TQRDBText
Left = 144
Top = 16
Width = 8
Height = 17
Frame.Color = clBlack
Frame.DrawTop = False
Frame.DrawBottom = False
Frame.DrawLeft = False
Frame.DrawRight = False
Size.Values = (
44.9791666666667
381
42.3333333333333
21.1666666666667)
Alignment = taLeftJustify
AlignToBand = False
AutoSize = True
AutoStretch = False
Color = clWhite
DataSet = ADODataSet1
DataField = 'b'
Transparent = False
WordWrap = True
FontSize = 10
end
end
object QRGroup1: TQRGroup
Left = 38
Top = 68
Width = 718
Height = 4
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 = (
10.5833333333333
1899.70833333333)
Expression = 'ADODataSet1.a'
FooterBand = QRBand1
Master = QuickRep1
ReprintOnNewPage = False
end
object QRBand1: TQRBand
Left = 38
Top = 112
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 = rbGroupFooter
object QRExpr1: TQRExpr
Left = 144
Top = 8
Width = 131
Height = 17
Frame.Color = clBlack
Frame.DrawTop = False
Frame.DrawBottom = False
Frame.DrawLeft = False
Frame.DrawRight = False
Size.Values = (
44.9791666666667
381
21.1666666666667
346.604166666667)
Alignment = taLeftJustify
AlignToBand = False
AutoSize = True
AutoStretch = False
Color = clWhite
ResetAfterPrint = True
Transparent = False
WordWrap = True
Expression = 'SUM(ADODataSet1.b)'
FontSize = 10
end
object QRLabel1: TQRLabel
Left = 72
Top = 8
Width = 49
Height = 17
Frame.Color = clBlack
Frame.DrawTop = False
Frame.DrawBottom = False
Frame.DrawLeft = False
Frame.DrawRight = False
Size.Values = (
44.9791666666667
190.5
21.1666666666667
129.645833333333)
Alignment = taLeftJustify
AlignToBand = False
AutoSize = True
AutoStretch = False
Caption = '小记:'
Color = clWhite
Transparent = False
WordWrap = True
FontSize = 10
end
end
object ColumnHeaderBand1: TQRBand
Left = 38
Top = 38
Width = 718
Height = 30
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 = (
79.375
1899.70833333333)
BandType = rbColumnHeader
object QRLabel2: TQRLabel
Left = 32
Top = 16
Width = 33
Height = 17
Frame.Color = clBlack
Frame.DrawTop = False
Frame.DrawBottom = False
Frame.DrawLeft = False
Frame.DrawRight = False
Size.Values = (
44.9791666666667
84.6666666666667
42.3333333333333
87.3125)
Alignment = taLeftJustify
AlignToBand = False
AutoSize = True
AutoStretch = False
Caption = '品名'
Color = clWhite
Transparent = False
WordWrap = True
FontSize = 10
end
object QRLabel3: TQRLabel
Left = 144
Top = 16
Width = 33
Height = 17
Frame.Color = clBlack
Frame.DrawTop = False
Frame.DrawBottom = False
Frame.DrawLeft = False
Frame.DrawRight = False
Size.Values = (
44.9791666666667
381
42.3333333333333
87.3125)
Alignment = taLeftJustify
AlignToBand = False
AutoSize = True
AutoStretch = False
Caption = '数量'
Color = clWhite
Transparent = False
WordWrap = True
FontSize = 10
end
end
end
object Button1: TButton
Left = 64
Top = 208
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 1
OnClick = Button1Click
end
object ADODataSet1: TADODataSet
Parameters = <>
Left = 64
Top = 72
object ADODataSet1a: TStringField
FieldName = 'a'
end
object ADODataSet1b: TIntegerField
FieldName = 'b'
end
end
end