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

📄 report_public.pas

📁 这是一个学生管理系统
💻 PAS
📖 第 1 页 / 共 2 页
字号:
{
  =========================================================================
   WinStar通用报表工具(SReport 1.1.012)
   最后修改时间: 2001/03/25
   编写者:       宋立超
   联系方式:     songlch@263.net
   功能描述:
     ====================================================================
    (一)自定义页面、边距、字体;
    (二)自定义标题和页眉页脚;
    (三)在表头尾可以打印任何相关数据主表中的数据和自定义标签。
    (四)可以定义明细数据中要打印的字段、标题、宽度、对齐方式、字体。
    (五)可以定义明细数据是否页计、是否累计、是否总计、大写字段;
    (六)实现针打中的卷纸打印--打多少内容,走多少纸。(报表和页面等长)
    (七)直接生成文本文件、EXCEL格式文件、HTML网页格式文件。
    (八)用户可以自己定义是否要打印报表顶端的单位信息标志。
    (九)支持同一报表多格式并存,按用户的选择输出不同的报表。
     ====================================================================
   控件目标:No 一兵一卒, Yes 报表
     ====================================================================
     (一)是将(商务管理软件)开发人员的报表设计工作量降为零;
     (二)是为最终用户提供“简单易用”、“功能强大”、“灵活方便”的报表
             自定义途径。使用户也可以轻松的,随心所欲的设计打印自己的报表。
     ====================================================================
  =========================================================================
}

unit Report_Public;

interface
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Db, DBTables, Grids, DBGrids, ExtCtrls, DBCtrls, StdCtrls, Qrctrls,
  QuickRpt, ActnList;
type
  TSReport = class(TComponent)
  private
    { Private declarations }
    FMy_UserFormName            : string;
    FMy_UserFormCaption         : string;
    FMy_SubDetailDataSet        : TDataSet;
    FMy_MainDataSetOne          : TDataSet;
    FMy_MainDataSetTwo          : TDataSet;
    FMy_MainDataSetThree        : TDataSet;
    FMy_MainDataSetFour         : TDataSet;
    FMy_MainDataSetFive         : TDataSet;
    FMy_MainDataSetOneCaption   : String;   //相对应的便于理解的名称
    FMy_MainDataSetTwoCaption   : String;   //相对应的便于理解的名称
    FMy_MainDataSetThreeCaption : String;   //相对应的便于理解的名称
    FMy_MainDataSetFourCaption  : String;   //相对应的便于理解的名称
    FMy_MainDataSetFiveCaption  : String;   //相对应的便于理解的名称
    FMy_ModelInfoFilesName      : String;   //主INI
    FMy_SaveDirectory           : String;   //存储目录
    FMy_PrintMemoRows           : integer;
    FMy_BottomMemoString        : string;   //报表备注。
    PrintingOrPreview           : boolean;
    procedure SRep_PrintOrPreview(Const Print0OrPreview1OrTxt2OrWord3OrHtml4 : integer;
              DefaOrSelect : boolean);
    Procedure EnaOrDisDataSource(const EnaOrdis : boolean);
    procedure SRep_SettingOfVcl;

  protected
    { Protected declarations }
  public
    { Public declarations }
    Constructor create(AOwner : TComponent);Override;
  published
    { Published declarations }
   property UserFormName     : string
            read FMy_UserFormName
            Write FMy_UserFormName;
   property UserFormCaption     : string
            read FMy_UserFormCaption
            Write FMy_UserFormCaption;
   property SubDetailDataSet : TDataSet
            read FMy_SubDetailDataSet
            Write FMy_SubDetailDataSet;
   property MainDataSetOne   : TDataSet
            read FMy_MainDataSetOne
            Write FMy_MainDataSetOne;
   property MainDataSetTwo   : TDataSet
            read FMy_MainDataSetTwo
            Write FMy_MainDataSetTwo;
   property MainDataSetThree : TDataSet
            read FMy_MainDataSetThree
            Write FMy_MainDataSetThree;
   property MainDataSetFour  : TDataSet
            read FMy_MainDataSetFour
            Write FMy_MainDataSetFour;
   property MainDataSetFive  : TDataSet
            read FMy_MainDataSetFive
            Write FMy_MainDataSetFive;
   property MainDataSetOneCaption  : String
            read FMy_MainDataSetOneCaption
            Write FMy_MainDataSetOneCaption;
   property MainDataSetTwoCaption  : String
            read FMy_MainDataSetTwoCaption
            Write FMy_MainDataSetTwoCaption;
   property MainDataSetThreeCaption  : String
            read FMy_MainDataSetTHreeCaption
            Write FMy_MainDataSetThreeCaption;
   property MainDataSetFourCaption  : String
            read FMy_MainDataSetFourCaption
            Write FMy_MainDataSetFourCaption;
   property MainDataSetFiveCaption  : String
            read FMy_MainDataSetFiveCaption
            Write FMy_MainDataSetFiveCaption;
   property ModelInfoFilesName  : String
            read Fmy_ModelInfoFilesName
            Write FMy_ModelInfoFilesName;
   property SaveDirectory  : String
            read FMy_SaveDirectory
            Write Fmy_SaveDirectory;
   Property PrintMemoRows  : integer
            Read FMy_PrintMemoRows
            Write FMy_PrintMemoRows;
   Property PrintMemoString : string
            Read FMy_BottomMemoString
            Write Fmy_BottomMemoString;


   Procedure SRep_Setting;
   procedure SRep_Print;
   procedure SRep_Preview;
   procedure SRep_PrintSelect;
   procedure SRep_PreviewSelect;
   procedure SRep_PrintToTxt;
   procedure SRep_PrintToTxtSelect;
   procedure SRep_PrintToExecl;
   procedure SRep_PrintToExeclSelect;
   procedure SRep_PrintToHtml;
   procedure SRep_PrintToHtmlSelect;
   procedure SRep_AllTasks;

  end;
  function  S_InputQuery(const ACaption, APrompt: string;
            var Value: string): Boolean;

