Manipulating simple bookmarks in Word

ぐ巨炮叔叔 提交于 2020-01-17 03:39:27

问题


There are a lot of questions, answers and posts about openXml, mainly good, thorough stuff that Eric White posts here (also here and other stack-overflow questions). The thing is the examples have two characteristics that make it difficult for me to apply: First, they are extremely end-to-end in the sense thay take care of every possible scenario possilbe (Like Eric White's XML flattening solution) and thus making the code too complicated. Second, the examples are more snippets and less entire code, and me, being a beginner with openXml, cannot figure out all the "usings" and the instantiations required before the snippet.

I would appreciate your help in two specific simple scenarios:

  1. Replacing a bookmark with text and preserving the style. This bookmark is simple, in the middle of a line, with non-changing style.
  2. Replacing a bookmark with an image from a file.

I have been using Office Interop till now and it's heavy, cumbersome and requires the Word application to be open. Not nice.

来源:https://stackoverflow.com/questions/13437250/manipulating-simple-bookmarks-in-word

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