What's new in Word JavaScript API 1.3

WordApi 1.3 added more support for content controls and document-level settings.

API list

The following table lists the APIs in Word JavaScript API requirement set 1.3. To view API reference documentation for all APIs supported by Word JavaScript API requirement set 1.3 or earlier, see Word APIs in requirement set 1.3 or earlier.

Class Fields Description
Application createDocument(base64File?: string) Creates a new document by using an optional Base64-encoded .docx file.
Body getRange(rangeLocation?: Word.RangeLocation.whole | Word.RangeLocation.start | Word.RangeLocation.end | Word.RangeLocation.after | Word.RangeLocation.content | "Whole" | "Start" | "End" | "After" | "Content") Gets the whole body, or the starting or ending point of the body, as a range.
insertTable(rowCount: number, columnCount: number, insertLocation: Word.InsertLocation.start | Word.InsertLocation.end | "Start" | "End", values?: string[][]) Inserts a table with the specified number of rows and columns.
lists Gets the collection of list objects in the body.
parentBody Gets the parent body of the body.
parentBodyOrNullObject Gets the parent body of the body.
parentContentControlOrNullObject Gets the content control that contains the body.
parentSection Gets the parent section of the body.
parentSectionOrNullObject Gets the parent section of the body.
styleBuiltIn Specifies the built-in style name for the body.
tables Gets the collection of table objects in the body.
type Gets the type of the body.
ContentControl getRange(rangeLocation?: Word.RangeLocation | "Whole" | "Start" | "End" | "Before" | "After" | "Content") Gets the whole content control, or the starting or ending point of the content control, as a range.
getTextRanges(endingMarks: string[], trimSpacing?: boolean) Gets the text ranges in the content control by using punctuation marks and/or other ending marks.
insertTable(rowCount: number, columnCount: number, insertLocation: Word.InsertLocation.start | Word.InsertLocation.end | Word.InsertLocation.before | Word.InsertLocation.after | "Start" | "End" | "Before" | "After", values?: string[][]) Inserts a table with the specified number of rows and columns into, or next to, a content control.
lists Gets the collection of list objects in the content control.
parentBody Gets the parent body of the content control.
parentContentControlOrNullObject Gets the content control that contains the content control.
parentTable Gets the table that contains the content control.
parentTableCell Gets the table cell that contains the content control.
parentTableCellOrNullObject Gets the table cell that contains the content control.
parentTableOrNullObject Gets the table that contains the content control.
split(delimiters: string[], multiParagraphs?: boolean, trimDelimiters?: boolean, trimSpacing?: boolean) Splits the content control into child ranges by using delimiters.
styleBuiltIn Specifies the built-in style name for the content control.
subtype Gets the content control subtype.
tables Gets the collection of table objects in the content control.
ContentControlCollection getByIdOrNullObject(id: number) Gets a content control by its identifier.
getByTypes(types: Word.ContentControlType[]) Gets the content controls that have the specified types.
getFirst() Gets the first content control in this collection.
getFirstOrNullObject() Gets the first content control in this collection.
CustomProperty delete() Deletes the custom property.
key Gets the key of the custom property.
type Gets the value type of the custom property.
value Specifies the value of the custom property.
CustomPropertyCollection add(key: string, value: any) Creates a new or sets an existing custom property.
deleteAll() Deletes all custom properties in this collection.
getCount() Gets the count of custom properties.
getItem(key: string) Gets a custom property object by its key, which is case-insensitive.
getItemOrNullObject(key: string) Gets a custom property object by its key, which is case-insensitive.
items Gets the loaded child items in this collection.
Document properties Gets the properties of the document.
DocumentCreated open() Opens the document.
DocumentProperties applicationName Gets the application name of the document.
author Specifies the author of the document.
category Specifies the category of the document.
comments Specifies the Comments field in the metadata of the document.
company Specifies the company of the document.
creationDate Gets the creation date of the document.
customProperties Gets the collection of custom properties of the document.
format Specifies the format of the document.
keywords Specifies the keywords of the document.
lastAuthor Gets the last author of the document.
lastPrintDate Gets the last print date of the document.
lastSaveTime Gets the last save time of the document.
manager Specifies the manager of the document.
revisionNumber Gets the revision number of the document.
security Gets security settings of the document.
subject Specifies the subject of the document.
template Gets the template of the document.
title Specifies the title of the document.
InlinePicture getNext() Gets the next inline image.
getNextOrNullObject() Gets the next inline image.
getRange(rangeLocation?: Word.RangeLocation.whole | Word.RangeLocation.start | Word.RangeLocation.end | "Whole" | "Start" | "End") Gets the picture, or the starting or ending point of the picture, as a range.
parentContentControlOrNullObject Gets the content control that contains the inline image.
parentTable Gets the table that contains the inline image.
parentTableCell Gets the table cell that contains the inline image.
parentTableCellOrNullObject Gets the table cell that contains the inline image.
parentTableOrNullObject Gets the table that contains the inline image.
InlinePictureCollection getFirst() Gets the first inline image in this collection.
getFirstOrNullObject() Gets the first inline image in this collection.
List getLevelParagraphs(level: number) Gets the paragraphs that occur at the specified level in the list.
getLevelString(level: number) Gets the bullet, number, or picture at the specified level as a string.
id Gets the list's id.
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.
levelExistences Checks whether each of the 9 levels exists in the list.
levelTypes Gets all 9 level types in the list.
paragraphs Gets paragraphs in the list.
setLevelAlignment(level: number, alignment: Word.Alignment) Sets the alignment of the bullet, number, or picture at the specified level in the list.
setLevelBullet(level: number, listBullet: Word.ListBullet, charCode?: number, fontName?: string) Sets the bullet format at the specified level in the list.
setLevelIndents(level: number, textIndent: number, bulletNumberPictureIndent: number) Sets the two indents of the specified level in the list.
setLevelNumbering(level: number, listNumbering: Word.ListNumbering, formatString?: Array<string | number>) Sets the numbering format at the specified level in the list.
setLevelStartingNumber(level: number, startingNumber: number) Sets the starting number at the specified level in the list.
ListCollection getById(id: number) Gets a list by its identifier.
getByIdOrNullObject(id: number) Gets a list by its identifier.
getFirst() Gets the first list in this collection.
getFirstOrNullObject() Gets the first list in this collection.
getItem(id: number) Gets a list object by its ID.
items Gets the loaded child items in this collection.
ListItem getAncestor(parentOnly?: boolean) Gets the list item parent, or the closest ancestor if the parent doesn't exist.
getAncestorOrNullObject(parentOnly?: boolean) Gets the list item parent, or the closest ancestor if the parent doesn't exist.
getDescendants(directChildrenOnly?: boolean) Gets all descendant list items of the list item.
level Specifies the level of the item in the list.
listString Gets the list item bullet, number, or picture as a string.
siblingIndex Gets the list item order number in relation to its siblings.
Paragraph attachToList(listId: number, level: number) Lets the paragraph join an existing list at the specified level.
detachFromList() Moves this paragraph out of its list, if the paragraph is a list item.
getNext() Gets the next paragraph.
getNextOrNullObject() Gets the next paragraph.
getPrevious() Gets the previous paragraph.
getPreviousOrNullObject() Gets the previous paragraph.
getRange(rangeLocation?: Word.RangeLocation.whole | Word.RangeLocation.start | Word.RangeLocation.end | Word.RangeLocation.after | Word.RangeLocation.content | "Whole" | "Start" | "End" | "After" | "Content") Gets the whole paragraph, or the starting or ending point of the paragraph, as a range.
getTextRanges(endingMarks: string[], trimSpacing?: boolean) Gets the text ranges in the paragraph by using punctuation marks and/or other ending marks.
insertTable(rowCount: number, columnCount: number, insertLocation: Word.InsertLocation.before | Word.InsertLocation.after | "Before" | "After", values?: string[][]) Inserts a table with the specified number of rows and columns.
isLastParagraph Indicates the paragraph is the last one inside its parent body.
isListItem Checks whether the paragraph is a list item.
list Gets the List to which this paragraph belongs.
listItem Gets the ListItem for the paragraph.
listItemOrNullObject Gets the ListItem for the paragraph.
listOrNullObject Gets the List to which this paragraph belongs.
parentBody Gets the parent body of the paragraph.
parentContentControlOrNullObject Gets the content control that contains the paragraph.
parentTable Gets the table that contains the paragraph.
parentTableCell Gets the table cell that contains the paragraph.
parentTableCellOrNullObject Gets the table cell that contains the paragraph.
parentTableOrNullObject Gets the table that contains the paragraph.
split(delimiters: string[], trimDelimiters?: boolean, trimSpacing?: boolean) Splits the paragraph into child ranges by using delimiters.
startNewList() Starts a new list with this paragraph.
styleBuiltIn Specifies the built-in style name for the paragraph.
tableNestingLevel Gets the level of the paragraph's table.
ParagraphCollection getFirst() Gets the first paragraph in this collection.
getFirstOrNullObject() Gets the first paragraph in this collection.
getLast() Gets the last paragraph in this collection.
getLastOrNullObject() Gets the last paragraph in this collection.
Range compareLocationWith(range: Word.Range) Compares this range's location with another range's location.
expandTo(range: Word.Range) Returns a new range that extends from this range in either direction to cover another range.
expandToOrNullObject(range: Word.Range) Returns a new range that extends from this range in either direction to cover another range.
getHyperlinkRanges() Gets hyperlink child ranges within the range.
getNextTextRange(endingMarks: string[], trimSpacing?: boolean) Gets the next text range by using punctuation marks and/or other ending marks.
getNextTextRangeOrNullObject(endingMarks: string[], trimSpacing?: boolean) Gets the next text range by using punctuation marks and/or other ending marks.
getRange(rangeLocation?: Word.RangeLocation.whole | Word.RangeLocation.start | Word.RangeLocation.end | Word.RangeLocation.after | Word.RangeLocation.content | "Whole" | "Start" | "End" | "After" | "Content") Clones the range, or gets the starting or ending point of the range as a new range.
getTextRanges(endingMarks: string[], trimSpacing?: boolean) Gets the text child ranges in the range by using punctuation marks and/or other ending marks.
hyperlink Gets the first hyperlink in the range, or sets a hyperlink on the range.
insertTable(rowCount: number, columnCount: number, insertLocation: Word.InsertLocation.before | Word.InsertLocation.after | "Before" | "After", values?: string[][]) Inserts a table with the specified number of rows and columns.
intersectWith(range: Word.Range) Returns a new range as the intersection of this range with another range.
intersectWithOrNullObject(range: Word.Range) Returns a new range as the intersection of this range with another range.
isEmpty Checks whether the range length is zero.
lists Gets the collection of list objects in the range.
parentBody Gets the parent body of the range.
parentContentControlOrNullObject Gets the currently supported content control that contains the range.
parentTable Gets the table that contains the range.
parentTableCell Gets the table cell that contains the range.
parentTableCellOrNullObject Gets the table cell that contains the range.
parentTableOrNullObject Gets the table that contains the range.
split(delimiters: string[], multiParagraphs?: boolean, trimDelimiters?: boolean, trimSpacing?: boolean) Splits the range into child ranges by using delimiters.
styleBuiltIn Specifies the built-in style name for the range.
tables Gets the collection of table objects in the range.
RangeCollection getFirst() Gets the first range in this collection.
getFirstOrNullObject() Gets the first range in this collection.
RequestContext application [Api set: WordApi 1.3] *
Section getNext() Gets the next section.
getNextOrNullObject() Gets the next section.
SectionCollection getFirst() Gets the first section in this collection.
getFirstOrNullObject() Gets the first section in this collection.
Style
Table addColumns(insertLocation: Word.InsertLocation.start | Word.InsertLocation.end | "Start" | "End", columnCount: number, values?: string[][]) Adds columns to the start or end of the table, using the first or last existing column as a template.
addRows(insertLocation: Word.InsertLocation.start | Word.InsertLocation.end | "Start" | "End", rowCount: number, values?: string[][]) Adds rows to the start or end of the table, using the first or last existing row as a template.
alignment Specifies the alignment of the table against the page column.
autoFitWindow() Autofits the table columns to the width of the window.
clear() Clears the contents of the table.
delete() Deletes the entire table.
deleteColumns(columnIndex: number, columnCount?: number) Deletes specific columns.
deleteRows(rowIndex: number, rowCount?: number) Deletes specific rows.
distributeColumns() Distributes the column widths evenly.
font Gets the font.
getBorder(borderLocation: Word.BorderLocation) Gets the border style for the specified border.
getCell(rowIndex: number, cellIndex: number) Gets the table cell at a specified row and column.
getCellOrNullObject(rowIndex: number, cellIndex: number) Gets the table cell at a specified row and column.
getCellPadding(cellPaddingLocation: Word.CellPaddingLocation) Gets cell padding in points.
getNext() Gets the next table.
getNextOrNullObject() Gets the next table.
getParagraphAfter() Gets the paragraph after the table.
getParagraphAfterOrNullObject() Gets the paragraph after the table.
getParagraphBefore() Gets the paragraph before the table.
getParagraphBeforeOrNullObject() Gets the paragraph before the table.
getRange(rangeLocation?: Word.RangeLocation.whole | Word.RangeLocation.start | Word.RangeLocation.end | Word.RangeLocation.after | "Whole" | "Start" | "End" | "After") Gets the range that contains this table, or the range at the start or end of the table.
headerRowCount Specifies the number of header rows.
horizontalAlignment Specifies the horizontal alignment of every cell in the table.
insertContentControl() Inserts a content control on the table.
insertParagraph(paragraphText: string, insertLocation: Word.InsertLocation.before | Word.InsertLocation.after | "Before" | "After") Inserts a paragraph at the specified location.
insertTable(rowCount: number, columnCount: number, insertLocation: Word.InsertLocation.before | Word.InsertLocation.after | "Before" | "After", values?: string[][]) Inserts a table with the specified number of rows and columns.
isUniform Indicates whether all of the table rows are uniform.
nestingLevel Gets the nesting level of the table.
parentBody Gets the parent body of the table.
parentContentControl Gets the content control that contains the table.
parentContentControlOrNullObject Gets the content control that contains the table.
parentTable Gets the table that contains this table.
parentTableCell Gets the table cell that contains this table.
parentTableCellOrNullObject Gets the table cell that contains this table.
parentTableOrNullObject Gets the table that contains this table.
rowCount Gets the number of rows in the table.
rows Gets all of the table rows.
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 table object.
select(selectionMode?: Word.SelectionMode) Selects the table, or the position at the start or end of the table, and navigates the Word UI to it.
setCellPadding(cellPaddingLocation: Word.CellPaddingLocation, cellPadding: number) Sets cell padding in points.
shadingColor Specifies the shading color.
style Specifies the style name for the table.
styleBandedColumns Specifies whether the table has banded columns.
styleBandedRows Specifies whether the table has banded rows.
styleBuiltIn Specifies the built-in style name for the table.
styleFirstColumn Specifies whether the table has a first column with a special style.
styleLastColumn Specifies whether the table has a last column with a special style.
styleTotalRow Specifies whether the table has a total (last) row with a special style.
tables Gets the child tables nested one level deeper.
values Specifies the text values in the table, as a 2D JavaScript array.
verticalAlignment Specifies the vertical alignment of every cell in the table.
width Specifies the width of the table in points.
TableBorder color Specifies the table border color.
type Specifies the type of the table border.
width Specifies the width, in points, of the table border.
TableCell body Gets the body object of the cell.
cellIndex Gets the index of the cell in its row.
columnWidth Specifies the width of the cell's column in points.
deleteColumn() Deletes the column containing this cell.
deleteRow() Deletes the row containing this cell.
getBorder(borderLocation: Word.BorderLocation) Gets the border style for the specified border.
getCellPadding(cellPaddingLocation: Word.CellPaddingLocation) Gets cell padding in points.
getNext() Gets the next cell.
getNextOrNullObject() Gets the next cell.
horizontalAlignment Specifies the horizontal alignment of the cell.
insertColumns(insertLocation: Word.InsertLocation.before | Word.InsertLocation.after | "Before" | "After", columnCount: number, values?: string[][]) Adds columns to the left or right of the cell, using the cell's column as a template.
insertRows(insertLocation: Word.InsertLocation.before | Word.InsertLocation.after | "Before" | "After", rowCount: number, values?: string[][]) Inserts rows above or below the cell, using the cell's row as a template.
parentRow Gets the parent row of the cell.
parentTable Gets the parent table of the cell.
rowIndex Gets the index of the cell's row in the table.
setCellPadding(cellPaddingLocation: Word.CellPaddingLocation, cellPadding: number) Sets cell padding in points.
shadingColor Specifies the shading color of the cell.
value Specifies the text of the cell.
verticalAlignment Specifies the vertical alignment of the cell.
width Gets the width of the cell in points.
TableCellCollection getFirst() Gets the first table cell in this collection.
getFirstOrNullObject() Gets the first table cell in this collection.
items Gets the loaded child items in this collection.
TableCollection getFirst() Gets the first table in this collection.
getFirstOrNullObject() Gets the first table in this collection.
items Gets the loaded child items in this collection.
TableRow cellCount Gets the number of cells in the row.
cells Gets cells.
clear() Clears the contents of the row.
delete() Deletes the entire row.
font Gets the font.
getBorder(borderLocation: Word.BorderLocation) Gets the border style of the cells in the row.
getCellPadding(cellPaddingLocation: Word.CellPaddingLocation) Gets cell padding in points.
getNext() Gets the next row.
getNextOrNullObject() Gets the next row.
horizontalAlignment Specifies the horizontal alignment of every cell in the row.
insertRows(insertLocation: Word.InsertLocation.before | Word.InsertLocation.after | "Before" | "After", rowCount: number, values?: string[][]) Inserts rows using this row as a template.
isHeader Checks whether the row is a header row.
parentTable Gets parent table.
preferredHeight Specifies the preferred height of the row in points.
rowIndex Gets the index of the row in its parent table.
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 row.
select(selectionMode?: Word.SelectionMode) Selects the row and navigates the Word UI to it.
setCellPadding(cellPaddingLocation: Word.CellPaddingLocation, cellPadding: number) Sets cell padding in points.
shadingColor Specifies the shading color.
values Specifies the text values in the row, as a 2D JavaScript array.
verticalAlignment Specifies the vertical alignment of the cells in the row.
TableRowCollection getFirst() Gets the first row in this collection.
getFirstOrNullObject() Gets the first row in this collection.
items Gets the loaded child items in this collection.

See also