【发布时间】:2021-07-16 12:51:11
【问题描述】:
我正在开发这个 Outlook VSTO 插件,在电子邮件正文中添加图像,但两周都没有运气!!!它适用于普通路径,如 c:\folder 但如果我想使用应用程序内的 Resources 文件夹,它就不起作用了。
当我运行它并单击按钮时,它崩溃并转到: document.Application.Selection.InlineShapes.AddPicture(ImagePath);
有一个带按钮的功能区。当用户点击时,它应该在正文中添加电子邮件签名。
请帮忙!!!!!!!!!!!!!!!!!!!
private void button_Click(object sender, RibbonControlEventArgs e)
{
Outlook.Inspector inspector = Globals.ThisAddIn.Application.ActiveInspector();
Word.Document document = inspector.WordEditor;
string ImagePath = @"\Resources\Picture.jpg";
if (document.Application.Selection == null)
{
MessageBox.Show("Please select the email body");
}
else
{
document.Application.Selection.InlineShapes.AddPicture(ImagePath);
}
}
【问题讨论】: