Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

161
Views
Div element not showing up after insertHtml
Word.run(function (context) {
var currElement = context.document.getSelection();
currElement.insertHtml('<div id="xyz">abc</div>', "After");
const body = context.document.body;
const bodyHtml = body.getHtml();
context.sync().then(() => {console.log(bodyHtml.value)});}

While printing out the html of the document after calling context.sync(), it doesn't display div at all. It displays <p class=MsoNormal>abc</p> instead.

However, the text is displayed with a paragraph tag. How do you display the div tag with the id/class name when you print the html of the document?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!