AMAN SHARMA
AMAN SHARMA

Reputation: 341

`body.insertHtml` working incorrectly with list items

Expected Behavior

I am trying to run this code:

const html = '<ul><li>ListItem1</li><li>ListItem2</li><li>ListItem3</li></ul>';
body.insertHtml(html, Word.InsertLocation.end)

to expect:

expected

Current Behavior

Somehow, the API doesn't detect the last list item.

bug

Steps to Reproduce, or Live Example

Link to live example: ScirptLab

Context

I am trying to render unordered lists in Word programmatically.

Your Environment

Upvotes: 0

Views: 70

Answers (1)

Eugene Astafiev
Eugene Astafiev

Reputation: 49395

You just need to append something to the end, for example, you may append <br> to the HTML string:

<ul><li>ListItem1</li><li>ListItem2</li><li>ListItem3</li></ul><br>

Upvotes: 2

Related Questions