以编程方式将图像插入单词,并带有指向文件的链接 [英] Programmatically insert image to word with link to file

查看:93
本文介绍了以编程方式将图像插入单词,并带有指向文件的链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Word文档中,插入图像"对话框的插入按钮中有一个选项是链接到文件",在这里我可以将图像URL链接输入到文件名输入框中. Word将随后从链接中提取该图像.这样,每次用户打开word文档时,它将从链接中提取该图像.

In Word document, there is an option in the insert image dialog box insert button that is "Link to File", where I can input a image url link into the file name input box. Word will then pull that image from the link. As such everytime the user opens the word document, it will pull that image from the link.

如何使用Microsoft Interop做到这一点?我尝试使用此方法 http://www.c-sharpcorner.com/uploadfile/hrojasara/insert-picture-with-hyperlink-in-word-file-using-C-Sharp/

How do i do that with Microsoft Interop? Ive tried to use this method http://www.c-sharpcorner.com/uploadfile/hrojasara/insert-picture-with-hyperlink-in-word-file-using-C-Sharp/

但是它将图像保存到我不想保存的文件中.

However it saves the image to the file which i do not want to.

希望有人可以提供帮助.谢谢!

Hope someone can help. Thanks!

推荐答案

请参阅.AddPicture方法的文档(

Look at the documentation for the .AddPicture Method (https://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.inlineshapes.addpicture(v=office.15).aspx);

InlineShape AddPicture(
    string FileName,
    ref Object LinkToFile,
    ref Object SaveWithDocument,
    ref Object Range
)

您可以轻松设置参数以获得所需的结果.

You can easily set the parameters to achieve the desired results.

这篇关于以编程方式将图像插入单词,并带有指向文件的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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