首页 > 解决方案 > C# 使用 .docx 文本内容发送 Windows Mail

问题描述

我需要获取 .docx 格式的文本,然后准备在 windows Mail 应用程序中发送它(不使用 stmp 发送,只需打开 windows Mail 并将单词文本粘贴到正文中)。

我已经尝试使用 Microsoft.Office.Interop.Word 复制粘贴它,但文本未格式化。这是我发送邮件/获取 Word 内容的代码:

谢谢您的帮助 !

       Microsoft.Office.Interop.Word.Application app = new Microsoft.Office.Interop.Word.Application();
            Microsoft.Office.Interop.Word.Document doc = app.Documents.Open(fileName);

            string allWords = doc.Content.Text;
            doc.Close();
            app.Quit();

            string mailto = string.Format("mailto:{0}?Subject={1}&Body={2}", destinataire.Text, objet.Text, allWords);
            mailto = Uri.EscapeUriString(mailto);
            System.Diagnostics.Process.Start(mailto);

标签: c#

解决方案


推荐阅读