📄 basicexp.pas
字号:
{
===================
E X S P O R T E R S
===================
Version 2.0
!!!!!!!!!! a open export interface !!!!!!!!!!
Copyright 11.1997 By MAD Soft
Telephone: Bulgaria, Sofia, 37-06-23
E_Mail: NMMM@NSI.BG
NMMM@HotMail.Com
Web: Http:\\WWW.NSI.BG\NMMM\Home.Htm
==============================================
Hierarchie Tree:
Canals (Chanells)
-----------------
--------Printer
/
--------AbstractFile=---------File=-------Appl
/ \
/ --------Console
/
Abstract(8)=---------Memo
\
--------CGI
==============================================
(8) Abstract Object
Exporters
---------
-----Text------------Text_HTML
/
-------HTML(*)(1)
/
Abstract(8)=--------GRV(*)(2)
\
-------RTF_Beta(*)
\
-----Post_Script(3)
==============================================
(8) Abstract Object
(*) In external PAS file
(1) HTML Exporter is shareware!!!!!! See HTMLExp documentation for details.
(2) Gunev Report Viewer. Copyright by Vasil Gounev ( VAGSoft@HotMail.Com )
(3) Coming Soon ;o)
Version History
===============
1.0 10.1997 - First Build
2.0 11.1997 - Added Canals
2.1 12.1997 - Added AbstractFile Canal and ConsoleCanal
}
unit BasicExp;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, Printers, StdCtrls, Strings1;
Type TExpAlign = (REAlignNone,
REAlignLeft,REAlignCenter,REAlignRight,
REAlignJust);
TExpFontStyle = Set Of (REBold,REItalic,REUnderline,
RETeleType);
TExpFontSize = 1..10;
TExpBorder = Byte;
{===================================================================}
type
TAbstractCanal = class(TComponent)
private
{ Private declarations }
protected
{ Protected declarations }
public
{ Public declarations }
Procedure Open; Virtual;
Procedure Close; Virtual;
Procedure Output(S:String); Virtual;
Procedure OutputLn; Virtual;
published
{ Published declarations }
end;
TAbstractFileCanal = class(TAbstractCanal)
private
{ Private declarations }
protected
{ Protected declarations }
FOEMConvert : Boolean;
F : TextFile;
property OEMConvert : Boolean Read FOEMConvert Write FOEMConvert;
public
{ Public declarations }
Constructor Create(aOwner:TComponent); OverRide;
Procedure Close; OverRide;
Procedure Output(S:String); OverRide;
Procedure OutputLn; OverRide;
published
{ Published declarations }
end;
TFileCanal = class(TAbstractFileCanal)
private
{ Private declarations }
FOverWriteFile : Boolean;
protected
{ Protected declarations }
FFileName : TFileName;
public
{ Public declarations }
Constructor Create(aOwner:TComponent); OverRide;
Procedure Open; OverRide;
published
{ Published declarations }
property FileName : TFileName Read FFileName Write FFileName;
property OverWriteFile : Boolean Read FOverWriteFile Write FOverWriteFile;
property OEMConvert;
end;
TApplCanal = class(TFileCanal)
private
{ Private declarations }
FApplName : TString;
protected
{ Protected declarations }
public
{ Public declarations }
Procedure Close; OverRide;
published
{ Published declarations }
property ApplName : TString Read FApplName Write FApplName;
end;
TPrinterCanal = class(TAbstractFileCanal)
private
{ Private declarations }
FOrientation : TPrinterOrientation;
FFont : TFont;
Procedure SetFont(AFont:TFont);
protected
{ Protected declarations }
public
{ Public declarations }
Constructor Create(aOwner:TComponent); OverRide;
Destructor Destroy; OverRide;
Procedure Open; OverRide;
published
{ Published declarations }
Property Orientation : TPrinterOrientation Read FOrientation Write FOrientation;
Property Font : TFont Read FFont Write SetFont;
end;
TConsoleCanal = class(TAbstractFileCanal)
private
{ Private declarations }
protected
{ Protected declarations }
public
{ Public declarations }
Procedure Open; OverRide;
published
{ Published declarations }
property OEMConvert;
end;
TMemoCanal = class(TAbstractCanal)
private
{ Private declarations }
FMemo : TMemo;
MemoLine : String;
protected
{ Protected declarations }
public
{ Public declarations }
Procedure Open; OverRide;
Procedure Close; OverRide;
Procedure Output(S:String); OverRide;
Procedure OutputLn; OverRide;
published
{ Published declarations }
Property Memo : TMemo Read FMemo Write FMemo;
end;
{===========================================================================}
{===========================================================================}
type
TAbstractExporter = class(TComponent)
private
{ Private declarations }
FCanal : TAbstractCanal;
protected
{ Protected declarations }
Procedure Output(S:String); Virtual;
Procedure OutputLn(S:String); Virtual;
public
{ Public declarations }
Procedure Open; Virtual;
Procedure Close; Virtual;
Procedure BeginParagraph(Align:TExpAlign;FontSize:TExpFontSize;FontStyle:TExpFontStyle); Virtual;
Procedure Paragraph(S:String); Virtual;
Procedure EndParagraph; Virtual;
Procedure QuickParagraph(S:String;Align:TExpAlign;FontSize:TExpFontSize;FontStyle:TExpFontStyle);
Procedure IndentPlus; Virtual;
Procedure IndentMinus; Virtual;
Procedure BeginTable(Border:TExpBorder); Virtual;
Procedure BeginRow; Virtual;
Procedure Cell(S:String;Align:TExpAlign;FontSize:TExpFontSize;FontStyle:TExpFontStyle); Virtual;
Procedure EndRow; Virtual;
Procedure EndTable; Virtual;
published
{ Published declarations }
Property Canal : TAbstractCanal Read FCanal Write FCanal;
end;
type
TTextExporter = class(TAbstractExporter)
private
{ Private declarations }
protected
{ Protected declarations }
public
{ Public declarations }
Procedure Paragraph(S:String); OverRide;
Procedure EndParagraph; OverRide;
published
{ Published declarations }
end;
type
TTextHTMLExporter = class(TTextExporter)
private
{ Private declarations }
protected
{ Protected declarations }
public
{ Public declarations }
Procedure Open; OverRide;
Procedure Close; OverRide;
published
{ Published declarations }
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Exporter', [TFileCanal]);
RegisterComponents('Exporter', [TPrinterCanal]);
RegisterComponents('Exporter', [TMemoCanal]);
RegisterComponents('Exporter', [TApplCanal]);
RegisterComponents('Exporter', [TConsoleCanal]);
RegisterComponents('Exporter', [TTextExporter]);
RegisterComponents('Exporter', [TTextHTMLExporter]);
end;
{=======================================}
Procedure TAbstractCanal.Open;
Begin
End;
Procedure TAbstractCanal.Close;
Begin
End;
Procedure TAbstractCanal.Output(S:String);
Begin
End;
Procedure TAbstractCanal.OutputLn;
Begin
End;
{=================================}
Constructor TAbstractFileCanal.Create(aOwner:TComponent);
Begin
Inherited Create(AOwner);
FOEMConvert:=False;
End;
Procedure TAbstractFileCanal.Close;
Begin
CloseFile(F);
Inherited Close;
End;
Procedure TAbstractFileCanal.Output(S:String);
Var SO : String;
Begin
If FOEMConvert Then
AnsiToOEMBuff(@S[1], @SO[1], Length(S) )
Else
SO:=S;
Write(F,SO);
End;
Procedure TAbstractFileCanal.OutputLn;
Begin
WriteLn(F);
End;
{=======================================}
Constructor TFileCanal.Create(aOwner:TComponent);
Begin
Inherited Create(AOwner);
FOverWriteFile:=True;
End;
Procedure TFileCanal.Open;
Begin
Inherited Open;
AsSignFile(F,FFileName);
If FOverWriteFile Then
ReWrite(F)
Else
Append(F);
End;
{=======================================}
Procedure TApplCanal.Close;
Const FF = '{FILE}';
FP = '{PATH}';
FN = '{NAME}';
FE = '{EXT}';
Var S : String;
Begin
Inherited Close;
S:=FApplName;
ChangeMacro(S,FF,FFileName);
ChangeMacro(S,FP,ExtractFilePath(FFileName));
ChangeMacro(S,FN,ExtractFileName(FFileName));
ChangeMacro(S,FE,ExtractFileExt(FFileName));
S:=S + #0;
WinExec(@S[1],SW_Show);
End;
{=======================================}
Constructor TPrinterCanal.Create(aOwner:TComponent);
Begin
Inherited Create(AOwner);
FFont:=TFont.Create;
End;
Destructor TPrinterCanal.Destroy;
Begin
FFont.Destroy;
Inherited Destroy;
End;
Procedure TPrinterCanal.Open;
Begin
Inherited Open;
Printer.Orientation:=FOrientation;
Printer.Canvas.Font:=FFont;
AsSignPrn(F);
ReWrite(F);
End;
Procedure TPrinterCanal.SetFont(AFont:TFont);
Begin
FFont.AsSign(AFont);
End;
{=======================================}
Procedure TConsoleCanal.Open;
Var S : String;
Begin
Inherited Open;
S:='';
AsSignFile(F,S);
ReWrite(F)
End;
{=======================================}
Procedure TMemoCanal.Open;
Begin
Inherited Open;
If AsSigned(FMemo) Then
FMemo.Clear;
MemoLine:='';
End;
Procedure TMemoCanal.Close;
Begin
If MemoLine <> '' Then
OutputLn;
Inherited Close;
End;
Procedure TMemoCanal.Output(S:String);
Begin
MemoLine:=MemoLine + S; {Memo line is 255 chars long}
End;
Procedure TMemoCanal.OutputLn;
Begin
Try
If AsSigned(FMemo) Then
FMemo.Lines.Add(MemoLine);
Except
End;{Try}
MemoLine:='';
End;
{=======================================}
{=======================================}
Procedure TAbstractExporter.Open;
Begin
If AsSigned(FCanal) Then
FCanal.Open;
End;
Procedure TAbstractExporter.Close;
Begin
If AsSigned(FCanal) Then
FCanal.Close;
End;
Procedure TAbstractExporter.Output(S:String);
Begin
If AsSigned(FCanal) Then
FCanal.Output(S);
End;
Procedure TAbstractExporter.OutputLn(S:String);
Begin
If AsSigned(FCanal) Then
Begin
FCanal.Output(S);
FCanal.OutputLn;
End;
End;
Procedure TAbstractExporter.BeginParagraph(Align:TExpAlign;FontSize:TExpFontSize;FontStyle:TExpFontStyle);
Begin
End;
Procedure TAbstractExporter.Paragraph(S:String);
Begin
End;
Procedure TAbstractExporter.EndParagraph;
Begin
End;
Procedure TAbstractExporter.QuickParagraph(S:String;Align:TExpAlign;FontSize:TExpFontSize;FontStyle:TExpFontStyle);
Begin
Self.BeginParagraph(Align,FontSize,FontStyle);
Self.Paragraph(S);
Self.EndParagraph;
End;
Procedure TAbstractExporter.IndentPlus;
Begin
End;
Procedure TAbstractExporter.IndentMinus;
Begin
End;
Procedure TAbstractExporter.BeginTable(Border:TExpBorder);
Begin
End;
Procedure TAbstractExporter.BeginRow;
Begin
BeginParagraph(REAlignNone,10,[]);
End;
Procedure TAbstractExporter.Cell(S:String;Align:TExpAlign;FontSize:TExpFontSize;FontStyle:TExpFontStyle);
Begin
Paragraph(S);
Paragraph(''+#9);
End;
Procedure TAbstractExporter.EndRow;
Begin
EndParagraph;
End;
Procedure TAbstractExporter.EndTable;
Begin
End;
{======================================================================}
Procedure TTextExporter.Paragraph(S:String);
Begin
OutPut(S);
End;
Procedure TTextExporter.EndParagraph;
Begin
OutPutLn('');
End;
{======================================================================}
Procedure TTextHTMLExporter.Open;
Begin
Inherited Open;
OutPutLn('<HTML>');
OutPutLn('<!--- This is automatic generated file --->');
OutPutLn('<!------------- Do Not Edit -------------->');
OutPutLn('<BODY><P><XMP>');
End;
Procedure TTextHTMLExporter.Close;
Begin
OutPutLn('</XMP></P></BODY></HTML>');
Inherited Close;
End;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -