Outlook AppointmentItem-如何以编程方式将RTF添加到其主体? [英] Outlook AppointmentItem - How do I programmatically add RTF to its Body?

查看:42
本文介绍了Outlook AppointmentItem-如何以编程方式将RTF添加到其主体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将AppointmentItemBody设置为包含嵌入式图像的RTF字符串.设置Microsoft.Office.Interop.Outlook.AppointmentItem.Body将导致RTF在约会中原样显示.

I would like to set the Body of an AppointmentItem to a string of RTF that contains an embedded image. Setting Microsoft.Office.Interop.Outlook.AppointmentItem.Body results in the RTF appearing as-is in the appointment.

我尝试使用赎回来包装约会并公开RTFBody属性,但是RTF格式(包括图像)将丢失.

I have tried using Redemption which wraps the appointment and exposes an RTFBody property, but the RTF formatting (including the image) is lost.

在此示例中(没有嵌入式图像),RTF照原样出现在文档中.有没有人设法做到这一点?

In this example (which doesn't have an embedded image) the RTF appears in the document as-is. Has anyone managed to do this?

var appointment = (AppointmentItem)app.CreateItem(OlItemType.olAppointmentItem);
appointment.Subject = "test subject";
appointment.Start = DateTime.Now;
appointment.End = DateTime.Now.AddHours(1);
appointment.Body = @"{\rtf1\ansi\deff0{\fonttbl{\f0 Arial;}}{\colortbl ;\red0\green0\blue255;}\pard\cf1\f0\fs24 Test}";
appointment.Save();

推荐答案

我知道的唯一方法是访问AppointmentItem的GetInspector属性,并使用它来获取用于解析RTF格式的基础WordEditor,例如:

The only way I know is to access the AppointmentItem's GetInspector property, and use it to fetch the underlying WordEditor used to parse the RTF format, something like:

var doc = appointment.GetInspector.WordEditor as Microsoft.Office.Interop.Word.Document;

,然后根据 查看全文

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