使用 Word 编辑器修改 Outlook 2007 中的收件箱电子邮件
我面临着一种情况,我可以使用Word编辑器修改打开的收件箱(活动资源管理器)的内容。
我知道在撰写窗口中使用文字编辑器,但是有没有办法通过文字编辑器访问电子邮件的正文。
在撰写窗口中使用 Word 编辑器的代码。
public void Click(Office.IRibbonControl Control)
{
Outlook.Inspector uiInspector = Globals.ThisAddIn.Application.ActiveInspector();
object uiObject = uiInspector.CurrentItem;
if (uiObject is Outlook.MailItem && uiInspector.IsWordMail())
{
Outlook.MailItem uiItem = (Outlook.MailItem)uiObject;
Word.Document uiDoc = uiInspector.WordEditor as Word.Document;
if (uiDoc != null)
{
Word.Find uiFind = uiDoc.Range().Find;
uiFind.Text = "ASA^$^$^#^#^#^#^#";
while (uiFind.Execute())
{
var rng = uiFind.Parent as Microsoft.Office.Interop.Word.Range;
rng.Hyperlinks.Add(rng, "http://stack.com=" + rng.Text + "outlook2007");
rng.Collapse(Word.WdCollapseDirection.wdCollapseEnd);
}
}
}
I am facing a situation where I can use Word Editor to modify the contents of an open inbox(active explorer).
I know to use word editor for compose window, but is there a way to access the body of the email thorough word editor.
Code for using Word Editor in Compose Window.
public void Click(Office.IRibbonControl Control)
{
Outlook.Inspector uiInspector = Globals.ThisAddIn.Application.ActiveInspector();
object uiObject = uiInspector.CurrentItem;
if (uiObject is Outlook.MailItem && uiInspector.IsWordMail())
{
Outlook.MailItem uiItem = (Outlook.MailItem)uiObject;
Word.Document uiDoc = uiInspector.WordEditor as Word.Document;
if (uiDoc != null)
{
Word.Find uiFind = uiDoc.Range().Find;
uiFind.Text = "ASA^$^$^#^#^#^#^#";
while (uiFind.Execute())
{
var rng = uiFind.Parent as Microsoft.Office.Interop.Word.Range;
rng.Hyperlinks.Add(rng, "http://stack.com=" + rng.Text + "outlook2007");
rng.Collapse(Word.WdCollapseDirection.wdCollapseEnd);
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许在这里回答已经太晚了,但这将帮助其他遇到与我相同问题的开发人员。
如何将 Word 文档文本添加到 Outlook 撰写电子邮件中?
假设您的目录中某个位置有一个 Word 文档,并且希望使用该文档文本填充您的撰写电子邮件。
这里我刚刚修改了你的Click事件
May be it is too late to answer here, but it will help other developer who got into same problem as I was.
How to add word document text into Outlook compose email ?
let suppose you have a Word document some where in your directory and want to fill your compose email with the document text.
Here I just modified your Click event