How to insert an Image in WORD after a bookmark using OpenXML

萝らか妹 提交于 2019-12-12 18:28:57

问题


I am using a word document which has a bookmark inside that. My requirment is to insert an icon after each bookmark using OpenXML 2.0 with C# 4.0.

I tried to use Image content control and the reflected code from OpenXMLSDK tool. Somehow it got worked but now I am getting the full size controls. Also each image has an icon into that for change picture. Can anyone tell me that how can I reduce the size of the picture content control and if possible remove that extra icon.

Also, if anyone has better idea to insert the icon after each bookmark? Somehow inserting an image using OpenXML is not that developer friendly.

Please help on this.


回答1:


The best way to learn how to do something in Open XML is to use - Open XML SDK 2.0 Productivity Tool. You could insert the icons you need manually in MS Word first, save the document and them - open this file in Open XML SDK 2.0 Productivity Tool (which is a part of Open XML SDK 2.0). Then - find the bookmarks and icons you inserted and see how to do that programmaticaly:

Hope that helps!



来源:https://stackoverflow.com/questions/9383998/how-to-insert-an-image-in-word-after-a-bookmark-using-openxml

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