开发者

Embedding objects into Microsoft Word and OpenOffice Writer [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed last year.

Improve this question

I am looking for some references on how to implement the following feature:

ability to embed objects (e.g. diagrams) into word processors and being able to edit them in their respective "mother" application

For example, MS Word and Visio work like this together, allowing the user to easily edit/tweak the diagrams after adding them to the word processor.

I am interested开发者_如何学Go in how this is done on the following platforms:

  • Microsoft Word
  • OpenOffice

So far I know that:

  • Microsoft Word uses OLE/COM
  • Open Office uses UNO

Can you point me to any references, examples, books on how to approach this?


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.

Creating an OLE Server

Probably the most simple option to create an OLE control (.ocx) is to use the old Visual Basic 6. This is described here:

How To Create and Use a Minimal ActiveX Component in VB

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:

Create ActiveX in .NET Step by Step

1See the warning at the bottom of this article by Andrew Whitechapel.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