Editar

Compartilhar 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 will be added to the next released requirement set (WordApi 1.[NEXT]). Once that new requirement set is public, those APIs will also be continue to be tagged in this WordApiDesktop requirement set.

Important

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

Because WordApiDesktop 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 the 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.
DocumentCompareOptions addToRecentFiles True adds the document to the list of recently used files on the File menu.
authorName The reviewer name associated with the differences generated by the comparison.
compareTarget The target document for the comparison.
detectFormatChanges True (default) for the comparison to include detection of format changes.
ignoreAllComparisonWarnings True compares the documents without notifying a user of problems.
removeDateAndTime True removes date and time stamp information from tracked changes in the returned Document object.
removePersonalInformation True removes 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 specified object.
linkedStyle Specifies the name of the style that's linked to the specified list level object.
numberFormat Specifies the number format for the specified list level.
numberPosition Specifies the position (in points) of the number or bullet for the specified list level object.
numberStyle Specifies the number style for the list level object.
resetOnHigher Specifies the list level that must appear before the specified list level restarts numbering at 1.
startAt Specifies the starting number for the specified list level object.
tabPosition Specifies the tab position for the specified list level object.
textPosition Specifies the position (in points) for the second line of wrapping text for the specified list level object.
trailingCharacter Specifies the character inserted after the number for the specified 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 ListLevels collection that represents all the levels for the specified ListTemplate.
outlineNumbered Specifies whether the specified ListTemplate object 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 specified style.
listTemplate Gets a ListTemplate object that represents the list formatting for the specified Style object.
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 specified style break across pages.

See also