现在的位置: 首页 > 综合 > 正文

dbgrideh通用打印

2011年06月09日 ⁄ 综合 ⁄ 共 1316字 ⁄ 字号 评论关闭

{*******************************************************}
{                                                       }
{       通用打印模块                                    }   
{                                                       }
{       版权所有 (C) 2008 咏南工作室(陈新光)          }
{                                                       }
{*******************************************************}

unit uPrint;

interface

uses
  DBGridEh,PrnDbgeh,SysUtils,Graphics,Forms,Printers,windows;

procedure Prnt(AGrid:TDBGridEh;AOwner:Tform;APageHeader:string='';
  ALineType:TPageColontitleLineType=pcltnon);

implementation

//==============================================================================
// linetype取值{pcltDoubleLine;pcltsingleline;pcltnon}
// AOwner:TForm TPrintDBGridEh.Create(AOwner); 负责TPrintDBGridEh类对象FREE
// TPrinterOrientation = (poPortrait, poLandscape); 纸张竖、横
//==============================================================================

procedure Prnt(AGrid:TDBGridEh;AOwner:TForm;APageHeader:string='';
  ALineType:TPageColontitleLineType=pcltnon);
var
  prn:TPrintDBGridEh;
begin
  if AGrid.DataSource.DataSet.IsEmpty then exit;
  prn:=TPrintDBGridEh.Create(AOwner);
  with prn.PageHeader do
  begin
    Font.Name:='宋体';
    Font.Size:=12;
    Font.Style:=[fsbold];
    LineType:=ALineType;
    CenterText.Text:=APageHeader;
  end;
  prn.DBGridEh:=AGrid;
  prn.Preview;
end;

end.
 

抱歉!评论已关闭.