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

📄 reportaximpl1.~pas

📁 intraweb 开发用 web报表控件源码
💻 ~PAS
字号:
unit reportaxImpl1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ActiveX, AxCtrls, reportaxProj1_TLB, StdVcl, ExtCtrls, FR_View, ImgList,
  TB97Ctls, TB97, TB97Tlwn, Psock, NMHttp, FR_E_TXT, FR_E_RTF, frRtfExp,
  FR_Class, frOLEExl, FR_PTabl, FR_Cross, FR_RRect, FR_Chart, FR_BarC,
  FR_Shape, FR_ChBox, FR_Rich, FR_OLE, Menus, StdCtrls;

type
  Treportax = class(TActiveForm, Ireportax)
    Dock971: TDock97;
    ToolWindow971: TToolWindow97;
    ToolbarButton971: TToolbarButton97;
    ToolbarButton972: TToolbarButton97;
    ImageList1: TImageList;
    frPreview1: TfrPreview;
    ToolbarButton973: TToolbarButton97;
    ToolbarButton974: TToolbarButton97;
    ToolbarButton975: TToolbarButton97;
    ToolbarButton976: TToolbarButton97;
    NMHTTP1: TNMHTTP;
    frReport1: TfrReport;
    frOLEObject1: TfrOLEObject;
    frRichObject1: TfrRichObject;
    frCheckBoxObject1: TfrCheckBoxObject;
    frShapeObject1: TfrShapeObject;
    frBarCodeObject1: TfrBarCodeObject;
    frChartObject1: TfrChartObject;
    frRoundRectObject1: TfrRoundRectObject;
    frCrossObject1: TfrCrossObject;
    frPrintTable1: TfrPrintTable;
    frPrintGrid1: TfrPrintGrid;
    frOLEExcelExport1: TfrOLEExcelExport;
    frRtfAdvExport1: TfrRtfAdvExport;
    frRTFExport1: TfrRTFExport;
    ToolbarButton977: TToolbarButton97;
    Timer1: TTimer;
    PopupMenu1: TPopupMenu;
    N1: TMenuItem;
    N2: TMenuItem;
    N3: TMenuItem;
    N4: TMenuItem;
    execl1: TMenuItem;
    WORD1: TMenuItem;
    N5: TMenuItem;
    Label1: TLabel;
    procedure NMHTTP1Success(Cmd: CmdType);
    procedure ToolbarButton974Click(Sender: TObject);
    procedure ToolbarButton972Click(Sender: TObject);
    procedure ToolbarButton971Click(Sender: TObject);
    procedure ToolbarButton973Click(Sender: TObject);
    procedure ToolbarButton975Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure ToolbarButton976Click(Sender: TObject);
  private
    { Private declarations }
    FEvents: IreportaxEvents;
    procedure ActivateEvent(Sender: TObject);
    procedure ClickEvent(Sender: TObject);
    procedure CreateEvent(Sender: TObject);
    procedure DblClickEvent(Sender: TObject);
    procedure DeactivateEvent(Sender: TObject);
    procedure DestroyEvent(Sender: TObject);
    procedure KeyPressEvent(Sender: TObject; var Key: Char);
    procedure PaintEvent(Sender: TObject);
  protected
    { Protected declarations }
    varulr:widestring;
    varzoom:integer;
    procedure DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage); override;
    procedure EventSinkChanged(const EventSink: IUnknown); override;
    function Get_Active: WordBool; safecall;
    function Get_AutoScroll: WordBool; safecall;
    function Get_AutoSize: WordBool; safecall;
    function Get_AxBorderStyle: TxActiveFormBorderStyle; safecall;
    function Get_Caption: WideString; safecall;
    function Get_Color: OLE_COLOR; safecall;
    function Get_Cursor: Smallint; safecall;
    function Get_DoubleBuffered: WordBool; safecall;
    function Get_DropTarget: WordBool; safecall;
    function Get_Enabled: WordBool; safecall;
    function Get_Font: IFontDisp; safecall;
    function Get_HelpFile: WideString; safecall;
    function Get_KeyPreview: WordBool; safecall;
    function Get_PixelsPerInch: Integer; safecall;
    function Get_PrintScale: TxPrintScale; safecall;
    function Get_Scaled: WordBool; safecall;
    function Get_Visible: WordBool; safecall;
    function Get_VisibleDockClientCount: Integer; safecall;
    procedure _Set_Font(const Value: IFontDisp); safecall;
    procedure Set_AutoScroll(Value: WordBool); safecall;
    procedure Set_AutoSize(Value: WordBool); safecall;
    procedure Set_AxBorderStyle(Value: TxActiveFormBorderStyle); safecall;
    procedure Set_Caption(const Value: WideString); safecall;
    procedure Set_Color(Value: OLE_COLOR); safecall;
    procedure Set_Cursor(Value: Smallint); safecall;
    procedure Set_DoubleBuffered(Value: WordBool); safecall;
    procedure Set_DropTarget(Value: WordBool); safecall;
    procedure Set_Enabled(Value: WordBool); safecall;
    procedure Set_Font(var Value: IFontDisp); safecall;
    procedure Set_HelpFile(const Value: WideString); safecall;
    procedure Set_KeyPreview(Value: WordBool); safecall;
    procedure Set_PixelsPerInch(Value: Integer); safecall;
    procedure Set_PrintScale(Value: TxPrintScale); safecall;
    procedure Set_Scaled(Value: WordBool); safecall;
    procedure Set_Visible(Value: WordBool); safecall;
    function Get_BRowUlr: WideString; safecall;
    procedure Set_BRowUlr(const Value: WideString); safecall;
    function Get_Zoom: Smallint; safecall;
    procedure Set_Zoom(Value: Smallint); safecall;
    procedure print; safecall;
    procedure showtool(showflag: WordBool); safecall;
    procedure zoomin; safecall;
    procedure zoomout; safecall;

  public
    { Public declarations }
    procedure Initialize; override;
  end;

