Outlook AppointmentItem - How do I programmatically add RTF to its Body?

前端 未结 2 1979
名媛妹妹
名媛妹妹 2021-01-15 06:19

I would like to set the Body of an AppointmentItem to a string of RTF that contains an embedded image. Setting Microsoft.Office.Interop.Outl

相关标签:
2条回答
  • 2021-01-15 06:30

    The best info I have seen on this is as per this answer: http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/b41acf6f-71c1-4a8b-9662-fbff26ba3a24/

    Basically, it's a klunkly 2-step process:

    1. Get reference to the WordEditor object
    2. Using the clipboard, copy and paste the formatted content into the editor

    Seriously Microsoft, surely you could have come up with a better design.

    0 讨论(0)
  • 2021-01-15 06:38

    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;
    

    and then format the document using doc.Content according to Word Object Model.

    0 讨论(0)
提交回复
热议问题