0

There is an Outlook add-in app.

When the button is clicked, the table is inserted in the body, and after the first insertion, the next button is clicked and I want to insert the table column.

Are there any related tutorials?

The method that uses the table for the body is using - office.js prependAsync method.

김세림
  • 291
  • 1
  • 5
  • 17

1 Answers1

0

Adding a column to an HTML table after inserting it into the body of a message is quite difficult since we don't provide any special APIs for manipulating individual HTML elements inserted into the body of a message.

One good approach is to build the table entirely in the add-in, and then use a button in the add-in to insert it into the body of the message. If you need more real estate to construct the table visually, you can use the Office dialog API to open a dialog window with your desired size.

We have a UserVoice page for feature requests. Please add a request there if you believe this should be a separate feature. We review and consider feature requests when going through our planning process.

  • Is there any way to delete the added html table? – 김세림 Jul 08 '20 at 05:02
  • Not as such, you will have to set the entire body again with the table removed. You can store a copy of the entire body HTML in the add-in's Javascript, add / remove columns whenever necessary and call body.setAsync with the full HTML every time. Is there a problem you face with this approach? – Outlook Add-ins Team - MSFT Jul 08 '20 at 09:32
  • After saving html with getAsync, how do I extract tables only among different data? Is there a way to recognize the tag after saving it as html? – 김세림 Jul 09 '20 at 01:11
  • When adding html, isn't it possible to add a selector (id)? – 김세림 Jul 09 '20 at 02:55
  • The selector (id) set in the body by the add-in might be removed by Outlook, for optimization purposes. This behaviour differs from platform to platform (Windows, Mac, OWA, etc.) so it is not recommended to use div tags or ids to identify HTML elements. Can you not cache the entire body in the Javascript side, and set it every time (after editing it)? If you want to insert and edit the table into the body which is not entirely set by the add-in, I'm afraid that's not possible today. Please feel free to suggest this in our UserVoice page. – Outlook Add-ins Team - MSFT Jul 09 '20 at 10:54
  • So, are you saying there is no way to find the exact match between the html body I added and the text in outlook? – 김세림 Jul 10 '20 at 06:04
  • Yes, there is no way to find the exact match as of today. – Outlook Add-ins Team - MSFT Jul 10 '20 at 12:03