我通常会使用<b>标签或string.bold()来使javascript中的字体变得粗体。然而,我遇到了一个问题,某个函数不接受html标签。
如果我尝试<b>,它将显示在测试示例中。如果我尝试使用string.bold()而不是粗体,您将看到<b>将文本环绕起来。
我注意到新的\行不能很好地工作,但是\n行得通。当我查找它时,\n是新行的特殊字符。然而,我没有看到任何表示粗体的特殊字符。
如何使下面的代码显示为粗体?
### Code
Office.context.mailbox.item.setSelectedDataAsync("Hello " + msgTodisplayname[0] +
",\n\
<b>this is a test to make the font bold</b>", function(asyncResult) {})下面是有问题的代码的图片:

以下是结果的图片:

发布于 2021-08-12 11:39:50
如果我没记错的话,您的函数中缺少一个参数。'{coercionType: Office.CoercionType.Html}‘
Office.context.mailbox.item.body.setSelectedDataAsync(
   'Hello' + displayName + '\n<b>My bold text</b>',
   {coercionType: Office.CoercionType.Html},
   function(asyncResult) {}
)https://stackoverflow.com/questions/68756668
复制相似问题