我目前正在开发一个Outlook加载项。此加载项编辑已登录Outlook用户的OOF设置。我必须从.oft文件中获取外部消息的文本 加载项运行正常,一切都按预期工作。这个字体只有一个小问题。我想改变我们公司标准的两个回复的字体,但我认为无法实现这一点。
有没有办法改变字体?
答案 0 :(得分:2)
Body.Html允许您指定强制类型。在这里,您可以指定HTML并为正文中的文本添加样式 例如:
Office.context.mailbox.item.body.setAsync(
"<p style=\"font-family: 'Arial Black', 'Arial Bold', Gadget, sans-serif;\">text</p>",
{ coercionType:"html"},
function callback(result) {
// Process the result
});
答案 1 :(得分:1)
您可以获取要更改的项目,然后将其更新为outlined here。您需要做的是获取邮件的Body
- 属性,然后更改此正文中的<body>
- 标记:
// As a best practice, limit the properties returned to only those that are required.
PropertySet propSet = new PropertySet(BasePropertySet.IdOnly, ItemSchema.Body);
// Bind to the existing item by using the ItemId.
// This method call results in a GetItem call to EWS.
Item item = Item.Bind(service, itemId, propSet);
// item.Body.value = "<html><body> Example body </body></html>"
// Update the style of the mail's body.
item.Body.value = "<html><body style='font-family: Arial'> Example body </body></html>"
// Save the updated email.
// This method call results in an UpdateItem call to EWS.
item.Update(ConflictResolutionMode.AlwaysOverwrite);
答案 2 :(得分:1)
感谢您的帮助!
最简单的方法是将html标签添加到我用于string message = "<html><div style='font-size:11pt; font-family:Calibri;'>" + template.body + "</div></html>";
- 对象的字符串中。像这样://Default added for url building with section, but makes no difference
routes.MapRoute(
name: "Default",
url: "{section}/{controller}/{action}/{id}"
);
routes.MapRoute(
name: "Test1",
url: "Test1/{controller}/{action}/{id}",
defaults: new { section = "Test1", controller = "Home", action = "Index", id = UrlParameter.Optional },
namespaces: new[] { "MVCTest.Controllers.Test1" }
);
routes.MapRoute(
name: "Test2",
url: "Test2/{controller}/{action}/{id}",
defaults: new { section = "Test2", controller = "Home", action = "Index", id = UrlParameter.Optional },
namespaces: new[] { "MVCTest.Controllers.Test2" }
);