to Fox2008!ReportBuider本来就有这个功能啊。
你看这个Demo!
如果你测试通过记得发分啦。
吧下边这两个文件copy 到文本里面,
分别取名为Unit1.pas 和unit1.pas就行啦。
贴的太长啦,在此向各位道歉啦。
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
TFlatButtonUnit, TFlatHintUnit, TFlatSpeedButtonUnit, TFlatEditUnit,
StdCtrls, TFlatMemoUnit, TFlatListBoxUnit, TFlatComboBoxUnit,
TFlatCheckBoxUnit, ppCtrls, ppPrnabl, ppClass, ppDB, ppBands, ppCache,
Db, DBTables, ppProd, ppReport, ppComm, ppRelatv, ppDBPipe, ppDBBDE,
ppStrtch, ppRegion;
type
TForm1 = class(TForm)
ppBDEPipeline1: TppBDEPipeline;
ppReport1: TppReport;
DataSource1: TDataSource;
Query1: TQuery;
ppHeaderBand1: TppHeaderBand;
ppDetailBand1: TppDetailBand;
ppFooterBand1: TppFooterBand;
ppLabel1: TppLabel;
ppLabel2: TppLabel;
Button1: TButton;
ppRegion1: TppRegion;
ppDBText3: TppDBText;
ppDBText2: TppDBText;
ppDBText1: TppDBText;
ppLine1: TppLine;
ppLabel3: TppLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
ppReport1.Print;
end;
end.
object Form1: TForm1
Left = 192
Top = 107
Width = 260
Height = 246
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Button1: TButton
Left = 72
Top = 144
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 0
OnClick = Button1Click
end
object ppBDEPipeline1: TppBDEPipeline
DataSource = DataSource1
UserName = 'BDEPipeline1'
Left = 104
Top = 32
object ppBDEPipeline1ppField1: TppField
Alignment = taRightJustify
FieldAlias = 'OrderNo'
FieldName = 'OrderNo'
FieldLength = 0
DataType = dtDouble
DisplayWidth = 10
Position = 0
end
object ppBDEPipeline1ppField2: TppField
Alignment = taRightJustify
FieldAlias = 'ItemNo'
FieldName = 'ItemNo'
FieldLength = 0
DataType = dtDouble
DisplayWidth = 10
Position = 1
end
object ppBDEPipeline1ppField3: TppField
Alignment = taRightJustify
FieldAlias = 'PartNo'
FieldName = 'PartNo'
FieldLength = 0
DataType = dtDouble
DisplayWidth = 10
Position = 2
end
object ppBDEPipeline1ppField4: TppField
Alignment = taRightJustify
FieldAlias = 'Qty'
FieldName = 'Qty'
FieldLength = 0
DataType = dtInteger
DisplayWidth = 10
Position = 3
end
object ppBDEPipeline1ppField5: TppField
Alignment = taRightJustify
FieldAlias = 'Discount'
FieldName = 'Discount'
FieldLength = 0
DataType = dtDouble
DisplayWidth = 10
Position = 4
end
end
object ppReport1: TppReport
AutoStop = False
DataPipeline = ppBDEPipeline1
PrinterSetup.BinName = 'Default'
PrinterSetup.DocumentName = 'Report'
PrinterSetup.PaperName = 'Letter'
PrinterSetup.PrinterName = 'Default'
PrinterSetup.mmMarginBottom = 6350
PrinterSetup.mmMarginLeft = 6350
PrinterSetup.mmMarginRight = 6350
PrinterSetup.mmMarginTop = 6350
PrinterSetup.mmPaperHeight = 279401
PrinterSetup.mmPaperWidth = 215900
PrinterSetup.PaperSize = 1
DeviceType = 'Screen'
Left = 176
Top = 32
Version = '6.03'
mmColumnWidth = 0
DataPipelineName = 'ppBDEPipeline1'
object ppHeaderBand1: TppHeaderBand
mmBottomOffset = 0
mmHeight = 17463
mmPrintPosition = 0
object ppLabel1: TppLabel
UserName = 'Label1'
Caption = 'header'
Font.Charset = DEFAULT_CHARSET
Font.Color = clGreen
Font.Name = 'Arial'
Font.Size = 28
Font.Style = [fsBold]
Transparent = True
mmHeight = 11684
mmLeft = 44186
mmTop = 529
mmWidth = 32427
BandType = 0
end
end
object ppDetailBand1: TppDetailBand
mmBottomOffset = 0
mmHeight = 8996
mmPrintPosition = 0
object ppRegion1: TppRegion
UserName = 'Region1'
Caption = 'Region1'
mmHeight = 8996
mmLeft = 33073
mmTop = 0
mmWidth = 74348
BandType = 4
mmBottomOffset = 0
mmOverFlowOffset = 0
mmStopPosition = 0
object ppDBText3: TppDBText
UserName = 'DBText3'
DataField = 'PartNo'
DataPipeline = ppBDEPipeline1
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Name = 'Arial'
Font.Size = 10
Font.Style = []
Transparent = True
DataPipelineName = 'ppBDEPipeline1'
mmHeight = 3969
mmLeft = 86519
mmTop = 2646
mmWidth = 17198
BandType = 4
end
object ppDBText2: TppDBText
UserName = 'DBText2'
DataField = 'OrderNo'
DataPipeline = ppBDEPipeline1
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Name = 'Arial'
Font.Size = 10
Font.Style = []
Transparent = True
DataPipelineName = 'ppBDEPipeline1'
mmHeight = 3969
mmLeft = 67469
mmTop = 2646
mmWidth = 17198
BandType = 4
end
object ppDBText1: TppDBText
UserName = 'DBText1'
DataField = 'ItemNo'
DataPipeline = ppBDEPipeline1
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Name = 'Arial'
Font.Size = 10
Font.Style = []
Transparent = True
DataPipelineName = 'ppBDEPipeline1'
mmHeight = 3969
mmLeft = 48683
mmTop = 2646
mmWidth = 17198
BandType = 4
end
object ppLabel3: TppLabel
UserName = 'Label3'
Caption = '内容'
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Name = 'Arial'
Font.Size = 10
Font.Style = []
Transparent = True
mmHeight = 3969
mmLeft = 34925
mmTop = 3439
mmWidth = 7144
BandType = 4
end
end
object ppLine1: TppLine
UserName = 'Line1'
Position = lpLeft
Weight = 0.75
mmHeight = 8467
mmLeft = 43392
mmTop = 0
mmWidth = 1323
BandType = 4
end
end
object ppFooterBand1: TppFooterBand
mmBottomOffset = 0
mmHeight = 13229
mmPrintPosition = 0
object ppLabel2: TppLabel
UserName = 'Label2'
Caption = 'footer'
Font.Charset = DEFAULT_CHARSET
Font.Color = clRed
Font.Name = 'Arial'
Font.Size = 20
Font.Style = [fsBold]
Transparent = True
mmHeight = 8467
mmLeft = 32279
mmTop = 529
mmWidth = 20108
BandType = 8
end
end
end
object DataSource1: TDataSource
DataSet = Query1
Left = 64
Top = 32
end
object Query1: TQuery
Active = True
DatabaseName = 'DBDEMOS'
SQL.Strings = (
'select * from items')
Left = 144
Top = 32
end
end