-3

如何在没有插件 express 的情况下使用 Delphi 创建一个简单的 customtaskpane 并将 customtaskpane 添加到 excel。

任务窗格将有 1 个按钮(关闭)

procedure TMyAddin.OnConnection(const Application: IDispatch; ConnectMode: ext_ConnectMode; const AddInInst: IDispatch; var custom: PSafeArray);
var FApp:ExcelApplication;
CTP:TCustomTaskPane;
begin
...
  CTP:=TCustomTaskPane.Create(Self);
//?
  CTP.Visible:=True;
end;

使用 XE7,office2010.pas,excel2010.pas

4

1 回答 1

0

自己设法做到了。对于任何有同样问题的人,在这里发布解决方案

  • 创建加载项
  • 将 ActiveX 表单添加到加载项项目
  • 将以下代码添加到 addin .pas 文件
procedure TmyAddin.CTPFactoryAvailable(const CTPFactoryInst: ICTPFactory); safecall;
Var 
    CTP: _CustomTaskPane;
//  NP: TActiveXformClass;
begin   
    CTP:= CTPFactoryInst.CreateCTP('<replace with add-in name>.<replace with activeXform name>', 'pane caption', EmptyParam);
//  NP := TNavigationPane(ctp.ContentControl);
    CTP.Visible := true;
end;
于 2015-06-27T17:41:47.967 回答