简体   繁体   中英

Convert contents of a rich content control in word 2010 to html format

Is there any way to convert the contents (along with the formatting and embedded images) of a rich contentControl in word 2010 to HTML. The contentControl.Range.WordOpenXml property returns a XML in the openXml format. However this XML is not a full fledged openXml document mark-up and just a part of it. This denies the possibility of using any HTMLConverter libraries for OpenXML to HTML to be used. I gave it a try with Power Tools for Open XML by EricWhiteDpe but the markup cannot be even loaded in a WordprocessingDocument object. (Error : Corrupt data) What else could be my options?

I'm not sure if this will work, but the idea I have is - try creating a new document and add the contents of the contentControl.Range.WordOpenXml to the new document, then save it. You could then take this new document's Open Office XML and covert it to HTML using the tools you mentioned.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM