我正在开发 VSTO 应用程序。在某些时候,我创建了一个图像,我想将其显示给用户。
我的问题:
- 如何将该图像插入到 Word 文档中。
- 如何将该图像插入到事件 Excel 工作表中。
- 如何将该图像插入到 PowerPoint 中的新幻灯片中。
- 如何将该图像作为附件插入到 Outlook 的邮件中。
更新:我尝试过的内容
对于单词 WordApp.ActiveDocument.Shapes.AddPicture(fileFullPath, ref 缺失, ref 缺失, ref 缺失, ref 缺失, ref 缺失, ref 缺失, ref 缺失);
并且它正在工作。
对于Excel,我得到HRESULT:0x800A03EC错误
最佳答案
我找到了这个问题的两个解决方案:
第一:
Globals.ThisAddIn.Application.ActiveDocument.InlineShapes.AddPicture(imagesurl);
第二:
Slide activeSlide = Globals.ThisAddIn.Application.ActiveWindow.View.Slide;
Microsoft.Office.Interop.PowerPoint.Shape ppPicture =
activeSlide.Shapes.AddPicture(imageurl ,
MsoTriState.msoTrue, MsoTriState.msoTrue, 0, 0);
ppPicture.LinkFormat.SourceFullName = imageurl
}
关于c# - VSTO 将图像插入到 Outlook 中的 Word、Excel、PowerPoint 和邮件附件中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17351411/