OfficeDev / office-js

A repo and NPM package for Office.js, corresponding to a copy of what gets published to the official "evergreen" Office.js CDN, at https://appsforoffice.microsoft.com/lib/1/hosted/office.js.
https://learn.microsoft.com/javascript/api/overview
Other
671 stars 95 forks source link

Outlook Desktop, setSelectedDataAsync inserts HTML and ignores font size #4202

Closed DmitryKostochko closed 2 months ago

DmitryKostochko commented 7 months ago

Provide required information needed to triage your issue

In an Outlook add-in for compose mode, we use the item.body.setSelectedDataAsync() method to insert HTML in the body of an item. The setSelectedDataAsync() inserts 11pt text instead of 12pt.

Your Environment

Expected behavior

The setSelectedDataAsync method shall insert HTML with the specified text size.

Current behavior

The setSelectedDataAsync method ignores the style attribute and inserts text with a font size of 11pt.

Steps to reproduce

  1. Open the add-in's pane and execute the following code: Office.context.mailbox.item.setSelectedDataAsync("<p class=\"MsoNormal\"><span style=\"font-size: 12pt; font-family: 'Times New Roman', Times, serif;\">Must be Times New Roman, 12pt.</span></p>", { coercionType : "html"})`

  2. As you can see, the font family was applied, but the font size was ignored.

Provide additional details

  1. The issue is reproducible only in the classic Outlook desktop.

Useful logs

ztcdsb commented 6 months ago

Thank you for the additional context. We are reaching out to the Microsoft Word team for additional guidance and awaiting their response. Internal tracking ID: 5401672

DmitryKostochko commented 2 months ago

Please reopen the case because the bug is still reproducible in Outlook version 2406 (Build 17726.20126).