起步软件技术论坛-X3

 找回密码
 立即注册
搜索
查看: 269|回复: 7

【结贴】关于怎样引入非控件的动态库

[复制链接]
发表于 2007-3-13 15:42:30 | 显示全部楼层 |阅读模式
怎样自己手工的把输出的过程的声明写成.pas 文件???
急啊!
能否举个例子!!!!
回复

使用道具 举报

 楼主| 发表于 2007-3-13 16:16:42 | 显示全部楼层
能不能先帮我解决一下,急啊!!
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-3-13 16:37:01 | 显示全部楼层
能不能帮我看看那帖子啊!
回复 支持 反对

使用道具 举报

发表于 2007-3-13 16:45:37 | 显示全部楼层
看第三方控件导入的文档中有说明的
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-3-13 16:55:00 | 显示全部楼层
能不能给个手工的把输出的过程的声明写成.pas 的例子啊,
找不到!
回复 支持 反对

使用道具 举报

发表于 2007-3-14 08:58:24 | 显示全部楼层
这个是个调用office OLE 的例子,你参考一下,然后可以按照第三方控件的方法导入!
unit OleAdvFunc;

interface

uses
  OleCtnrs, Dialogs;

  type
    TOleWordExpand = class
    private
      FOle: TOleContainer;
      FTrack: Boolean;
      FUserName: String;
      procedure SetOle(const Value: TOleContainer);
      procedure SetTrack(const Value: Boolean);
    public
      procedure AddPicture(AFilename: String);
      procedure Activate;

      property TrackRevisions: Boolean read FTrack write SetTrack;
      property Ole: TOleContainer read FOle write SetOle;
      property UserName: String read FUserName write FUserName;
    end;

procedure OleActivate(AOle: TOleContainer);
procedure OleDoVerb(AOle: TOleContainer; AVerb: Integer);
procedure OleAddPicture(AOle: TOleContainer; AFilename: String);
procedure OleTrackRevisions(AOle: TOleContainer; ATrack: Boolean);
procedure OleUserName(AOle: TOleContainer; AUserName: String);
procedure OleToolBarShow(AOle: TOleContainer; AShow: Boolean);
procedure OleStandAlone(AOle: TOleContainer);
procedure OleFillField(AOle: TOleContainer; AFieldName, AFieldValue: String);

implementation

uses Word2000, Forms, Controls, ExtCtrls;

procedure OleStandAlone(AOle: TOleContainer);
var
  f: TForm;
  pnl: TPanel;
begin
  pnl := TPanel.Create(Application);
  pnl.Align := AOle.Align;
  pnl.Left := AOle.Left;
  pnl.Top := AOle.Top;
  pnl.Width := Aole.Width;
  pnl.Height := AOle.Height;
  pnl.Parent := AOle.Parent;

  f := TForm.Create(pnl);
  f.Caption := '';
  f.BorderStyle := bsNone;
  f.BorderIcons := [];
  f.Parent := pnl;

  AOle.Parent := f;
  f.Show;
  f.Align := alClient;
end;

procedure OleDoVerb(AOle: TOleContainer; AVerb: Integer);
begin
  AOle.DoVerb(AVerb);
end;

procedure OleActivate(AOle: TOleContainer);
begin
  AOle.DoVerb(ovInPlaceActivate);
end;

procedure OleToolBarShow(AOle: TOleContainer; AShow: Boolean);
var
  V: Variant;
  i: Integer;
begin
  V := (AOle.OleObjectInterface as _Document) as IDispatch;
  for i:=0 to V.CommandBars.Count-1 do
    V.CommandBars.Visible := AShow;
end;

procedure OleAddPicture(AOle: TOleContainer; AFilename: String);
var
  V: Variant;
begin
  V := (AOle.OleObjectInterface as _Document).Application.Selection.InlineShapes as IDispatch;
  V.AddPicture(AFileName);
end;

procedure OleTrackRevisions(AOle: TOleContainer; ATrack: Boolean);
var
  V: Variant;
begin
  V := (AOle.OleObjectInterface as _Document) as IDispatch;
  V.TrackRevisions := ATrack;
end;

procedure OleUserName(AOle: TOleContainer; AUserName: String);
var
  V: Variant;
begin
  V := (AOle.OleObjectInterface as _Document).Application;
  V.UserName := AUserName;
end;

{ TOleWordExpand }

procedure TOleWordExpand.Activate;
begin
  FOle.DoVerb(ovInPlaceActivate);
end;

procedure TOleWordExpand.AddPicture(AFilename: String);
var
  V: Variant;
begin
  if Assigned(FOle) then
  begin
    Activate;
    V := (FOle.OleObjectInterface as _Document).Application.Selection.InlineShapes as IDispatch;
    V.AddPicture(AFileName);
    Activate;
  end;
end;

procedure TOleWordExpand.SetOle(const Value: TOleContainer);
begin
  FOle := Value;
end;

procedure TOleWordExpand.SetTrack(const Value: Boolean);
var
  V: Variant;
begin
  FTrack := Value;

  Activate;
  V := (FOle.OleObjectInterface as _Document) as IDispatch;
  V.TrackRevisions := FTrack;
  if Length(FUserName)>0 then
  begin
    V := (FOle.OleObjectInterface as _Document).Application;
    V.UserName := FUserName;
  end;
  Activate;
end;

procedure OleFillField(AOle: TOleContainer; AFieldName, AFieldValue: String);
var
  V: Variant;
begin
   V := (AOle.OleObjectInterface as _Document).Application.Selection as IDispatch;
   V.Goto(wdGoToBookmark, 0, 0, AFieldName);
   V.TypeText(AFieldValue);
end;

end.
回复 支持 反对

使用道具 举报

发表于 2007-3-17 10:48:50 | 显示全部楼层
楼主得问题解决了没?
回复 支持 反对

使用道具 举报

发表于 2007-3-23 10:35:20 | 显示全部楼层
先结贴了?
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Justep Inc.

GMT+8, 2024-12-28 03:58 , Processed in 0.036202 second(s), 15 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表