I have created a Word add-in using Office JavaScript APIs
I called APIs to insert text into a document at the located cursor position
Below code, I am using
await Word.run(async (context) => {
const paragraphs = context.document.body.paragraphs;
paragraphs.load("$none");
await context.sync();
// Start new list using the second paragraph.
const list = paragraphs.items[1].startNewList();
list.load("$none");
await context.sync();
// To add new items to the list, use Start or End on the insertLocation parameter.
list.insertParagraph("New list item at the start of the list", "Start");
const paragraph = list.insertParagraph("New list item at the end of the list (set to list level 5)", "End");
// Sets up list level for the list item.
paragraph.listItem.level = 4;
// To add paragraphs outside the list, use Before or After.
list.insertParagraph("New paragraph goes after (not part of the list)", "After");
await context.sync();
});
My issue is,
Paragraphs are created into word document BUT cursor not adjusted to end range
Is there any APIs OR solution to fix this?
Thanks