procedure Register;

implementation
{$R *.DCR}

uses report_report,Report_Main,Report_Print;

Constructor TSReport.create(AOwner : TComponent);
begin
 Inherited Create(AOwner);
 if csDesigning in Componentstate then
 begin
  FMy_UserFormName := AOwner.Name;
 end;
end;

procedure TSReport.SRep_Setting;
begin
  SRep_SettingOfVcl;
end;

procedure TSReport.SRep_Print;
begin
  SRep_PrintOrPreview(0,false);
end;

procedure TSReport.SRep_PrintSelect;
begin
  SRep_PrintOrPreview(0,true);
end;

procedure TSReport.SRep_Preview;
begin
  SRep_PrintOrPreview(1,false);
end;

procedure TSReport.SRep_PreviewSelect;
begin
  SRep_PrintOrPreview(1,true);
end;

procedure TSReport.SRep_PrintToTxt;
begin
  SRep_PrintOrPreview(2,false);
end;

procedure TSReport.SRep_PrintToTxtSelect;
begin
  SRep_PrintOrPreview(2,true);
end;

procedure TSReport.SRep_PrintToExecl;
begin
  SRep_PrintOrPreview(3,false);
end;

procedure TSReport.SRep_PrintToExeclSelect;
begin
  SRep_PrintOrPreview(3,true);
end;

procedure TSReport.SRep_PrintToHtml;
begin
  SRep_PrintOrPreview(4,false);
end;

procedure TSReport.SRep_AllTasks;
begin
 Report_Frm_Print := TReport_Frm_Print.Create(application);
 with Report_Frm_Print do
 try
  if ShowModal = MrOK then
     begin
      if FPrint0OrPreview1OrTxt2OrWord3OrHtml4 = -1 then
         SRep_SettingOfVcl
      else
         SRep_PrintOrPreview(FPrint0OrPreview1OrTxt2OrWord3OrHtml4,FDefaOrSelect);
     end;
 finally
  free;
 end;
end;

procedure TSReport.SRep_PrintToHtmlSelect;
begin
  SRep_PrintOrPreview(4,true);
end;

function GetAveCharSize(Canvas: TCanvas): TPoint;
var
  I: Integer;
  Buffer: array[0..51] of Char;
begin
  for I := 0 to 25 do Buffer[I] := Chr(I + Ord('A'));
  for I := 0 to 25 do Buffer[I + 26] := Chr(I + Ord('a'));
  GetTextExtentPoint(Canvas.Handle, Buffer, 52, TSize(Result));
  Result.X := Result.X div 52;
end;

{ Input dialog }

function S_InputQuery(const ACaption, APrompt: string;
  var Value: string): Boolean;
var
  Form: TForm;
  Prompt: TLabel;
  Edit: TEdit;

⌨️ 快捷键说明

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