开发者

Embed custom data in Word 2003, 2007, 2010 documents

开发者 https://www.devze.com 2023-03-04 13:43 出处:网络
I\'m working on a Word plugin that has to be compatible with all Word versions beginning with 2003. One of the requirements needed for a feature is the ability to embed custom data of any length in a

I'm working on a Word plugin that has to be compatible with all Word versions beginning with 2003. One of the requirements needed for a feature is the ability to embed custom data of any length in a document. The Word.Document.CustomDocumentProperties works for all the required versions but unfortunately limits the size of the data. While researching, I also discovered that Word.Document.CustomXML might be the solution I need. However, I was not able to find out if this property works properly for Word 2003. Additionally, performing CRUD operations must be possible on the custom data but from what I see the CustomXML part only provides methods to add and retrieve the data. How sh开发者_JAVA百科ould I tackle this requirement?


Concerning CustomXML, please remember the patent issue Microsoft encountered last year, which lead to a removal of the feature in Office 2007 (at least in the US). See this blog for details. I remember that the removal was limited to the US edition, and that for Office 2010 MS uses another approach. But that means that you depend from the patch state of your customer's Office installation.

You may look into Word document variables instead of document properties. They are supported ever since Word 95 and can be seen as an INI file attached to the document. I've made good experiences with a XML structure saved just in one document variable (the XML content you can also encrypt, if necessary).

However, you can just read or write document variables (or delete them). There is no way to assure CRUD operations through the Word object model in itself; it's your application which is responsible.

Please keep in mind too, that (if your documents go out and come back thr' e-mail attachments), that some of your customers may use some meta-data removal tool; I've seen the use of it in the legal market a lot. Those tools can remove document variables and Office document properties. With Office documents (Word, Excel), it is not possible to have a 100% security that your data will remain in the document.

0

精彩评论

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