如何编写可在MS Word / Excel / Powerpoint中使用的Delphi ActiveX控件? [英] How to write Delphi ActiveX control which can be used in MS Word/Excel/Powerpoint?

查看:176
本文介绍了如何编写可在MS Word / Excel / Powerpoint中使用的Delphi ActiveX控件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

[待办事项](1)如NGLN的有用答案所示,请使用 Delphi ActiveX控件等更简单的关键字进行搜索。 (2)在Word / Excel / Powerpoint中使用ActiveX控件是又一步。 [/ ToDo]

[ToDo] (1) As indicated from NGLN's helpful answer, using simpler keywords such as "Delphi ActiveX control" to search. (2) Consuming the ActiveX control in Word/Excel/Powerpoint is yet another step. [/ToDo]

[有用的链接]

在Master Delphi 7中编写ActiveX控件

使用delphi创建非可视化Activex控件

错误无法为[TClassName]加载单位[unit]符号信息

=======

或者如果我想在Delphi中编写可以在Microsoft Word / Excel / Powerpoint中使用的行为良好的ActiveX控件,要学习哪些书籍和课程?

Or what books and courses to learn if I want to write in Delphi a well-behaved ActiveX control which can be used in Microsoft Word/Excel/Powerpoint ?

非常抱歉,如果没有编程详细信息,这应该是一个不好的问题。 但是,当我在Internet资料中搜索时,几乎得到的所有信息都是关于如何在Delphi应用程序中操作/嵌入/托管Word / Excel / Powerpoint。是因为存在其他语言/工具包最适合创建可在Microsoft Word / Excel / Powerpoint中使用的ActiveX控件?

Very sorry if this should be a bad question without programming details. However, when I search in the internet materials, almost all I get is about "how to manipulate/embed/host Word/Excel/Powerpoint in Delphi application". Is it because there are other languages/toolkits best suited for creating ActiveX controls which can be used in Microsoft Word/Excel/Powerpoint ?

我尝试这样做的原因:


  • 我现在要做的是:(1)使用Delphi应用程序生成图像文件。 (2)将该图像文件粘贴到Excel报表中。 (3)当需要不同的图像表示时,重复一遍(1)和(2)。也就是说,需要在应用程序之间进行切换。

  • What I do now : (1) A Delphi application is used to produce a image file. (2) This image file is pasted in a Excel report. (3) When different representation of the image is needed, one repeat (1) and (2). That is to say, one need to switch between applications.

我的目标是:(1)将Delphi ActiveX嵌入/托管在Excel报表中。 。当需要不同的图像表示形式时,可以通过Excel报表中的Delphi ActiveX 进行操作,而无需走到其他地方或在应用程序之间切换。

My goal is to have : (1) A Delphi ActiveX is embeded/hosted in a Excel report. When different representation of the image is needed, one can thus manipulate through the Delphi ActiveX within the Excel report, and do not need to go elsewhere or switch between applications.

推荐答案

您可以按照以下步骤创建ActiveX控件:

You can create an ActiveX control by following these steps:


  • 将控件设计为可安装的组件,并从 TWinControl 或以下版本继承

  • 发布要用作ActiveX控件的属性

  • 将其添加到可注册的程序包中

  • 将该程序包安装到Delphi IDE中

  • 关闭全部

  • 选择文件>新建>其他...> ActiveX> ActiveX库

  • 选择文件>新建>其他...> ActiveX> ActiveX控件

  • VCL类名组合框选择组件

  • 设置线程模型公寓是默认的,并且可能更受欢迎。

  • 构建项目

  • 注册OLE控制扩展(<$ c $ Delphi用regsvr32.exe创建的c> .ocx

  • Design your control as installable component, inherit from TWinControl or below
  • Publish properties you want to use, once as ActiveX control
  • Add it to a registerable package
  • Install that package into the Delphi IDE
  • Close all
  • Choose File > New > Other... > ActiveX > ActiveX Library
  • Choose File > New > Other... > ActiveX > ActiveX Control
  • Choose your component from the VCL Class Name combo box
  • Set the threading model you want to support. Apartment is the default and probably preferrable.
  • Build the project
  • Register the OLE Control Extension (.ocx) that Delphi created with regsvr32.exe

这就是我添加Delphi DXF的方式控制到Access数据库:

That is how I added a Delphi DXF control to an Access database:

img src = https://i.stack.imgur.com/rvXwQm.png alt =在此处输入图片描述>

请注意,您将需要64位ocx才能安装64位MS Office(无论Windows版本如何)。

Note that you will need a 64-bit ocx for a 64-bit MS Office installation (regardless of the Windows version).

供参考:文档中有关创建的章节COM对象从此处开始

For reference: the chapter in the documentation dealing with creating COM objects starts here.

这篇关于如何编写可在MS Word / Excel / Powerpoint中使用的Delphi ActiveX控件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