我已经为约会制作了outlook 2013 vsto应用程序。该应用程序使用
在约会主体中设置文本7 GB
现在我想将图像设置到预约身体。我的想法是使用
currentAppointment.Body
或使用剪贴板
currentAppointment.GetInspector.WordEditor
但在这种情况下我没有找到任何可行的例子。 任何想法如何做到 感谢。
答案 0 :(得分:0)
首先在项目中添加对Word的引用
然后,此代码将内联图像添加到新约会的正文中。
public void NewAppointment(Office.IRibbonControl control)
{
try
{
Microsoft.Office.Interop.Outlook.Application app = Globals.ThisAddIn.Application;
Microsoft.Office.Interop.Outlook.AppointmentItem currentAppointment = (Microsoft.Office.Interop.Outlook.AppointmentItem)
app.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olAppointmentItem);
currentAppointment.Start = DateTime.Now.AddHours(2);
currentAppointment.End = DateTime.Now.AddHours(3);
currentAppointment.Location = "ConferenceRoom #1";
currentAppointment.Body = "Body of event...";
Microsoft.Office.Interop.Word.Document docx = currentAppointment.GetInspector.WordEditor as Microsoft.Office.Interop.Word.Document;
if (docx != null)
{
Microsoft.Office.Interop.Word.Selection selected = docx.Windows[1].Selection;
docx.InlineShapes.AddPicture(@"c:\temp\test.jpg");
}
currentAppointment.AllDayEvent = false;
currentAppointment.Subject = "Group Project";
currentAppointment.Save();
currentAppointment.Display(true);
}
catch (Exception ex)
{
MessageBox.Show("The following error occurred: " + ex.Message);
}
}