implementation

uses ComObj, ComServ;

{$R *.DFM}

{ Treportax }

procedure Treportax.DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage);
begin
  { Define property pages here.  Property pages are defined by calling
    DefinePropertyPage with the class id of the page.  For example,
      DefinePropertyPage(Class_reportaxPage); }
end;

procedure Treportax.EventSinkChanged(const EventSink: IUnknown);
begin
  FEvents := EventSink as IreportaxEvents;
end;

procedure Treportax.Initialize;
begin
  inherited Initialize;
  OnActivate := ActivateEvent;
  OnClick := ClickEvent;
  OnCreate := CreateEvent;
  OnDblClick := DblClickEvent;
  OnDeactivate := DeactivateEvent;
  OnDestroy := DestroyEvent;
  OnKeyPress := KeyPressEvent;
  OnPaint := PaintEvent;
end;

function Treportax.Get_Active: WordBool;
begin
  Result := Active;
end;

function Treportax.Get_AutoScroll: WordBool;
begin
  Result := AutoScroll;
end;

function Treportax.Get_AutoSize: WordBool;
begin
  Result := AutoSize;
end;

function Treportax.Get_AxBorderStyle: TxActiveFormBorderStyle;
begin
  Result := Ord(AxBorderStyle);
end;

function Treportax.Get_Caption: WideString;
begin
  Result := WideString(Caption);
end;

function Treportax.Get_Color: OLE_COLOR;
begin
  Result := OLE_COLOR(Color);
end;

function Treportax.Get_Cursor: Smallint;
begin
  Result := Smallint(Cursor);
end;

function Treportax.Get_DoubleBuffered: WordBool;
begin
  Result := DoubleBuffered;
end;

function Treportax.Get_DropTarget: WordBool;
begin
  Result := DropTarget;
end;

function Treportax.Get_Enabled: WordBool;
begin
  Result := Enabled;
end;

function Treportax.Get_Font: IFontDisp;
begin
  GetOleFont(Font, Result);
end;

function Treportax.Get_HelpFile: WideString;
begin
  Result := WideString(HelpFile);
end;

function Treportax.Get_KeyPreview: WordBool;
begin
  Result := KeyPreview;
end;

function Treportax.Get_PixelsPerInch: Integer;
begin
  Result := PixelsPerInch;
end;

function Treportax.Get_PrintScale: TxPrintScale;
begin
  Result := Ord(PrintScale);
end;

function Treportax.Get_Scaled: WordBool;
begin
  Result := Scaled;
end;

function Treportax.Get_Visible: WordBool;
begin
  Result := Visible;
end;

function Treportax.Get_VisibleDockClientCount: Integer;
begin
  Result := VisibleDockClientCount;
end;

procedure Treportax._Set_Font(const Value: IFontDisp);
begin
  SetOleFont(Font, Value);
end;

procedure Treportax.ActivateEvent(Sender: TObject);
begin
  if FEvents <> nil then FEvents.OnActivate;
end;

procedure Treportax.ClickEvent(Sender: TObject);
begin
  if FEvents <> nil then FEvents.OnClick;
end;

procedure Treportax.CreateEvent(Sender: TObject);
begin
  if FEvents <> nil then FEvents.OnCreate;
end;

procedure Treportax.DblClickEvent(Sender: TObject);
begin
  if FEvents <> nil then FEvents.OnDblClick;
end;

procedure Treportax.DeactivateEvent(Sender: TObject);
begin
  if FEvents <> nil then FEvents.OnDeactivate;
end;

procedure Treportax.DestroyEvent(Sender: TObject);
begin
  if FEvents <> nil then FEvents.OnDestroy;
