Preserve text format when sending the content of a word document as the body of an email,

前端 未结 1 573
礼貌的吻别
礼貌的吻别 2021-01-25 14:39

I\'m trying to send the content of a word document as the body of an outlook email, but it happens that the formats of the texts (Bold, color, etc) are lost after they are inser

1条回答
  •  执笔经年
    2021-01-25 15:31

    The Body property of the MailItem class returns or sets a string representing the clear-text body of the Outlook item. To preserve any formatting you need to use the HTMLBody or Word Editor.

    The Outlook object model provides three main ways for working item bodies:

    1. Body - a string representing the clear-text body of the Outlook item.
    2. HTMLBody - a string representing the HTML body of the specified item.
    3. Word editor - the Microsoft Word Document Object Model of the message being displayed. The WordEditor property of the Inspector class returns an instance of the Document class from the Word object model which you can use to set up the message body.

    You can read more about all these ways in the Chapter 17: Working with Item Bodies.

    So, you can easily use the Word editor to set the message body without loosing any formatting.

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