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

查看:23
本文介绍了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.

我尝试使用 Redemption 包装约会并公开 RTFBodycode> 属性,但 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 = @"{
tf1ansideff0{fonttbl{f0 Arial;}}{colortbl ;
ed0green0lue255;}pardcf1f0fs24 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;

然后根据Word 对象模型.

这篇关于Outlook AppointmentItem - 如何以编程方式将 RTF 添加到其正文?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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