We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
由于 OLE 几乎是一种史前技术(仍在使用),因此您必须在 MSDN 中深入挖掘。下面链接的文章介绍了一个可以嵌入到 IE、Word 或 OpenOffice 等容器应用程序中的示例应用程序。该示例基于 VC6,因此我不知道您需要多大的运气才能让它在当前版本的 Visual Studio 上运行。
创建 OLE 控件 (.ocx) 的最简单选项可能是使用旧的 Visual Basic 6。此处对此进行了描述:
也可以用 C# 等托管代码编写控件,但我认为不建议这样做1,因为如果当前进程已经在运行另一个版本的 CLR(到目前为止,一个进程中只能存在一个版本的 CLR,.NET 4.0 将引入 CLR 的并行执行。我找到了以下教程:
< sub>1请参阅 这篇文章,作者:Andrew Whitechapel。
Since OLE is an almost pre-historic technology (still of use) you have to dig a bit deeper in MSDN. The article linked below describes a sample application that can be embedded into container applications such as IE, Word, or OpenOffice. The sample is based on VC6, so I don't know how much luck you will have to get it running with current versions of Visual Studio.
Probably the most simple option to create an OLE control (.ocx) is to use the old Visual Basic 6. This is described here:
It is also possible to write a control in managed code like C#, but I assume this is not recommended1 as it might lead to conflicts if the current process is already running another version of the CLR (Up to now, only one version of the CLR can exist in a process, .NET 4.0 will introduce side-by-side execution of the CLR). I found the following tutorial:
1See the warning at the bottom of this article by Andrew Whitechapel.
这仍然可以在 Word 中使用 COM(或 OLE,但使用新名称时效果相同)轻松完成。根据您打算使用哪种语言,您的处理方式会有所不同。本质上,您需要创建一种特定类型的 ActiveX 控件。
在 Delphi(最简单的语言)中,您可以在 COM dll 中创建一个
ActiveXForm
,然后您就可以将其嵌入到您的 Word 文档中。您可以让您的应用程序在 Word 中执行您想要的任何操作(与 Word 对话的过程稍微复杂一些,但也是可能的)。恐怕我不知道在 OpenOffice 中该怎么做。
我认为你需要带着更具体的问题回来。
This can still be quite easily done in Word using COM (or OLE but it's the same thing with a new name). Depending on what language you are intending to do it in you will go about it differently. Essentially you need to create a particular kind of ActiveX control.
In Delphi (the easiest language to do this in) you would create an
ActiveXForm
in a COM dll and then you would be able to embed this in your word document. You could make your application do whatever you wanted inside Word (talking to Word is a bit more involved but possible).I have no idea what to do in OpenOffice I'm afraid.
I think you need to come back with more specific questions.