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
690 stars 95 forks source link

Outlook Desktop, Outlook for Mac, setSelectedDataAsync produces incorrect formatting for tables #1523

Open DmitryKostochko opened 4 years ago

DmitryKostochko commented 4 years ago

Message from office-js bot: We’re closing this issue because it has been inactive for a long time. We’re doing this to keep the issues list manageable and useful for everyone. If this issue is still relevant for you, please create a new issue. Thank you for your understanding and continued feedback.

In an Outlook add-in for compose mode, we use the Office JS API to fill in email fields. The setSelectedDataAsync method inserts HTML with incorrect markup, the caption of a table is filled with the background color of the table.

Expected Behavior

The table's caption shall not take the background color of the table.

Current Behavior

The caption is filled with the table's background color.

Steps to Reproduce, or Live Example

Create a new email in Outlook Desktop or Outlook for Mac and execute the code below.

Office.context.mailbox.item.body.setSelectedDataAsync( '<table style="border-collapse: collapse; width: 100%; background-color: #70ad47; border-style: solid;" border="1"><caption>caption</caption>' + ' <tbody>' + ' <tr>' + ' <td style="border-style: solid; width: 50%;">&nbsp;</td>' + ' <td style="border-style: solid; width: 50%;">&nbsp;</td>' + ' </tr>' + ' </tbody>' + '</table>', { coercionType : 'html' }, (asyncResult) => { } );

Your Environment

Useful logs

exextoc commented 4 years ago

Thanks for reporting this issue regarding setSelectedDataAsync. It has been put on our backlog. We unfortunately have no timelines to share at this point.

DmitryKostochko commented 8 months ago

@gergzk, please reopen the issue. The bug is still reproducible in Outlook Desktop and Outlook for Mac.