What's new in Word JavaScript API 1.1
WordApi 1.1 is the first requirement set of the Word JavaScript API. It's the only Word API requirement set supported by Word 2016.
API list
The following table lists the APIs in Word JavaScript API requirement set 1.1. To view API reference documentation for all APIs supported by Word JavaScript API requirement set 1.1, see Word APIs in requirement set 1.1.
Class | Fields | Description |
---|---|---|
Body | clear() | Clears the contents of the body object. |
contentControls | Gets the collection of rich text content control objects in the body. | |
font | Gets the text format of the body. | |
getHtml() | Gets an HTML representation of the body object. | |
getOoxml() | Gets the OOXML (Office Open XML) representation of the body object. | |
inlinePictures | Gets the collection of InlinePicture objects in the body. | |
insertBreak(breakType: Word.BreakType | "Page" | "Next" | "SectionNext" | "SectionContinuous" | "SectionEven" | "SectionOdd" | "Line", insertLocation: Word.InsertLocation.start | Word.InsertLocation.end | "Start" | "End") | Inserts a break at the specified location in the main document. | |
insertContentControl() | Wraps the Body object with a Rich Text content control. | |
insertFileFromBase64(base64File: string, insertLocation: Word.InsertLocation.replace | Word.InsertLocation.start | Word.InsertLocation.end | "Replace" | "Start" | "End") | Inserts a document into the body at the specified location. | |
insertHtml(html: string, insertLocation: Word.InsertLocation.replace | Word.InsertLocation.start | Word.InsertLocation.end | "Replace" | "Start" | "End") | Inserts HTML at the specified location. | |
insertOoxml(ooxml: string, insertLocation: Word.InsertLocation.replace | Word.InsertLocation.start | Word.InsertLocation.end | "Replace" | "Start" | "End") | Inserts OOXML at the specified location. | |
insertParagraph(paragraphText: string, insertLocation: Word.InsertLocation.start | Word.InsertLocation.end | "Start" | "End") | Inserts a paragraph at the specified location. | |
insertText(text: string, insertLocation: Word.InsertLocation.replace | Word.InsertLocation.start | Word.InsertLocation.end | "Replace" | "Start" | "End") | Inserts text into the body at the specified location. | |
paragraphs | Gets the collection of paragraph objects in the body. | |
parentContentControl | Gets the content control that contains the body. | |
search(searchText: string, searchOptions?: Word.SearchOptions | { ignorePunct?: boolean ignoreSpace?: boolean matchCase?: boolean matchPrefix?: boolean matchSuffix?: boolean matchWholeWord?: boolean matchWildcards?: boolean }) | Performs a search with the specified SearchOptions on the scope of the body object. | |
select(selectionMode?: Word.SelectionMode) | Selects the body and navigates the Word UI to it. | |
style | Specifies the style name for the body. | |
text | Gets the text of the body. | |
ContentControl | appearance | Specifies the appearance of the content control. |
cannotDelete | Specifies a value that indicates whether the user can delete the content control. | |
cannotEdit | Specifies a value that indicates whether the user can edit the contents of the content control. | |
clear() | Clears the contents of the content control. | |
color | Specifies the color of the content control. | |
contentControls | Gets the collection of content control objects in the content control. | |
delete(keepContent: boolean) | Deletes the content control and its content. | |
font | Gets the text format of the content control. | |
getHtml() | Gets an HTML representation of the content control object. | |
getOoxml() | Gets the Office Open XML (OOXML) representation of the content control object. | |
id | Gets an integer that represents the content control identifier. | |
inlinePictures | Gets the collection of InlinePicture objects in the content control. | |
insertBreak(breakType: Word.BreakType | "Page" | "Next" | "SectionNext" | "SectionContinuous" | "SectionEven" | "SectionOdd" | "Line", insertLocation: Word.InsertLocation.start | Word.InsertLocation.end | Word.InsertLocation.before | Word.InsertLocation.after | "Start" | "End" | "Before" | "After") | Inserts a break at the specified location in the main document. | |
insertFileFromBase64(base64File: string, insertLocation: Word.InsertLocation.replace | Word.InsertLocation.start | Word.InsertLocation.end | "Replace" | "Start" | "End") | Inserts a document into the content control at the specified location. | |
insertHtml(html: string, insertLocation: Word.InsertLocation.replace | Word.InsertLocation.start | Word.InsertLocation.end | "Replace" | "Start" | "End") | Inserts HTML into the content control at the specified location. | |
insertOoxml(ooxml: string, insertLocation: Word.InsertLocation.replace | Word.InsertLocation.start | Word.InsertLocation.end | "Replace" | "Start" | "End") | Inserts OOXML into the content control at the specified location. | |
insertParagraph(paragraphText: string, insertLocation: Word.InsertLocation.start | Word.InsertLocation.end | Word.InsertLocation.before | Word.InsertLocation.after | "Start" | "End" | "Before" | "After") | Inserts a paragraph at the specified location. | |
insertText(text: string, insertLocation: Word.InsertLocation.replace | Word.InsertLocation.start | Word.InsertLocation.end | "Replace" | "Start" | "End") | Inserts text into the content control at the specified location. | |
paragraphs | Gets the collection of paragraph objects in the content control. | |
parentContentControl | Gets the content control that contains the content control. | |
placeholderText | Specifies the placeholder text of the content control. | |
removeWhenEdited | Specifies a value that indicates whether the content control is removed after it is edited. | |
search(searchText: string, searchOptions?: Word.SearchOptions | { ignorePunct?: boolean ignoreSpace?: boolean matchCase?: boolean matchPrefix?: boolean matchSuffix?: boolean matchWholeWord?: boolean matchWildcards?: boolean }) | Performs a search with the specified SearchOptions on the scope of the content control object. | |
select(selectionMode?: Word.SelectionMode) | Selects the content control. | |
style | Specifies the style name for the content control. | |
tag | Specifies a tag to identify a content control. | |
text | Gets the text of the content control. | |
title | Specifies the title for a content control. | |
type | Gets the content control type. | |
ContentControlCollection | getById(id: number) | Gets a content control by its identifier. |
getByTag(tag: string) | Gets the content controls that have the specified tag. | |
getByTitle(title: string) | Gets the content controls that have the specified title. | |
getItem(id: number) | Gets a content control by its ID. | |
items | Gets the loaded child items in this collection. | |
Document | body | Gets the body object of the main document. |
contentControls | Gets the collection of content control objects in the document. | |
getSelection() | Gets the current selection of the document. | |
save() | Saves the document. | |
saved | Indicates whether the changes in the document have been saved. | |
sections | Gets the collection of section objects in the document. | |
Font | bold | Specifies a value that indicates whether the font is bold. |
color | Specifies the color for the specified font. | |
doubleStrikeThrough | Specifies a value that indicates whether the font has a double strikethrough. | |
highlightColor | Specifies the highlight color. | |
italic | Specifies a value that indicates whether the font is italicized. | |
name | Specifies a value that represents the name of the font. | |
size | Specifies a value that represents the font size in points. | |
strikeThrough | Specifies a value that indicates whether the font has a strikethrough. | |
subscript | Specifies a value that indicates whether the font is a subscript. | |
superscript | Specifies a value that indicates whether the font is a superscript. | |
underline | Specifies a value that indicates the font's underline type. | |
InlinePicture | altTextDescription | Specifies a string that represents the alternative text associated with the inline image. |
altTextTitle | Specifies a string that contains the title for the inline image. | |
getBase64ImageSrc() | Gets the Base64-encoded string representation of the inline image. | |
height | Specifies a number that describes the height of the inline image. | |
hyperlink | Specifies a hyperlink on the image. | |
insertContentControl() | Wraps the inline picture with a rich text content control. | |
lockAspectRatio | Specifies a value that indicates whether the inline image retains its original proportions when you resize it. | |
parentContentControl | Gets the content control that contains the inline image. | |
width | Specifies a number that describes the width of the inline image. | |
InlinePictureCollection | items | Gets the loaded child items in this collection. |
Paragraph | alignment | Specifies the alignment for a paragraph. |
clear() | Clears the contents of the paragraph object. | |
contentControls | Gets the collection of content control objects in the paragraph. | |
delete() | Deletes the paragraph and its content from the document. | |
firstLineIndent | Specifies the value, in points, for a first line or hanging indent. | |
font | Gets the text format of the paragraph. | |
getHtml() | Gets an HTML representation of the paragraph object. | |
getOoxml() | Gets the Office Open XML (OOXML) representation of the paragraph object. | |
inlinePictures | Gets the collection of InlinePicture objects in the paragraph. | |
insertBreak(breakType: Word.BreakType | "Page" | "Next" | "SectionNext" | "SectionContinuous" | "SectionEven" | "SectionOdd" | "Line", insertLocation: Word.InsertLocation.before | Word.InsertLocation.after | "Before" | "After") | Inserts a break at the specified location in the main document. | |
insertContentControl() | Wraps the Paragraph object with a rich text content control. | |
insertFileFromBase64(base64File: string, insertLocation: Word.InsertLocation.replace | Word.InsertLocation.start | Word.InsertLocation.end | "Replace" | "Start" | "End") | Inserts a document into the paragraph at the specified location. | |
insertHtml(html: string, insertLocation: Word.InsertLocation.replace | Word.InsertLocation.start | Word.InsertLocation.end | "Replace" | "Start" | "End") | Inserts HTML into the paragraph at the specified location. | |
insertInlinePictureFromBase64(base64EncodedImage: string, insertLocation: Word.InsertLocation.replace | Word.InsertLocation.start | Word.InsertLocation.end | "Replace" | "Start" | "End") | Inserts a picture into the paragraph at the specified location. | |
insertOoxml(ooxml: string, insertLocation: Word.InsertLocation.replace | Word.InsertLocation.start | Word.InsertLocation.end | "Replace" | "Start" | "End") | Inserts OOXML into the paragraph at the specified location. | |
insertParagraph(paragraphText: string, insertLocation: Word.InsertLocation.before | Word.InsertLocation.after | "Before" | "After") | Inserts a paragraph at the specified location. | |
insertText(text: string, insertLocation: Word.InsertLocation.replace | Word.InsertLocation.start | Word.InsertLocation.end | "Replace" | "Start" | "End") | Inserts text into the paragraph at the specified location. | |
leftIndent | Specifies the left indent value, in points, for the paragraph. | |
lineSpacing | Specifies the line spacing, in points, for the specified paragraph. | |
lineUnitAfter | Specifies the amount of spacing, in grid lines, after the paragraph. | |
lineUnitBefore | Specifies the amount of spacing, in grid lines, before the paragraph. | |
outlineLevel | Specifies the outline level for the paragraph. | |
parentContentControl | Gets the content control that contains the paragraph. | |
rightIndent | Specifies the right indent value, in points, for the paragraph. | |
search(searchText: string, searchOptions?: Word.SearchOptions | { ignorePunct?: boolean ignoreSpace?: boolean matchCase?: boolean matchPrefix?: boolean matchSuffix?: boolean matchWholeWord?: boolean matchWildcards?: boolean }) | Performs a search with the specified SearchOptions on the scope of the paragraph object. | |
select(selectionMode?: Word.SelectionMode) | Selects and navigates the Word UI to the paragraph. | |
spaceAfter | Specifies the spacing, in points, after the paragraph. | |
spaceBefore | Specifies the spacing, in points, before the paragraph. | |
style | Specifies the style name for the paragraph. | |
text | Gets the text of the paragraph. | |
ParagraphCollection | items | Gets the loaded child items in this collection. |
Range | clear() | Clears the contents of the range object. |
contentControls | Gets the collection of content control objects in the range. | |
delete() | Deletes the range and its content from the document. | |
font | Gets the text format of the range. | |
getHtml() | Gets an HTML representation of the range object. | |
getOoxml() | Gets the OOXML representation of the range object. | |
insertBreak(breakType: Word.BreakType | "Page" | "Next" | "SectionNext" | "SectionContinuous" | "SectionEven" | "SectionOdd" | "Line", insertLocation: Word.InsertLocation.before | Word.InsertLocation.after | "Before" | "After") | Inserts a break at the specified location in the main document. | |
insertContentControl() | Wraps the Range object with a rich text content control. | |
insertFileFromBase64(base64File: string, insertLocation: Word.InsertLocation | "Replace" | "Start" | "End" | "Before" | "After") | Inserts a document at the specified location. | |
insertHtml(html: string, insertLocation: Word.InsertLocation | "Replace" | "Start" | "End" | "Before" | "After") | Inserts HTML at the specified location. | |
insertOoxml(ooxml: string, insertLocation: Word.InsertLocation | "Replace" | "Start" | "End" | "Before" | "After") | Inserts OOXML at the specified location. | |
insertParagraph(paragraphText: string, insertLocation: Word.InsertLocation.before | Word.InsertLocation.after | "Before" | "After") | Inserts a paragraph at the specified location. | |
insertText(text: string, insertLocation: Word.InsertLocation | "Replace" | "Start" | "End" | "Before" | "After") | Inserts text at the specified location. | |
paragraphs | Gets the collection of paragraph objects in the range. | |
parentContentControl | Gets the content control that contains the range. | |
search(searchText: string, searchOptions?: Word.SearchOptions | { ignorePunct?: boolean ignoreSpace?: boolean matchCase?: boolean matchPrefix?: boolean matchSuffix?: boolean matchWholeWord?: boolean matchWildcards?: boolean }) | Performs a search with the specified SearchOptions on the scope of the range object. | |
select(selectionMode?: Word.SelectionMode) | Selects and navigates the Word UI to the range. | |
style | Specifies the style name for the range. | |
text | Gets the text of the range. | |
RangeCollection | items | Gets the loaded child items in this collection. |
SearchOptions | ignorePunct | Specifies a value that indicates whether to ignore all punctuation characters between words. |
ignoreSpace | Specifies a value that indicates whether to ignore all whitespace between words. | |
matchCase | Specifies a value that indicates whether to perform a case sensitive search. | |
matchPrefix | Specifies a value that indicates whether to match words that begin with the search string. | |
matchSuffix | Specifies a value that indicates whether to match words that end with the search string. | |
matchWholeWord | Specifies a value that indicates whether to find operation only entire words, not text that is part of a larger word. | |
matchWildcards | Specifies a value that indicates whether the search will be performed using special search operators. | |
Section | body | Gets the body object of the section. |
getFooter(type: Word.HeaderFooterType) | Gets one of the section's footers. | |
getHeader(type: Word.HeaderFooterType) | Gets one of the section's headers. | |
SectionCollection | items | Gets the loaded child items in this collection. |
See also
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Office Add-ins