给你一个里子:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ppBands, ppCache, ppClass, ppComm, ppRelatv, ppProd, ppReport,
StdCtrls, ppArchiv, ppStrtch, ppMemo, ppPrnabl, ppCtrls, ppDB, ppDBPipe,
DB, ADODB;
type
TForm1 = class(TForm)
Button1: TButton;
ppReport1: TppReport;
ppHeaderBand1: TppHeaderBand;
ppDetailBand1: TppDetailBand;
ppFooterBand1: TppFooterBand;
Button2: TButton;
ppArchiveReader1: TppArchiveReader;
ADOConnection1: TADOConnection;
ADODataSet1: TADODataSet;
DataSource1: TDataSource;
ppDBPipeline1: TppDBPipeline;
ppDBText1: TppDBText;
ppDBMemo1: TppDBMemo;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses ppTypes;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
ppReport1.ShowPrintDialog := False;
ppReport1.DeviceType := dtArchive;
ppReport1.ArchiveFileName := 'c:/test.raf';
ppReport1.Print;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
ppArchiveReader1.ArchiveFileName := 'c:/test.raf';
ppArchiveReader1.DeviceType := dtScreen;
ppArchiveReader1.Print;
end;
end.
//////////////////////// .dfm file//////////////////
object Form1: TForm1
Left = 192
Top = 107
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
PixelsPerInch = 96
TextHeight = 13
object Button1: TButton
Left = 128
Top = 32
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 0
OnClick = Button1Click
end
object Button2: TButton
Left = 136
Top = 160
Width = 75
Height = 25
Caption = 'Button2'
TabOrder = 1
OnClick = Button2Click
end
object ppReport1: TppReport
AutoStop = False
DataPipeline = ppDBPipeline1
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 = 216
Top = 8
Version = '6.03'
mmColumnWidth = 0
DataPipelineName = 'ppDBPipeline1'
object ppHeaderBand1: TppHeaderBand
mmBottomOffset = 0
mmHeight = 18785
mmPrintPosition = 0
end
object ppDetailBand1: TppDetailBand
mmBottomOffset = 0
mmHeight = 13229
mmPrintPosition = 0
object ppDBText1: TppDBText
UserName = 'DBText1'
DataField = 'emp_id'
DataPipeline = ppDBPipeline1
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Name = 'Arial'
Font.Size = 10
Font.Style = []
Transparent = True
DataPipelineName = 'ppDBPipeline1'
mmHeight = 9260
mmLeft = 31221
mmTop = 2910
mmWidth = 25135
BandType = 4
end
object ppDBMemo1: TppDBMemo
UserName = 'DBMemo1'
CharWrap = False
DataField = 'fname'
DataPipeline = ppDBPipeline1
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Name = 'Arial'
Font.Size = 10
Font.Style = []
Transparent = True
DataPipelineName = 'ppDBPipeline1'
mmHeight = 9790
mmLeft = 65088
mmTop = 2646
mmWidth = 48948
BandType = 4
mmBottomOffset = 0
mmOverFlowOffset = 0
mmStopPosition = 0
mmLeading = 0
end
end
object ppFooterBand1: TppFooterBand
mmBottomOffset = 0
mmHeight = 13229
mmPrintPosition = 0
end
end
object ppArchiveReader1: TppArchiveReader
DeviceType = 'Screen'
Left = 24
Top = 152
Version = '6.03'
end
object ADOConnection1: TADOConnection
Connected = True
ConnectionString =
'Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security In' +
'fo=False;Initial Catalog=pubs'
LoginPrompt = False
Provider = 'SQLOLEDB.1'
Left = 8
Top = 8
end
object ADODataSet1: TADODataSet
Active = True
Connection = ADOConnection1
CursorType = ctStatic
CommandText = 'select * from employee'
Parameters = <>
Left = 40
Top = 8
end
object DataSource1: TDataSource
DataSet = ADODataSet1
Left = 72
Top = 8
end
object ppDBPipeline1: TppDBPipeline
DataSource = DataSource1
UserName = 'DBPipeline1'
Left = 112
Top = 8
object ppDBPipeline1ppField1: TppField
FieldAlias = 'emp_id'
FieldName = 'emp_id'
FieldLength = 0
DisplayWidth = 0
Position = 0
end
object ppDBPipeline1ppField2: TppField
FieldAlias = 'fname'
FieldName = 'fname'
FieldLength = 20
DisplayWidth = 20
Position = 1
end
object ppDBPipeline1ppField3: TppField
FieldAlias = 'minit'
FieldName = 'minit'
FieldLength = 1
DisplayWidth = 1
Position = 2
end
object ppDBPipeline1ppField4: TppField
FieldAlias = 'lname'
FieldName = 'lname'
FieldLength = 30
DisplayWidth = 30
Position = 3
end
object ppDBPipeline1ppField5: TppField
Alignment = taRightJustify
FieldAlias = 'job_id'
FieldName = 'job_id'
FieldLength = 0
DataType = dtInteger
DisplayWidth = 10
Position = 4
end
object ppDBPipeline1ppField6: TppField
Alignment = taRightJustify
FieldAlias = 'job_lvl'
FieldName = 'job_lvl'
FieldLength = 0
DataType = dtLongint
DisplayWidth = 10
Position = 5
end
object ppDBPipeline1ppField7: TppField
FieldAlias = 'pub_id'
FieldName = 'pub_id'
FieldLength = 4
DisplayWidth = 4
Position = 6
end
object ppDBPipeline1ppField8: TppField
FieldAlias = 'hire_date'
FieldName = 'hire_date'
FieldLength = 0
DataType = dtDateTime
DisplayWidth = 18
Position = 7
end
end
end
delphi6 sqlserver7