Word.InsertLocation enum
Represents the insertion location type.
Remarks
To be used with an API call, such as obj.insertSomething(newStuff, location);. If the location is before or after, the new content will be outside of the modified object. If the location is start or end, the new content will be included as part of the modified object.
Used by
- Word.CommentContentRange: insertText
- Word.Range: insertField, insertFileFromBase64, insertHtml, insertInlinePictureFromBase64, insertOoxml, insertText
Examples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/50-document/insert-section-breaks.yaml
// Adds a section at the current position without adding a page break.
await Word.run(async (context) => {
const body: Word.Body = context.document.body;
const insertLocation: Word.InsertLocation = Word.InsertLocation.end;
body.insertBreak(Word.BreakType.sectionContinuous, insertLocation);
body.insertParagraph("Continuous section", insertLocation);
await context.sync();
console.log("Added a section without adding a page break.");
});
Fields
| after = "After" | Add content after the contents of the calling object. |
| before = "Before" | Add content before the contents of the calling object. |
| end = "End" | Append content to the contents of the calling object. |
| replace = "Replace" | Replace the contents of the current object. |
| start = "Start" | Prepend content to the contents of the calling object. |