【问题标题】:VSTO insert image into word, excel, power-point and mail attachment in outlookVSTO 将图像插入到 Outlook 中的 word、excel、power-point 和邮件附件中
【发布时间】:2013-06-27 19:14:46
【问题描述】:

我正在开发 VSTO 应用程序。在某些时候,我创建了一个我想向用户显示的图像。
我的问题:

  1. 如何将该图像插入到 Word 文档中。
  2. 如何将该图像插入到活动 Excel 工作表中。
  3. 如何将该图像插入到 PowerPoint 中的新幻灯片中。
  4. 如何将该图像作为附件插入到 Outlook 的邮件中。

更新:我尝试了什么

对于单词WordApp.ActiveDocument.Shapes.AddPicture(fileFullPath, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);,它正在工作。

对于 excel 我得到了HRESULT: 0x800A03EC Error

【问题讨论】:

  • 来吧...您知道 StackOverflow 规则...您尝试过什么? :]
  • @KazJaw 谢谢.. 我更新了我的问题
  • 至少有人可以在前景方面帮助我吗?

标签: c# vsto office-addins


【解决方案1】:

我找到了两个解决这个问题的方法:

第一:

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 
 }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-09-25
    • 1970-01-01
    • 2016-02-09
    • 1970-01-01
    • 2012-02-01
    • 2015-01-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多