ms office - extra line on insertHtml in contentControl -


in office api word 2016 using contentcontrol's inserthtml function insert html-formatted text. text inserts block element line added end. similar functionality in api word 2013, setdataasync coerciontype "html" worked correctly , inserted inline element. there way specify need inline element.

basically need when try insert (text <i>inserted</i> <b>inserthtml</b>) is:

this existing text (text inserted inserthtml) followed more text

what getting is:

this existing text

(text inserted inserthtml)

< blank line >

followed more text

thank you.

this known issue on word javascript api , working on fix it. in meantime please use setselecteddataasync coerciontype html achieve need. inserthtml have same behavior.

here code samples add context of question. intend grab current selection , insert html. there 2 ways of doing in api (see below). right inserthtml adding paragraph mark @ end, bug we'll fix soon.

function inserthtmlsample() {     word.run(function (context) {         var myselection = context.document.getselection();         myselection.inserthtml("text <i>inserted</i> <b>inserthtml</b>", "before");         return  context.sync();      }).catch(function (error) {         app.shownotification(error.message);     }) }   function inserthtmlold() {     office.context.document.setselecteddataasync("text <i>inserted</i> <p> </p> <b>insert  <p>html</b> </p> hello!!!  ", { coerciontype: 'html' }); } 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -