如何在C#中的word文档中的特定行之后添加图像? [英] How add image after a specific line in word document in C#?

查看:97
本文介绍了如何在C#中的word文档中的特定行之后添加图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在C#中的word文档中的某个特定行之后插入图像。

怎么做?



< b>我尝试了什么:



我尝试将书签插入该行,但选择到文档中该行之前的2页。

此外,文档中的页数也不固定。



当我将图像插入到书签线图像时,插入2页之前并扰乱所有布局文件。

I am trying to insert an image after some specific line in word document in C#.
How to do it?

What I have tried:

I tried inserting Bookmark to that line but selection comes to the 2 pages before that line in document.
Also the number of pages in document is not fixed.

When I insert image to the bookmarked line image inserts 2 pages before and disturbing all layout of the document.

推荐答案

使用暴力:



手动创建一个文件想要的结果。



用占位符替换链接,图像或任何结束的内容;例如



@@ REPLACE ME @@



现在使用它进行搜索和替换文档模板用于插入您想要的任何内容(与替换的内容兼容)。



在这种情况下,您将文档处理为原始数据 ;没有自动化等
Using "brute force":

"Manually" create a document with the desired results.

Replace the "link", image or whatever you wind up with a "place holder"; e.g.

@@REPLACE ME@@

Now use that for a "search and replace" on the document "template" to insert whatever you want (that is compatible with whatever was "replaced").

In this case, you process the doc as "raw data"; no "automation", etc.


这篇关于如何在C#中的word文档中的特定行之后添加图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