Word 2010 custom XML?

血红的双手。 提交于 2019-12-24 09:39:22

问题


I am looking into a new project which involves adding XML structure to a Word document using Custom XML but I don't know how the i4i case affects this.

1) Microsoft recommends using custom controls in the document. Can this validate using an XML Schema file? It looks to me more like a way to create a template and not really for adding tags to existing content.

2) The i4i judgement about Custom XML only concerned North America. Did Microsoft remove the feature worldwide or can I still access it in Australia?


回答1:


There are alternative approaches and which I covered in my blog Windward Wrocks (links and better formatting at my blog):

Custom XML for Word and the i4i patent case Windward Reports never used Custom XML (or bookmarks) for tagging. (We looked at both but each approach has issues that make them problematic at times.) But we do use tagging in Word, Excel, & PowerPoint as our report designer. We do have a very powerful Office AddIn to support this tagging. So I think I have as good an understanding of the issues around this as one can have and yet still be a disinterested party.

I'm not going to give an opinion on the case except to say I wish they could have reached an agreement. The big losers on this are everyone who made use of Custom XML for tagging as this is now removed. (And to say a pox on all software patents.)

First for the programmers who have to adjust, there is a product from i4i that hacks around this called x4w. However, I don't think that is your best solution (explained below). My suggestion is to switch to using content controls, fields, bitmaps, and/or plain old text. The first three of these approaches are more robust than custom XML and are still supported by Word. We use all four approaches (user selected) and they are rock solid.

So what do you do if you have custom XML in your Word documents? If you don't use the custom XML, then there's no problem, just open the files and Word will strip it out, leaving you the rest of the document. Same if your use can be switched to using another feature. You will lose your existing markers but otherwise can continue.

If you need to find any files that have custom XML in them, this program for Microsoft will do the job (DOCX/DOCM only). Also, this restriction only comes in to play for Word 2007 sold on or after 11 January this year – and all copies of Word 2010. Microsoft has a good summation here.

If you must have the custom XML, your only option at present is x4w. However, I strongly recommend that you only use this as a stop-gap measure as you find an alternative to custom XML. Because you could find that the next service pack of Word will render x4w unable to save your custom XML. As there is no love lost between Microsoft and i4i, I would not be surprised to see in the next service pack:

1.Word drops support for custom XML. At present it strips the custom XML out but when it is inserted back in, Word still has the functionality to display and use it. But if custom XML support is not allowed, they can then remove that functionality from Word. 2.Word strips custom XML on saving as well as on loading a document. If this occurs i4i can try to hack around this too, but this is a much more difficult problem. And for cases that the hack fails, you won't know until the next time you open the file – and all your work is lost. 3.Word changes at what point during the load process that it strips out the custom XML. It presently occurs before the open document event (which I assume is when x4w inserts the custom XML back in). But Word could strip it out right after that event – and it is then a much harder hack to get the custom XML back in.




回答2:


On 2), technically it would be legal, but MS did not consider it worth the additional effort, and nor would I.



来源:https://stackoverflow.com/questions/6577713/word-2010-custom-xml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!