⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 grvexp.pas

📁 此控件可将数据表转换成多种格式:文本,HTML,RTF
💻 PAS
字号:
{
GReader 1.0 Exporter Component
Version 2.0

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

Notes:
   (o) GReader is copyright by V. Gounev ( VAGSoft@HotMail.Com )
   (o) This is only exporter, U must register GReader !!!!

}

Unit GRVExp;

interface

uses
  SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  Forms, Dialogs, BasicExp;

type
  TPage        = Record
                    Width,
                    Height  : Word;

                    Left,
                    Right,
                    Top,
                    Bottom  : Word;
                 End;

  TGRVExporter = class(TAbstractExporter)
  private
    { Private declarations }
    FReportName  : String;
    FPage        : TPage;
    FFont        : TFont;
    FTabStops    : String;

    Procedure SetFont(AFont:TFont);
  protected
    { Protected declarations }
  public
    { Public declarations }
    Constructor Create(AOwner:TComponent); OverRide;
    Destructor  Destroy; OverRide;

    Procedure Open; OverRide;

    Procedure BeginParagraph(Align:TExpAlign;FontSize:TExpFontSize;FontStyle:TExpFontStyle); OverRide;
    Procedure Paragraph(S:String); OverRide;
    Procedure EndParagraph; OverRide;

    Procedure BeginRow; OverRide;
    Procedure Cell(S:String;Align:TExpAlign;FontSize:TExpFontSize;FontStyle:TExpFontStyle); OverRide;
    Procedure EndRow; OverRide;
  published
    { Published declarations }
    Property ReportName  : String      Read FReportName  Write FReportName;

    Property PageWidth   : Word        Read FPage.Width  Write FPage.Width;
    Property PageHeight  : Word        Read FPage.Height Write FPage.Height;

    Property PageTop     : Word        Read FPage.Top    Write FPage.Top;
    Property PageBottom  : Word        Read FPage.Bottom Write FPage.Bottom;
    Property PageLeft    : Word        Read FPage.Left   Write FPage.Left;
    Property PageRight   : Word        Read FPage.Right  Write FPage.Right;

    Property Font        : TFont       Read FFont        Write SetFont;

    Property TabStops    : String      Read FTabStops    Write FTabStops;
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('Exporter', [TGRVExporter]);
end;

Constructor TGRVExporter.Create(AOwner:TComponent);
   Begin
      Inherited Create(AOwner);

      FFont:=TFont.Create;

      FPage.Width:=210;
      FPage.Height:=297;
      FPage.Left:=20;
      FPage.Right:=20;
      FPage.Top:=20;
      FPage.Bottom:=20;

      FTabStops:='1,50,100,150,170';
   End;

Destructor  TGRVExporter.Destroy;
   Begin
      FFont.Destroy;
      Inherited Destroy;
   End;

Procedure TGRVExporter.SetFont(AFont:TFont);
   Begin
      FFont.AsSign(AFont);
   End;

Procedure TGRVExporter.Open;
   Begin
      Inherited Open;

      OutPutLn(ReportName);          {Name of the report}

      OutPutLn('1.00');              {Format version}

      OutPutLn(IntToStr(FPage.Width) + ',' + IntToStr(FPage.Height));
                                     {Width and Height of the page in mm}

      OutPutLn(IntToStr(FPage.Left) + ',' +
               IntToStr(FPage.Right) + ',' +
               IntToStr(FPage.Top) + ',' +
               IntToStr(FPage.Bottom));
                                     {Left, Right, Top, Bottom margins in mm}

      OutPutLn(FFont.Name + ',' + IntToStr(FFont.Size));
                                     {Font Name and Size}

      OutPutLn(FTabStops);           {TabStops in mm}

      OutPutLn('5,2');               {Where to show Page Number, Report Name :}
                                     {0-None; 1:Top Left; 2:Top Center; 3:Top Right; 4:Bottom Left;}
                                     {5:Bottom Center; 6:Bottom Right;}

      OutPutLn('');                  {Reserved row for future versions}
      OutPutLn('');
      OutPutLn('');
      OutPutLn('');
   End;

Procedure TGRVExporter.BeginParagraph(Align:TExpAlign;FontSize:TExpFontSize;FontStyle:TExpFontStyle);
   Begin
      OutPut('^');

      Case Align Of
         REAlignRight   : OutPut('R');
         REAlignCenter  : OutPut('C');
         REAlignJust    : OutPut('J');
      Else
         OutPut('L');
      End;{CASE}

      If REBold      In FontStyle Then OutPut('B');
      If REItalic    In FontStyle Then OutPut('I');
      If REUnderline In FontStyle Then OutPut('U');

      OutPut('^');
   End;

Procedure TGRVExporter.Paragraph(S:String);
   Begin
      OutPut(S);
   End;

Procedure TGRVExporter.EndParagraph;
   Begin
      OutPutLn('');
   End;

Procedure TGRVExporter.BeginRow;
   Begin
      OutPut('^T^');
   End;

Procedure TGRVExporter.Cell(S:String;Align:TExpAlign;FontSize:TExpFontSize;FontStyle:TExpFontStyle);
   Begin
      BeginParagraph(Align,FontSize,FontStyle);

      OutPut(''+#9);
      OutPut(S);
   End;

Procedure TGRVExporter.EndRow;
   Begin
      OutPutLn('');
   End;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -