【问题标题】:How to retain the formatting while appending a word document to lotus notes mail body through VBScript?通过VBScript将word文档附加到lotus notes邮件正文时如何保留格式?
【发布时间】:2012-06-07 18:19:39
【问题描述】:

我正在尝试自动化一个邮件系统,在该系统中,编辑后的 ​​Word 文档将通过 Lotus Notes 邮寄给许多人。

我正在使用以下代码来执行此操作。此代码运行良好,只是在作为邮件发送时会丢失所有格式(例如粗体、斜体、段落等)。

Set objRange = ob_doc.Content
mailtext = ob_word.CleanString(objRange.Text)

'Create the mail document
Set notesDocument = notesDatabase.CreateDocument
'set to memo format
notesDocument.Form = "Memo"
'Set the subject
notesDocument.Subject = subject
'Set the body
Set notesRichTextItem = notesDocument.CreateRichTextItem("Body")
notesRichTextItem.AppendText(mailtext)

... 在做了一些研究之后,我尝试将 word doc 转换为 html 以保持格式不变,但我无法将该 html 文件作为邮件正文邮寄。

【问题讨论】:

    标签: html vbscript ms-word formatting lotus-notes


    【解决方案1】:

    您需要使用 Notes 中的 MimeEntity 类以 HTML 格式发送电子邮件。有关更多信息,请参阅此 SO 答案:Sending formatted Lotus Notes rich text email from Excel VBA

    【讨论】:

      【解决方案2】:

      或者您可以将 Word 文档作为附件发送。它没有那么优雅,但代码很简单。

      【讨论】:

        【解决方案3】:

        如果您希望 Word 文档在 Notes 客户端(或任何其他电子邮件客户端)中的显示方式与在 MS Word 中的显示方式相同,您会感到很头疼。最接近的解决方案是使用 MS Word 将文档保存为 HTML(如您所提到的),然后使用 Notes MIME 类使用 Word 生成的 HTML(如 Ken 提到的)创建电子邮件。您将面临的最大问题是 Word 使用样式的方式。不同的电子邮件客户端对样式有不同的要求,Notes 相当挑剔——例如,所有样式都必须是内联的(不是全局的或外部的),Word 不会这样做。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2021-08-10
          • 1970-01-01
          • 2020-11-09
          • 2023-02-18
          • 1970-01-01
          • 2020-01-20
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多