Edit

Share via


Word JavaScript API desktop-only requirement set 1.1

The WordApiDesktop requirement set is a special requirement set that includes features that are only available for Word on Windows, on Mac, and on iPad. APIs in this requirement set are considered to be production APIs for the Word application on Windows, on Mac, and on iPad. They follow Microsoft 365 developer support policies. WordApiDesktop APIs are considered to be "preview" APIs for other platforms (web) and may not be supported by any of those platforms.

When APIs in the WordApiDesktop requirement set are supported across all platforms, they'll be added to the next released requirement set (WordApi 1.[NEXT]). Once that new requirement set is public, those APIs will also continue to be tagged in this WordApiDesktop requirement set. To learn more about platform-specific requirements in general, see Understanding platform-specific requirement sets.

Important

WordApiDesktop 1.1 is a desktop-only requirement set. It's a superset of the WordApi 1.8.

Because the WordApiDesktop 1.1 APIs are only supported by Word on Windows, on Mac, and on iPad, your add-in should check if the requirement set is supported before calling these APIs. This avoids any attempt to use desktop-only APIs on an unsupported platform.

if (Office.context.requirements.isSetSupported("WordApiDesktop", "1.1")) {
   // Any API exclusive to this WordApiDesktop requirement set.
}

Once the API is in a cross-platform requirement set, you should remove or edit the isSetSupported check. This will enable your add-in's feature on other platforms. Be sure to test the feature on those platforms when making this change.

Important

Your manifest cannot specify WordApiDesktop 1.1 as an activation requirement. It isn't a valid value to use in the Set element.

API list

The following table lists the Word JavaScript APIs currently included in the WordApiDesktop 1.1 requirement set. For a complete list of all Word JavaScript APIs (including WordApiDesktop 1.1 APIs and previously released APIs), see all Word JavaScript APIs.

Class Fields Description
Border color Specifies the color for the border.
location Gets the location of the border.
type Specifies the border type for the border.
visible Specifies whether the border is visible.
width Specifies the width for the border.
BorderCollection getByLocation(borderLocation: Word.BorderLocation.top | Word.BorderLocation.left | Word.BorderLocation.bottom | Word.BorderLocation.right | Word.BorderLocation.insideHorizontal | Word.BorderLocation.insideVertical | "Top" | "Left" | "Bottom" | "Right" | "InsideHorizontal" | "InsideVertical") Gets the border that has the specified location.
getFirst() Gets the first border in this collection.
getFirstOrNullObject() Gets the first border in this collection.
getItem(index: number) Gets a Border object by its index in the collection.
insideBorderColor Specifies the 24-bit color of the inside borders.
insideBorderType Specifies the border type of the inside borders.
insideBorderWidth Specifies the width of the inside borders.
items Gets the loaded child items in this collection.
outsideBorderColor Specifies the 24-bit color of the outside borders.
outsideBorderType Specifies the border type of the outside borders.
outsideBorderWidth Specifies the width of the outside borders.
Document compare(filePath: string, documentCompareOptions?: Word.DocumentCompareOptions) Displays revision marks that indicate where the specified document differs from another document.
importStylesFromJson(stylesJson: string, importedStylesConflictBehavior?: Word.ImportedStylesConflictBehavior) Import styles from a JSON-formatted string.
DocumentCompareOptions addToRecentFiles If provided, specifies whether to add the document to the list of recently used files on the File menu.
authorName If provided, specifies the reviewer name associated with the differences generated by the comparison.
compareTarget If provided, specifies the target document for the comparison.
detectFormatChanges If provided, specifies whether the comparison should include detection of format changes.
ignoreAllComparisonWarnings If provided, specifies whether to compare the documents without notifying a user of problems.
removeDateAndTime If provided, specifies whether to remove date and time stamp information from tracked changes in the returned Document object.
removePersonalInformation If provided, specifies whether to remove all user information from comments, revisions, and the properties dialog box in the returned Document object.
Field showCodes Specifies whether the field codes are displayed for the specified field.
InlinePicture imageFormat Gets the format of the inline image.
List getLevelFont(level: number) Gets the font of the bullet, number, or picture at the specified level in the list.
getLevelPicture(level: number) Gets the Base64-encoded string representation of the picture at the specified level in the list.
resetLevelFont(level: number, resetFontName?: boolean) Resets the font of the bullet, number, or picture at the specified level in the list.
setLevelPicture(level: number, base64EncodedImage?: string) Sets the picture at the specified level in the list.
ListLevel alignment Specifies the horizontal alignment of the list level.
font Gets a Font object that represents the character formatting of the ListLevel object.
linkedStyle Specifies the name of the style that's linked to the ListLevel object.
numberFormat Specifies the number format for the list level.
numberPosition Specifies the position (in points) of the number or bullet for the ListLevel object.
numberStyle Specifies the number style for the ListLevel object.
resetOnHigher Specifies the list level that must appear before it restarts numbering at 1.
startAt Specifies the starting number for the ListLevel object.
tabPosition Specifies the tab position for the ListLevel object.
textPosition Specifies the position (in points) for the second line of wrapping text for the ListLevel object.
trailingCharacter Specifies the character inserted after the number for the list level.
ListLevelCollection getFirst() Gets the first list level in this collection.
getFirstOrNullObject() Gets the first list level in this collection.
items Gets the loaded child items in this collection.
ListTemplate listLevels Gets a ListLevelCollection object that represents all the levels for the list template.
outlineNumbered Specifies whether the list template is outline numbered.
Shading foregroundPatternColor Specifies the color for the foreground of the object.
texture Specifies the shading texture of the object.
Style borders Specifies a BorderCollection object that represents all the borders for the style.
listTemplate Gets a ListTemplate object that represents the list formatting for the style.
TableRow insertContentControl() Inserts a content control on the row.
TableStyle alignment Specifies the table's alignment against the page margin.
allowBreakAcrossPage Specifies whether lines in tables formatted with a style break across pages.

See also