end;

procedure Treportax.KeyPressEvent(Sender: TObject; var Key: Char);
var
  TempKey: Smallint;
begin
  TempKey := Smallint(Key);
  if FEvents <> nil then FEvents.OnKeyPress(TempKey);
  Key := Char(TempKey);
end;

procedure Treportax.PaintEvent(Sender: TObject);
begin
  if FEvents <> nil then FEvents.OnPaint;
end;

procedure Treportax.Set_AutoScroll(Value: WordBool);
begin
  AutoScroll := Value;
end;

procedure Treportax.Set_AutoSize(Value: WordBool);
begin
  AutoSize := Value;
end;

procedure Treportax.Set_AxBorderStyle(Value: TxActiveFormBorderStyle);
begin
  AxBorderStyle := TActiveFormBorderStyle(Value);
end;

procedure Treportax.Set_Caption(const Value: WideString);
begin
  Caption := TCaption(Value);
end;

procedure Treportax.Set_Color(Value: OLE_COLOR);
begin
  Color := TColor(Value);
end;

procedure Treportax.Set_Cursor(Value: Smallint);
begin
  Cursor := TCursor(Value);
end;

procedure Treportax.Set_DoubleBuffered(Value: WordBool);
begin
  DoubleBuffered := Value;
end;

procedure Treportax.Set_DropTarget(Value: WordBool);
begin
  DropTarget := Value;
end;

procedure Treportax.Set_Enabled(Value: WordBool);
begin
  Enabled := Value;
end;

procedure Treportax.Set_Font(var Value: IFontDisp);
begin
  SetOleFont(Font, Value);
end;

procedure Treportax.Set_HelpFile(const Value: WideString);
begin
  HelpFile := String(Value);
end;

procedure Treportax.Set_KeyPreview(Value: WordBool);
begin
  KeyPreview := Value;
end;

procedure Treportax.Set_PixelsPerInch(Value: Integer);
begin
  PixelsPerInch := Value;
end;

procedure Treportax.Set_PrintScale(Value: TxPrintScale);
begin
  PrintScale := TPrintScale(Value);
end;

procedure Treportax.Set_Scaled(Value: WordBool);
begin
  Scaled := Value;
end;

procedure Treportax.Set_Visible(Value: WordBool);
begin
  Visible := Value;
end;

procedure Treportax.NMHTTP1Success(Cmd: CmdType);
var
 filename:string;
begin
   filename:=NMHTTP1.body;
   frReport1.LoadPreparedReport(filename);
   frReport1.ShowPreparedReport;
end;

procedure Treportax.ToolbarButton974Click(Sender: TObject);
begin
  frPreview1.PageWidth;
end;

procedure Treportax.ToolbarButton972Click(Sender: TObject);
begin
  frPreview1.Zoom:=frPreview1.Zoom+10;
end;

procedure Treportax.ToolbarButton971Click(Sender: TObject);
begin
 frPreview1.Zoom:=frPreview1.Zoom-10;
end;

procedure Treportax.ToolbarButton973Click(Sender: TObject);
begin
 frPreview1.Print;
end;

procedure Treportax.ToolbarButton975Click(Sender: TObject);
begin
 frReport1.ExportTo(frOLEExcelExport1,'c:\temp.xls') ;
end;

procedure Treportax.Timer1Timer(Sender: TObject);
begin
 Timer1.Enabled:=false;
end;


function Treportax.Get_BRowUlr: WideString;
begin
  Result:=varulr;
end;

procedure Treportax.Set_BRowUlr(const Value: WideString);
begin
 varulr:=Value;
 NMHTTP1.Get(varulr);
end;

procedure Treportax.ToolbarButton976Click(Sender: TObject);
begin
 frReport1.ExportTo(frRtfAdvExport1,'c:\temp.doc') ;
end;

function Treportax.Get_Zoom: Smallint;
begin
  Result:=varzoom;
end;

procedure Treportax.Set_Zoom(Value: Smallint);
begin
  varzoom:=Value;
  frPreview1.Zoom:=frPreview1.Zoom+varzoom;
end;

procedure Treportax.print;
begin
   frPreview1.Print;
end;


procedure Treportax.showtool(showflag: WordBool);
begin
  ToolWindow971.Visible:=showflag;
end;

procedure Treportax.zoomin;
begin
  frPreview1.Zoom:=frPreview1.Zoom-10;
end;

procedure Treportax.zoomout;
begin
   frPreview1.Zoom:=frPreview1.Zoom+10;
end;

initialization
  TActiveFormFactory.Create(
    ComServer,
    TActiveFormControl,
    Treportax,
    Class_reportax,
    1,
    '',
    OLEMISC_SIMPLEFRAME or OLEMISC_ACTSLIKELABEL,
    tmApartment);
end.

⌨️ 快捷键说明

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