Edit

Share via


Word JavaScript preview APIs

New Word JavaScript APIs are first introduced in "preview" and later become part of a specific, numbered requirement set after sufficient testing occurs and user feedback is acquired.

Important

Note that the following Word preview APIs may be available on the following platforms.

  • Word on Windows
  • Word on Mac

Word preview APIs are currently not supported on iPad. However, several APIs may also be available in Word on the web. For APIs available only in Word on the web, see the Web-only API list.

Note

Preview APIs are subject to change and are not intended for use in a production environment. We recommend that you try them out in test and development environments only. Do not use preview APIs in a production environment or within business-critical documents.

To use preview APIs:

API list

The following table lists the Word JavaScript APIs currently in preview, except those that are available only in Word on the web. To see a complete list of all Word JavaScript APIs (including preview APIs and previously released APIs), see all Word JavaScript APIs.

Class Fields Description
Application bibliography Returns a Bibliography object that represents the bibliography reference sources stored in Microsoft Word.
checkLanguage Specifies if Microsoft Word automatically detects the language you are using as you type.
language Gets a LanguageId value that represents the language selected for the Microsoft Word user interface.
templates Returns a TemplateCollection object that represents all the available templates: global templates and those attached to open documents.
Bibliography bibliographyStyle Specifies the name of the active style to use for the bibliography.
generateUniqueTag() Generates a unique identification tag for a bibliography source and returns a string that represents the tag.
sources Returns a SourceCollection object that represents all the sources contained in the bibliography.
BorderUniversal artStyle Specifies the graphical page-border design for the document.
artWidth Specifies the width (in points) of the graphical page border specified in the artStyle property.
color Specifies the color for the BorderUniversal object.
colorIndex Specifies the color for the BorderUniversal or Word.Font object.
inside Returns true if an inside border can be applied to the specified object.
isVisible Specifies whether the border is visible.
lineStyle Specifies the line style of the border.
lineWidth Specifies the line width of an object's border.
BorderUniversalCollection applyPageBordersToAllSections() Applies the specified page-border formatting to all sections in the document.
getItem(index: number) Gets a Border object by its index in the collection.
items Gets the loaded child items in this collection.
Break pageIndex Returns the page number on which the break occurs.
range Returns a Range object that represents the portion of the document that's contained in the break.
BreakCollection items Gets the loaded child items in this collection.
BuildingBlock category Returns a BuildingBlockCategory object that represents the category for the building block.
delete() Deletes the building block.
description Specifies the description for the building block.
id Returns the internal identification number for the building block.
index Returns the position of this building block in a collection.
insert(range: Word.Range, richText: boolean) Inserts the value of the building block into the document and returns a Range object that represents the contents of the building block within the document.
insertType Specifies a DocPartInsertType value that represents how to insert the contents of the building block into the document.
name Specifies the name of the building block.
type Returns a BuildingBlockTypeItem object that represents the type for the building block.
value Specifies the contents of the building block.
BuildingBlockCategory buildingBlocks Returns a BuildingBlockCollection object that represents the building blocks for the category.
index Returns the position of the BuildingBlockCategory object in a collection.
name Returns the name of the BuildingBlockCategory object.
type Returns a BuildingBlockTypeItem object that represents the type of building block for the building block category.
BuildingBlockCategoryCollection getCount() Returns the number of items in the collection.
getItemAt(index: number) Returns a BuildingBlockCategory object that represents the specified item in the collection.
BuildingBlockCollection add(name: string, range: Word.Range, description: string, insertType: Word.DocPartInsertType) Creates a new building block and returns a BuildingBlock object.
getCount() Returns the number of items in the collection.
getItemAt(index: number) Returns a BuildingBlock object that represents the specified item in the collection.
BuildingBlockEntryCollection add(name: string, type: Word.BuildingBlockType, category: string, range: Word.Range, description: string, insertType: Word.DocPartInsertType) Creates a new building block entry in a template and returns a BuildingBlock object that represents the new building block entry.
getCount() Returns the number of items in the collection.
getItemAt(index: number) Returns a BuildingBlock object that represents the specified item in the collection.
BuildingBlockGalleryContentControl appearance Specifies the appearance of the content control.
buildingBlockCategory Specifies the category for the building block content control.
buildingBlockType Specifies a BuildingBlockType value that represents the type of building block for the building block content control.
color Specifies the red-green-blue (RGB) value of the color of the content control.
copy() Copies the content control from the active document to the Clipboard.
cut() Removes the content control from the active document and moves the content control to the Clipboard.
delete(deleteContents?: boolean) Deletes the content control and optionally its contents.
id Gets the identification for the content control.
isTemporary Specifies whether to remove the content control from the active document when the user edits the contents of the control.
level Gets the level of the content control—whether the content control surrounds text, paragraphs, table cells, or table rows; or if it is inline.
lockContentControl Specifies if the content control is locked (can't be deleted).
lockContents Specifies if the contents of the content control are locked (not editable).
placeholderText Returns a BuildingBlock object that represents the placeholder text for the content control.
range Returns a Range object that represents the contents of the content control in the active document.
setPlaceholderText(options?: Word.ContentControlPlaceholderOptions) Sets the placeholder text that displays in the content control until a user enters their own text.
showingPlaceholderText Gets if the placeholder text for the content control is being displayed.
tag Specifies a tag to identify the content control.
title Specifies the title for the content control.
xmlMapping Returns an XmlMapping object that represents the mapping of the content control to XML data in the data store of the document.
BuildingBlockTypeItem categories Returns a BuildingBlockCategoryCollection object that represents the categories for a building block type.
index Returns the position of an item in a collection.
name Returns the localized name of a building block type.
BuildingBlockTypeItemCollection getByType(type: Word.BuildingBlockType) Gets a BuildingBlockTypeItem object by its type in the collection.
getCount() Returns the number of items in the collection.
ColorFormat brightness Specifies the brightness of a specified shape color.
objectThemeColor Specifies the theme color for a color format.
rgb Specifies the red-green-blue (RGB) value of the specified color.
tintAndShade Specifies the lightening or darkening of a specified shape's color.
type Returns the shape color type.
ContentControl buildingBlockGalleryContentControl Gets the building block gallery-related data if the content control's Word.ContentControlType is BuildingBlockGallery.
datePickerContentControl Gets the date picker-related data if the content control's Word.ContentControlType is DatePicker.
groupContentControl Gets the group-related data if the content control's Word.ContentControlType is Group.
pictureContentControl Gets the picture-related data if the content control's Word.ContentControlType is Picture.
repeatingSectionContentControl Gets the repeating section-related data if the content control's Word.ContentControlType is RepeatingSection.
resetState() Resets the state of the content control.
setState(contentControlState: Word.ContentControlState) Sets the state of the content control.
xmlMapping Returns an XmlMapping object that represents the mapping of the content control to XML data in the data store of the document.
ContentControlAddedEventArgs eventType The event type.
ContentControlDataChangedEventArgs eventType The event type.
ContentControlDeletedEventArgs eventType The event type.
ContentControlEnteredEventArgs eventType The event type.
ContentControlExitedEventArgs eventType The event type.
ContentControlPlaceholderOptions buildingBlock If provided, specifies the BuildingBlock object to use as placeholder.
range If provided, specifies the Range object to use as placeholder.
text If provided, specifies the text to use as placeholder.
ContentControlSelectionChangedEventArgs eventType The event type.
CustomXmlAddNodeOptions name If provided, specifies the base name of the element to be added.
namespaceUri If provided, specifies the namespace of the element to be appended.
nextSibling If provided, specifies the node which should become the next sibling of the new node.
nodeType If provided, specifies the type of node to add.
nodeValue If provided, specifies the value of the added node for those nodes that allow text.
CustomXmlAddSchemaOptions alias If provided, specifies the alias of the schema to be added to the collection.
fileName If provided, specifies the location of the schema on a disk.
installForAllUsers If provided, specifies whether, in the case where the schema is being added to the Schema Library, the Schema Library keys should be written to the registry (HKEY_LOCAL_MACHINE for all users or HKEY_CURRENT_USER for just the current user).
namespaceUri If provided, specifies the namespace of the schema to be added to the collection.
CustomXmlAddValidationErrorOptions clearedOnUpdate If provided, specifies whether the error is to be cleared from the Word.CustomXmlValidationErrorCollection when the XML is corrected and updated.
errorText If provided, specifies the descriptive error text.
CustomXmlAppendChildNodeOptions name If provided, specifies the base name of the element to be appended.
namespaceUri If provided, specifies the namespace of the element to be appended.
nodeType If provided, specifies the type of node to append.
nodeValue If provided, specifies the value of the appended node for those nodes that allow text.
CustomXmlInsertNodeBeforeOptions name If provided, specifies the base name of the element to be inserted.
namespaceUri If provided, specifies the namespace of the element to be inserted.
nextSibling If provided, specifies the context node.
nodeType If provided, specifies the type of node to append.
nodeValue If provided, specifies the value of the inserted node for those nodes that allow text.
CustomXmlInsertSubtreeBeforeOptions nextSibling If provided, specifies the context node.
CustomXmlNode appendChildNode(options?: Word.CustomXmlAppendChildNodeOptions) Appends a single node as the last child under the context element node in the tree.
appendChildSubtree(xml: string) Adds a subtree as the last child under the context element node in the tree.
attributes Gets a CustomXmlNodeCollection object representing the attributes of the current element in the current node.
baseName Gets the base name of the node without the namespace prefix, if one exists.
childNodes Gets a CustomXmlNodeCollection object containing all of the child elements of the current node.
delete() Deletes the current node from the tree (including all of its children, if any exist).
firstChild Gets a CustomXmlNode object corresponding to the first child element of the current node.
hasChildNodes() Specifies if the current element node has child element nodes.
insertNodeBefore(options?: Word.CustomXmlInsertNodeBeforeOptions) Inserts a new node just before the context node in the tree.
insertSubtreeBefore(xml: string, options?: Word.CustomXmlInsertSubtreeBeforeOptions) Inserts the specified subtree into the location just before the context node.
lastChild Gets a CustomXmlNode object corresponding to the last child element of the current node.
namespaceUri Gets the unique address identifier for the namespace of the node.
nextSibling Gets the next sibling node (element, comment, or processing instruction) of the current node.
nodeType Gets the type of the current node.
nodeValue Specifies the value of the current node.
ownerPart Gets the object representing the part associated with this node.
parentNode Gets the parent element node of the current node.
previousSibling Gets the previous sibling node (element, comment, or processing instruction) of the current node.
removeChild(child: Word.CustomXmlNode) Removes the specified child node from the tree.
replaceChildNode(oldNode: Word.CustomXmlNode, options?: Word.CustomXmlReplaceChildNodeOptions) Removes the specified child node and replaces it with a different node in the same location.
replaceChildSubtree(xml: string, oldNode: Word.CustomXmlNode) Removes the specified node and replaces it with a different subtree in the same location.
selectNodes(xPath: string) Selects a collection of nodes matching an XPath expression.
selectSingleNode(xPath: string) Selects a single node from a collection matching an XPath expression.
text Specifies the text for the current node.
xml Gets the XML representation of the current node and its children.
xpath Gets a string with the canonicalized XPath for the current node.
CustomXmlNodeCollection getCount() Returns the number of items in the collection.
getItem(index: number) Returns a CustomXmlNode object that represents the specified item in the collection.
items Gets the loaded child items in this collection.
CustomXmlPart addNode(parent: Word.CustomXmlNode, options?: Word.CustomXmlAddNodeOptions) Adds a node to the XML tree.
builtIn Gets a value that indicates whether the CustomXmlPart is built-in.
documentElement Gets the root element of a bound region of data in the document.
errors Gets a CustomXmlValidationErrorCollection object that provides access to any XML validation errors.
loadXml(xml: string) Populates the CustomXmlPart object from an XML string.
namespaceManager Gets the set of namespace prefix mappings used against the current CustomXmlPart object.
schemaCollection Specifies a CustomXmlSchemaCollection object representing the set of schemas attached to a bound region of data in the document.
selectNodes(xPath: string) Selects a collection of nodes from a custom XML part.
selectSingleNode(xPath: string) Selects a single node within a custom XML part matching an XPath expression.
xml Gets the XML representation of the current CustomXmlPart object.
CustomXmlPrefixMapping namespaceUri Gets the unique address identifier for the namespace of the CustomXmlPrefixMapping object.
prefix Gets the prefix for the CustomXmlPrefixMapping object.
CustomXmlPrefixMappingCollection addNamespace(prefix: string, namespaceUri: string) Adds a custom namespace/prefix mapping to use when querying an item.
getCount() Returns the number of items in the collection.
getItem(index: number) Returns a CustomXmlPrefixMapping object that represents the specified item in the collection.
items Gets the loaded child items in this collection.
lookupNamespace(prefix: string) Gets the namespace corresponding to the specified prefix.
lookupPrefix(namespaceUri: string) Gets the prefix corresponding to the specified namespace.
CustomXmlReplaceChildNodeOptions name If provided, specifies the base name of the replacement element.
namespaceUri If provided, specifies the namespace of the replacement element.
nodeType If provided, specifies the type of the replacement node.
nodeValue If provided, specifies the value of the replacement node for those nodes that allow text.
CustomXmlSchema delete() Deletes this schema from the Word.CustomXmlSchemaCollection object.
location Gets the location of the schema on a computer.
namespaceUri Gets the unique address identifier for the namespace of the CustomXmlSchema object.
reload() Reloads the schema from a file.
CustomXmlSchemaCollection add(options?: Word.CustomXmlAddSchemaOptions) Adds one or more schemas to the schema collection that can then be added to a stream in the data store and to the schema library.
addCollection(schemaCollection: Word.CustomXmlSchemaCollection) Adds an existing schema collection to the current schema collection.
getCount() Returns the number of items in the collection.
getItem(index: number) Returns a CustomXmlSchema object that represents the specified item in the collection.
getNamespaceUri() Returns the number of items in the collection.
items Gets the loaded child items in this collection.
validate() Specifies whether the schemas in the schema collection are valid (conforms to the syntactic rules of XML and the rules for a specified vocabulary).
CustomXmlValidationError delete() Deletes this CustomXmlValidationError object.
errorCode Gets an integer representing the validation error in the CustomXmlValidationError object.
name Gets the name of the error in the CustomXmlValidationError object.If no errors exist, the property returns Nothing
node Gets the node associated with this CustomXmlValidationError object, if any exist.If no nodes exist, the property returns Nothing.
text Gets the text in the CustomXmlValidationError object.
type Gets the type of error generated from the CustomXmlValidationError object.
CustomXmlValidationErrorCollection add(node: Word.CustomXmlNode, errorName: string, options?: Word.CustomXmlAddValidationErrorOptions) Adds a CustomXmlValidationError object containing an XML validation error to the CustomXmlValidationErrorCollection object.
getCount() Returns the number of items in the collection.
getItem(index: number) Returns a CustomXmlValidationError object that represents the specified item in the collection.
items Gets the loaded child items in this collection.
DatePickerContentControl appearance Specifies the appearance of the content control.
color Specifies the red-green-blue (RGB) value of the color of the content control.
copy() Copies the content control from the active document to the Clipboard.
cut() Removes the content control from the active document and moves the content control to the Clipboard.
dateCalendarType Specifies a CalendarType value that represents the calendar type for the date picker content control.
dateDisplayFormat Specifies the format in which dates are displayed.
dateDisplayLocale Specifies a LanguageId that represents the language format for the date displayed in the date picker content control.
dateStorageFormat Specifies a ContentControlDateStorageFormat value that represents the format for storage and retrieval of dates when the date picker content control is bound to the XML data store of the active document.
delete(deleteContents?: boolean) Deletes this content control and the contents of the content control.
id Gets the identification for the content control.
isTemporary Specifies whether to remove the content control from the active document when the user edits the contents of the control.
level Specifies the level of the content control—whether the content control surrounds text, paragraphs, table cells, or table rows; or if it is inline.
lockContentControl Specifies if the content control is locked (can't be deleted).
lockContents Specifies if the contents of the content control are locked (not editable).
placeholderText Returns a BuildingBlock object that represents the placeholder text for the content control.
range Gets a Range object that represents the contents of the content control in the active document.
setPlaceholderText(options?: Word.ContentControlPlaceholderOptions) Sets the placeholder text that displays in the content control until a user enters their own text.
showingPlaceholderText Gets whether the placeholder text for the content control is being displayed.
tag Specifies a tag to identify the content control.
title Specifies the title for the content control.
xmlMapping Gets an XmlMapping object that represents the mapping of the content control to XML data in the data store of the document.
Document attachedTemplate Specifies a Template object that represents the template attached to the document.
autoHyphenation Specifies if automatic hyphenation is turned on for the document.
autoSaveOn Specifies if the edits in the document are automatically saved.
bibliography Returns a Bibliography object that represents the bibliography references contained within the document.
consecutiveHyphensLimit Specifies the maximum number of consecutive lines that can end with hyphens.
detectLanguage() Analyzes the document text to determine the language.
documentLibraryVersions Returns a DocumentLibraryVersionCollection object that represents the collection of versions of a shared document that has versioning enabled and that's stored in a document library on a server.
frames Returns a FrameCollection object that represents all the frames in the document.
hyperlinks Returns a HyperlinkCollection object that represents all the hyperlinks in the document.
hyphenateCaps Specifies whether words in all capital letters can be hyphenated.
languageDetected Specifies whether Microsoft Word has detected the language of the document text.
manualHyphenation() Initiates manual hyphenation of a document, one line at a time.
pageSetup Returns a PageSetup object that's associated with the document.
DocumentLibraryVersion comments Gets any optional comments associated with this version of the shared document.
modified Gets the date and time at which this version of the shared document was last saved to the server.
modifiedBy Gets the name of the user who last saved this version of the shared document to the server.
DocumentLibraryVersionCollection getItem(index: number) Gets a DocumentLibraryVersion object by its index in the collection.
isVersioningEnabled() Returns whether the document library in which the active document is saved on the server is configured to create a backup copy, or version, each time the file is edited on the website.
items Gets the loaded child items in this collection.
FillFormat backgroundColor Returns a ColorFormat object that represents the background color for the fill.
foregroundColor Returns a ColorFormat object that represents the foreground color for the fill.
gradientAngle Specifies the angle of the gradient fill.
gradientColorType Gets the gradient color type.
gradientDegree Returns how dark or light a one-color gradient fill is.
gradientStyle Returns the gradient style for the fill.
gradientVariant Returns the gradient variant for the fill as an integer value from 1 to 4 for most gradient fills.
isVisible Specifies if the object, or the formatting applied to it, is visible.
pattern Returns a PatternType value that represents the pattern applied to the fill or line.
presetGradientType Returns the preset gradient type for the fill.
presetTexture Gets the preset texture.
rotateWithObject Specifies whether the fill rotates with the shape.
setOneColorGradient(style: Word.GradientStyle, variant: number, degree: number) Sets the fill to a one-color gradient.
setPatterned(pattern: Word.PatternType) Sets the fill to a pattern.
setPresetGradient(style: Word.GradientStyle, variant: number, presetGradientType: Word.PresetGradientType) Sets the fill to a preset gradient.
setPresetTextured(presetTexture: Word.PresetTexture) Sets the fill to a preset texture.
setTwoColorGradient(style: Word.GradientStyle, variant: number) Sets the fill to a two-color gradient.
solid() Sets the fill to a uniform color.
textureAlignment Specifies the alignment (the origin of the coordinate grid) for the tiling of the texture fill.
textureHorizontalScale Specifies the horizontal scaling factor for the texture fill.
textureName Returns the name of the custom texture file for the fill.
textureOffsetX Specifies the horizontal offset of the texture from the origin in points.
textureOffsetY Specifies the vertical offset of the texture.
textureTile Specifies whether the texture is tiled.
textureType Returns the texture type for the fill.
textureVerticalScale Specifies the vertical scaling factor for the texture fill as a value between 0.0 and 1.0.
transparency Specifies the degree of transparency of the fill for a shape as a value between 0.0 (opaque) and 1.0 (clear).
type Gets the fill format type.
Font allCaps Specifies whether the font is formatted as all capital letters, which makes lowercase letters appear as uppercase letters.
boldBidirectional Specifies whether the font is formatted as bold in a right-to-left language document.
borders Returns a BorderUniversalCollection object that represents all the borders for the font.
colorIndex Specifies a ColorIndex value that represents the color for the font.
colorIndexBidirectional Specifies the color for the Font object in a right-to-left language document.
contextualAlternates Specifies whether contextual alternates are enabled for the font.
decreaseFontSize() Decreases the font size to the next available size.
diacriticColor Specifies the color to be used for diacritics for the Font object.
disableCharacterSpaceGrid Specifies whether Microsoft Word ignores the number of characters per line for the corresponding Font object.
emboss Specifies whether the font is formatted as embossed.
emphasisMark Specifies an EmphasisMark value that represents the emphasis mark for a character or designated character string.
engrave Specifies whether the font is formatted as engraved.
fill Returns a FillFormat object that contains fill formatting properties for the font used by the range of text.
glow Returns a GlowFormat object that represents the glow formatting for the font used by the range of text.
increaseFontSize() Increases the font size to the next available size.
italicBidirectional Specifies whether the font is italicized in a right-to-left language document.
kerning Specifies the minimum font size for which Microsoft Word will adjust kerning automatically.
ligature Specifies the ligature setting for the Font object.
line Returns a LineFormat object that specifies the formatting for a line.
nameAscii Specifies the font used for Latin text (characters with character codes from 0 (zero) through 127).
nameBidirectional Specifies the font name in a right-to-left language document.
nameFarEast Specifies the East Asian font name.
nameOther Specifies the font used for characters with codes from 128 through 255.
numberForm Specifies the number form setting for an OpenType font.
numberSpacing Specifies the number spacing setting for the font.
outline Specifies if the font is formatted as outlined.
position Specifies the position of text (in points) relative to the base line.
reflection Returns a ReflectionFormat object that represents the reflection formatting for a shape.
reset() Removes manual character formatting.
scaling Specifies the scaling percentage applied to the font.
setAsTemplateDefault() Sets the specified font formatting as the default for the active document and all new documents based on the active template.
shadow Specifies if the font is formatted as shadowed.
sizeBidirectional Specifies the font size in points for right-to-left text.
smallCaps Specifies whether the font is formatted as small caps, which makes lowercase letters appear as small uppercase letters.
spacing Specifies the spacing between characters.
stylisticSet Specifies the stylistic set for the font.
textColor Returns a ColorFormat object that represents the color for the font.
textShadow Returns a ShadowFormat object that specifies the shadow formatting for the font.
threeDimensionalFormat Returns a ThreeDimensionalFormat object that contains 3-dimensional (3D) effect formatting properties for the font.
underlineColor Specifies the color of the underline for the Font object.
Frame borders Returns a BorderUniversalCollection object that represents all the borders for the frame.
copy() Copies the frame to the Clipboard.
cut() Removes the frame from the document and places it on the Clipboard.
delete() Deletes the frame.
height Specifies the height (in points) of the frame.
heightRule Specifies a FrameSizeRule value that represents the rule for determining the height of the frame.
horizontalDistanceFromText Specifies the horizontal distance between the frame and the surrounding text, in points.
horizontalPosition Specifies the horizontal distance between the edge of the frame and the item specified by the relativeHorizontalPosition property.
lockAnchor Specifies if the frame is locked.
range Returns a Range object that represents the portion of the document that's contained within the frame.
relativeHorizontalPosition Specifies the relative horizontal position of the frame.
relativeVerticalPosition Specifies the relative vertical position of the frame.
select() Selects the frame.
shading Returns a ShadingUniversal object that refers to the shading formatting for the frame.
textWrap Specifies if document text wraps around the frame.
verticalDistanceFromText Specifies the vertical distance (in points) between the frame and the surrounding text.
verticalPosition Specifies the vertical distance between the edge of the frame and the item specified by the relativeVerticalPosition property.
width Specifies the width (in points) of the frame.
widthRule Specifies the rule used to determine the width of the frame.
FrameCollection add(range: Word.Range) Returns a Frame object that represents a new frame added to a range, selection, or document.
delete() Deletes the FrameCollection object.
getItem(index: number) Gets a Frame object by its index in the collection.
items Gets the loaded child items in this collection.
GlowFormat color Returns a ColorFormat object that represents the color for a glow effect.
radius Specifies the length of the radius for a glow effect.
transparency Specifies the degree of transparency for the glow effect as a value between 0.0 (opaque) and 1.0 (clear).
GroupContentControl appearance Specifies the appearance of the content control.
color Specifies the red-green-blue (RGB) value of the color of the content control.
copy() Copies the content control from the active document to the Clipboard.
cut() Removes the content control from the active document and moves the content control to the Clipboard.
delete(deleteContents: boolean) Deletes the content control and optionally its contents.
id Returns the identification for the content control.
isTemporary Specifies whether to remove the content control from the active document when the user edits the contents of the control.
level Gets the level of the content control—whether the content control surrounds text, paragraphs, table cells, or table rows; or if it is inline.
lockContentControl Specifies if the content control is locked (can't be deleted).
lockContents Specifies if the contents of the content control are locked (not editable).
placeholderText Returns a BuildingBlock object that represents the placeholder text for the content control.
range Gets a Range object that represents the contents of the content control in the active document.
setPlaceholderText(options?: Word.ContentControlPlaceholderOptions) Sets the placeholder text that displays in the content control until a user enters their own text.
showingPlaceholderText Returns whether the placeholder text for the content control is being displayed.
tag Specifies a tag to identify the content control.
title Specifies the title for the content control.
ungroup() Removes the group content control from the document so that its child content controls are no longer nested and can be freely edited.
xmlMapping Gets an XmlMapping object that represents the mapping of the content control to XML data in the data store of the document.
Hyperlink addToFavorites() Creates a shortcut to the document or hyperlink and adds it to the Favorites folder.
address Specifies the address (for example, a file name or URL) of the hyperlink.
createNewDocument(fileName: string, editNow: boolean, overwrite: boolean) Creates a new document linked to the hyperlink.
delete() Deletes the hyperlink.
emailSubject Specifies the text string for the hyperlink's subject line.
isExtraInfoRequired Returns true if extra information is required to resolve the hyperlink.
name Returns the name of the Hyperlink object.
range Returns a Range object that represents the portion of the document that's contained within the hyperlink.
screenTip Specifies the text that appears as a ScreenTip when the mouse pointer is positioned over the hyperlink.
subAddress Specifies a named location in the destination of the hyperlink.
target Specifies the name of the frame or window in which to load the hyperlink.
textToDisplay Specifies the hyperlink's visible text in the document.
type Returns the hyperlink type.
HyperlinkAddOptions address If provided, specifies the address (e.g., URL or file path) of the hyperlink.
screenTip If provided, specifies the text that appears as a tooltip.
subAddress If provided, specifies the location within the file or document.
target If provided, specifies the name of the frame or window in which to load the hyperlink.
textToDisplay If provided, specifies the visible text of the hyperlink.
HyperlinkCollection add(anchor: Word.Range, options?: Word.HyperlinkAddOptions) Returns a Hyperlink object that represents a new hyperlink added to a range, selection, or document.
items Gets the loaded child items in this collection.
LineFormat backgroundColor Gets a ColorFormat object that represents the background color for a patterned line.
beginArrowheadLength Specifies the length of the arrowhead at the beginning of the line.
beginArrowheadStyle Specifies the style of the arrowhead at the beginning of the line.
beginArrowheadWidth Specifies the width of the arrowhead at the beginning of the line.
dashStyle Specifies the dash style for the line.
endArrowheadLength Specifies the length of the arrowhead at the end of the line.
endArrowheadStyle Specifies the style of the arrowhead at the end of the line.
endArrowheadWidth Specifies the width of the arrowhead at the end of the line.
foregroundColor Gets a ColorFormat object that represents the foreground color for the line.
insetPen Specifies if to draw lines inside a shape.
isVisible Specifies if the object, or the formatting applied to it, is visible.
pattern Specifies the pattern applied to the line.
style Specifies the line format style.
transparency Specifies the degree of transparency of the line as a value between 0.0 (opaque) and 1.0 (clear).
weight Specifies the thickness of the line in points.
LineNumbering countBy Specifies the numeric increment for line numbers.
distanceFromText Specifies the distance (in points) between the right edge of line numbers and the left edge of the document text.
isActive Specifies if line numbering is active for the specified document, section, or sections.
restartMode Specifies the way line numbering runs; that is, whether it starts over at the beginning of a new page or section, or runs continuously.
startingNumber Specifies the starting line number.
ListFormat applyBulletDefault(defaultListBehavior: Word.DefaultListBehavior) Adds bullets and formatting to the paragraphs in the range.
applyListTemplateWithLevel(listTemplate: Word.ListTemplate, options?: Word.ListTemplateApplyOptions) Applies a list template with a specific level to the paragraphs in the range.
applyNumberDefault(defaultListBehavior: Word.DefaultListBehavior) Adds numbering and formatting to the paragraphs in the range.
applyOutlineNumberDefault(defaultListBehavior: Word.DefaultListBehavior) Adds outline numbering and formatting to the paragraphs in the range.
canContinuePreviousList(listTemplate: Word.ListTemplate) Determines whether the ListFormat object can continue a previous list.
convertNumbersToText(numberType: Word.NumberType) Converts numbers in the list to plain text.
countNumberedItems(options?: Word.ListFormatCountNumberedItemsOptions) Counts the numbered items in the list.
isSingleList Indicates whether the ListFormat object contains a single list.
isSingleListTemplate Indicates whether the ListFormat object contains a single list template.
list Returns a List object that represents the first formatted list contained in the ListFormat object.
listIndent() Indents the list by one level.
listLevelNumber Specifies the list level number for the first paragraph for the ListFormat object.
listOutdent() Outdents the list by one level.
listString Gets the string representation of the list value of the first paragraph in the range for the ListFormat object.
listTemplate Gets the list template associated with the ListFormat object.
listType Gets the type of the list for the ListFormat object.
listValue Gets the numeric value of the the first paragraph in the range for the ListFormat object.
removeNumbers(numberType: Word.NumberType) Removes numbering from the list.
ListFormatCountNumberedItemsOptions level If provided, specifies the level to count.
numberType If provided, specifies the type of number to count.
ListTemplateApplyOptions applyLevel If provided, specifies the level to apply in the list template.
applyTo If provided, specifies which part of the list to apply the template to.
continuePreviousList If provided, specifies whether to continue the previous list.
defaultListBehavior If provided, specifies the default list behavior.
Page breaks Gets a BreakCollection object that represents the breaks on the page.
PageSetup bookFoldPrinting Specifies whether Microsoft Word prints the document as a booklet.
bookFoldPrintingSheets Specifies the number of pages for each booklet.
bookFoldReversePrinting Specifies if Microsoft Word reverses the printing order for book fold printing of bidirectional or Asian language documents.
bottomMargin Specifies the distance (in points) between the bottom edge of the page and the bottom boundary of the body text.
charsLine Specifies the number of characters per line in the document grid.
differentFirstPageHeaderFooter Specifies whether the first page has a different header and footer.
footerDistance Specifies the distance between the footer and the bottom of the page in points.
gutter Specifies the amount (in points) of extra margin space added to each page in a document or section for binding.
gutterPosition Specifies on which side the gutter appears in a document.
gutterStyle Specifies whether Microsoft Word uses gutters for the current document based on a right-to-left language or a left-to-right language.
headerDistance Specifies the distance between the header and the top of the page in points.
layoutMode Specifies the layout mode for the current document.
leftMargin Specifies the distance (in points) between the left edge of the page and the left boundary of the body text.
lineNumbering Specifies a LineNumbering object that represents the line numbers for the PageSetup object.
linesPage Specifies the number of lines per page in the document grid.
mirrorMargins Specifies if the inside and outside margins of facing pages are the same width.
oddAndEvenPagesHeaderFooter Specifies whether odd and even pages have different headers and footers.
orientation Specifies the orientation of the page.
pageHeight Specifies the page height in points.
pageWidth Specifies the page width in points.
paperSize Specifies the paper size of the page.
rightMargin Specifies the distance (in points) between the right edge of the page and the right boundary of the body text.
sectionDirection Specifies the reading order and alignment for the specified sections.
sectionStart Specifies the type of section break for the specified object.
setAsTemplateDefault() Sets the specified page setup formatting as the default for the active document and all new documents based on the active template.
showGrid Specifies whether to show the grid.
suppressEndnotes Specifies if endnotes are printed at the end of the next section that doesn't suppress endnotes.
textColumns Gets a TextColumnCollection object that represents the set of text columns for the PageSetup object.
togglePortrait() Switches between portrait and landscape page orientations for a document or section.
topMargin Specifies the top margin of the page in points.
twoPagesOnOne Specifies whether to print two pages per sheet.
verticalAlignment Specifies the vertical alignment of text on each page in a document or section.
Paragraph borders Returns a BorderUniversalCollection object that represents all the borders for the paragraph.
shading Returns a ShadingUniversal object that refers to the shading formatting for the paragraph.
ParagraphAddedEventArgs type The event type.
ParagraphChangedEventArgs type The event type.
ParagraphDeletedEventArgs type The event type.
PictureContentControl appearance Specifies the appearance of the content control.
color Specifies the red-green-blue (RGB) value of the color of the content control.
copy() Copies the content control from the active document to the Clipboard.
cut() Removes the content control from the active document and moves the content control to the Clipboard.
delete(deleteContents?: boolean) Deletes the content control and optionally its contents.
id Returns the identification for the content control.
isTemporary Specifies whether to remove the content control from the active document when the user edits the contents of the control.
level Returns the level of the content control—whether the content control surrounds text, paragraphs, table cells, or table rows; or if it is inline.
lockContentControl Specifies if the content control is locked (can't be deleted).
lockContents Specifies if the contents of the content control are locked (not editable).
placeholderText Returns a BuildingBlock object that represents the placeholder text for the content control.
range Returns a Range object that represents the contents of the content control in the active document.
setPlaceholderText(options?: Word.ContentControlPlaceholderOptions) Sets the placeholder text that displays in the content control until a user enters their own text.
showingPlaceholderText Returns whether the placeholder text for the content control is being displayed.
tag Specifies a tag to identify the content control.
title Specifies the title for the content control.
xmlMapping Returns an XmlMapping object that represents the mapping of the content control to XML data in the data store of the document.
Range borders Returns a BorderUniversalCollection object that represents all the borders for the range.
detectLanguage() Analyzes the range text to determine the language that it's written in.
frames Gets a FrameCollection object that represents all the frames in the range.
hasNoProofing Specifies the proofing status (spelling and grammar checking) of the range.
hyperlinks Returns a HyperlinkCollection object that represents all the hyperlinks in the range.
languageDetected Specifies whether Microsoft Word has detected the language of the text in the range.
languageId Specifies a LanguageId value that represents the language for the range.
languageIdFarEast Specifies an East Asian language for the range.
languageIdOther Specifies a language for the range that isn't classified as an East Asian language.
listFormat Returns a ListFormat object that represents all the list formatting characteristics of the range.
sections Gets the collection of sections in the range.
shading Returns a ShadingUniversal object that refers to the shading formatting for the range.
tableColumns Gets a TableColumnCollection object that represents all the table columns in the range.
ReflectionFormat blur Specifies the degree of blur effect applied to the ReflectionFormat object as a value between 0.0 and 100.0.
offset Specifies the amount of separation, in points, of the reflected image from the shape.
size Specifies the size of the reflection as a percentage of the reflected shape from 0 to 100.
transparency Specifies the degree of transparency for the reflection effect as a value between 0.0 (opaque) and 1.0 (clear).
type Specifies a ReflectionType value that represents the type and direction of the lighting for a shape reflection.
RepeatingSectionContentControl allowInsertDeleteSection Specifies whether users can add or remove sections from this repeating section content control by using the user interface.
appearance Specifies the appearance of the content control.
color Specifies the red-green-blue (RGB) value of the color of the content control.
copy() Copies the content control from the active document to the Clipboard.
cut() Removes the content control from the active document and moves the content control to the Clipboard.
delete(deleteContents?: boolean) Deletes the content control and the contents of the content control.
id Returns the identification for the content control.
isTemporary Specifies whether to remove the content control from the active document when the user edits the contents of the control.
level Returns the level of the content control—whether the content control surrounds text, paragraphs, table cells, or table rows; or if it is inline.
lockContentControl Specifies if the content control is locked (can't be deleted).
lockContents Specifies if the contents of the content control are locked (not editable).
placeholderText Returns a BuildingBlock object that represents the placeholder text for the content control.
range Gets a Range object that represents the contents of the content control in the active document.
repeatingSectionItemTitle Specifies the name of the repeating section items used in the context menu associated with this repeating section content control.
repeatingSectionItems Returns the collection of repeating section items in this repeating section content control.
setPlaceholderText(options?: Word.ContentControlPlaceholderOptions) Sets the placeholder text that displays in the content control until a user enters their own text.
showingPlaceholderText Returns whether the placeholder text for the content control is being displayed.
tag Specifies a tag to identify the content control.
title Specifies the title for the content control.
xmlapping Returns an XmlMapping object that represents the mapping of the content control to XML data in the data store of the document.
RepeatingSectionItem delete() Deletes this RepeatingSectionItem object.
insertItemAfter() Adds a repeating section item after this item and returns the new item.
insertItemBefore() Adds a repeating section item before this item and returns the new item.
range Returns the range of this repeating section item, excluding the start and end tags.
RepeatingSectionItemCollection getItemAt(index: number) Returns an individual repeating section item.
Section borders Returns a BorderUniversalCollection object that represents all the borders in the section.
pageSetup Returns a PageSetup object that's associated with the section.
protectedForForms Specifies if the section is protected for forms.
ShadingUniversal backgroundPatternColor Specifies the color that's applied to the background of the ShadingUniversal object.
backgroundPatternColorIndex Specifies the color that's applied to the background of the ShadingUniversal object.
foregroundPatternColor Specifies the color that's applied to the foreground of the ShadingUniversal object.
foregroundPatternColorIndex Specifies the color that's applied to the foreground of the ShadingUniversal object.
texture Specifies the shading texture of the object.
ShadowFormat blur Specifies the blur level for a shadow format as a value between 0.0 and 100.0.
foregroundColor Returns a ColorFormat object that represents the foreground color for the fill, line, or shadow.
incrementOffsetX(increment: number) Changes the horizontal offset of the shadow by the number of points.
incrementOffsetY(increment: number) Changes the vertical offset of the shadow by the specified number of points.
isVisible Specifies whether the object or the formatting applied to it is visible.
obscured Specifies true if the shadow of the shape appears filled in and is obscured by the shape, even if the shape has no fill,
offsetX Specifies the horizontal offset (in points) of the shadow from the shape.
offsetY Specifies the vertical offset (in points) of the shadow from the shape.
rotateWithShape Specifies whether to rotate the shadow when rotating the shape.
size Specifies the width of the shadow.
style Specifies the type of shadow formatting to apply to a shape.
transparency Specifies the degree of transparency of the shadow as a value between 0.0 (opaque) and 1.0 (clear).
type Specifies the shape shadow type.
Source delete() Deletes the Source object.
getFieldByName(name: string) Returns the value of a field in the bibliography Source object.
isCited Gets if the Source object has been cited in the document.
tag Gets the tag of the source.
xml Gets the XML representation of the source.
SourceCollection add(xml: string) Adds a new Source object to the collection.
getItem(index: number) Gets a Source by its index in the collection.
items Gets the loaded child items in this collection.
Style automaticallyUpdate Specifies whether the style is automatically redefined based on the selection.
description Gets the description of the specified style.
frame Returns a Frame object that represents the frame formatting for the style.
hasProofing Specifies whether the spelling and grammar checker ignores text formatted with this style.
languageId Specifies a LanguageId value that represents the language for the style.
languageIdFarEast Specifies an East Asian language for the style.
linkStyle Specifies a link between a paragraph and a character style.
linkToListTemplate(listTemplate: Word.ListTemplate) Links this style to a list template so that the style's formatting can be applied to lists.
listLevelNumber Returns the list level for the style.
locked Specifies whether the style cannot be changed or edited.
noSpaceBetweenParagraphsOfSameStyle Specifies whether to remove spacing between paragraphs that are formatted using the same style.
TableColumn autoFit() Changes the width of the table column to accommodate the width of the text without changing the way text wraps in the cells.
borders Returns a BorderUniversalCollection object that represents all the borders for the table column.
columnIndex Returns the position of this column in a collection.
delete() Deletes the column.
isFirst Returns true if the column or row is the first one in the table; false otherwise.
isLast Returns true if the column or row is the last one in the table; false otherwise.
nestingLevel Returns the nesting level of the column.
preferredWidth Specifies the preferred width (in points or as a percentage of the window width) for the column.
preferredWidthType Specifies the preferred unit of measurement to use for the width of the table column.
select() Selects the table column.
setWidth(columnWidth: number, rulerStyle: Word.RulerStyle) Sets the width of the column in a table.
shading Returns a ShadingUniversal object that refers to the shading formatting for the column.
sort() Sorts the table column.
width Specifies the width of the column, in points.
TableColumnCollection add(beforeColumn?: Word.TableColumn) Returns a TableColumn object that represents a column added to a table.
autoFit() Changes the width of a table column to accommodate the width of the text without changing the way text wraps in the cells.
delete() Deletes the specified columns.
distributeWidth() Adjusts the width of the specified columns so that they are equal.
items Gets the loaded child items in this collection.
select() Selects the specified table columns.
setWidth(columnWidth: number, rulerStyle: Word.RulerStyle) Sets the width of columns in a table.
Template buildingBlockEntries Returns a BuildingBlockEntryCollection object that represents the collection of building block entries in the template.
buildingBlockTypes Returns a BuildingBlockTypeItemCollection object that represents the collection of building block types that are contained in the template.
farEastLineBreakLanguage Specifies the East Asian language to use when breaking lines of text in the document or template.
farEastLineBreakLevel Specifies the line break control level for the document.
fullName Returns the name of the template, including the drive or Web path.
hasNoProofing Specifies whether the spelling and grammar checker ignores documents based on this template.
justificationMode Specifies the character spacing adjustment for the template.
kerningByAlgorithm Specifies if Microsoft Word kerns half-width Latin characters and punctuation marks in the document.
languageId Specifies a LanguageId value that represents the language in the template.
languageIdFarEast Specifies an East Asian language for the language in the template.
name Returns only the name of the document template (excluding any path or other location information).
noLineBreakAfter Specifies the kinsoku characters after which Microsoft Word will not break a line.
noLineBreakBefore Specifies the kinsoku characters before which Microsoft Word will not break a line.
path Returns the path to the document template.
save() Saves the template.
saved Specifies true if the template has not changed since it was last saved, false if Microsoft Word displays a prompt to save changes when the document is closed.
type Returns the template type.
TemplateCollection getCount() Returns the number of items in the collection.
getItemAt(index: number) Gets a Template object by its index in the collection.
importBuildingBlocks() Imports the building blocks for all templates into Microsoft Word.
items Gets the loaded child items in this collection.
TextColumn spaceAfter Specifies the amount of spacing (in points) after the specified paragraph or text column.
width Specifies the width, in points, of the specified text columns.
TextColumnAddOptions isEvenlySpaced If provided, specifies whether to evenly space all the text columns in the document.
spacing If provided, specifies the spacing between the text columns in the document, in points.
width If provided, specifies the width of the new text column in the document, in points.
TextColumnCollection add(options?: Word.TextColumnAddOptions) Returns a TextColumn object that represents a new text column added to a section or document.
getFlowDirection() Gets the direction in which text flows from one text column to the next.
getHasLineBetween() Gets whether vertical lines appear between all the columns in the TextColumnCollection object.
getIsEvenlySpaced() Gets whether text columns are evenly spaced.
getItem(index: number) Gets a TextColumn by its index in the collection.
items Gets the loaded child items in this collection.
setCount(numColumns: number) Arranges text into the specified number of text columns.
setFlowDirection(value: Word.FlowDirection) Sets the direction in which text flows from one text column to the next.
setHasLineBetween(value: boolean) Sets whether vertical lines appear between all the columns in the TextColumnCollection object.
setIsEvenlySpaced(value: boolean) Sets whether text columns are evenly spaced.
ThreeDimensionalFormat bevelBottomDepth Specifies the depth of the bottom bevel.
bevelBottomInset Specifies the inset size for the bottom bevel.
bevelBottomType Specifies a BevelType value that represents the bevel type for the bottom bevel.
bevelTopDepth Specifies the depth of the top bevel.
bevelTopInset Specifies the inset size for the top bevel.
bevelTopType Specifies a BevelType value that represents the bevel type for the top bevel.
contourColor Returns a ColorFormat object that represents color of the contour of a shape.
contourWidth Specifies the width of the contour of a shape.
depth Specifies the depth of the shape's extrusion.
extrusionColor Returns a ColorFormat object that represents the color of the shape's extrusion.
extrusionColorType Specifies whether the extrusion color is based on the extruded shape's fill (the front face of the extrusion)
fieldOfView Specifies the amount of perspective for a shape.
incrementRotationHorizontal(increment: number) Horizontally rotates a shape on the x-axis.
incrementRotationVertical(increment: number) Vertically rotates a shape on the y-axis.
incrementRotationX(increment: number) Changes the rotation around the x-axis.
incrementRotationY(increment: number) Changes the rotation around the y-axis.
incrementRotationZ(increment: number) Rotates a shape on the z-axis.
isPerspective Specifies true if the extrusion appears in perspective — that is, if the walls of the extrusion narrow toward a vanishing point,
isVisible Specifies if the specified object, or the formatting applied to it, is visible.
lightAngle Specifies the angle of the lighting.
presetCamera Returns a PresetCamera value that represents the camera presets.
presetExtrusionDirection Returns the direction taken by the extrusion's sweep path leading away from the extruded shape (the front face of the extrusion).
presetLighting Specifies a LightRigType value that represents the lighting preset.
presetLightingDirection Specifies the position of the light source relative to the extrusion.
presetLightingSoftness Specifies the intensity of the extrusion lighting.
presetMaterial Specifies the extrusion surface material.
presetThreeDimensionalFormat Returns the preset extrusion format.
projectText Specifies whether text on a shape rotates with shape.
resetRotation() Resets the extrusion rotation around the x-axis, y-axis, and z-axis to 0.
rotationX Specifies the rotation of the extruded shape around the x-axis in degrees.
rotationY Specifies the rotation of the extruded shape around the y-axis in degrees.
rotationZ Specifies the z-axis rotation of the camera.
setExtrusionDirection(presetExtrusionDirection: Word.PresetExtrusionDirection) Sets the direction of the extrusion's sweep path.
setPresetCamera(presetCamera: Word.PresetCamera) Sets the camera preset for the shape.
setThreeDimensionalFormat(presetThreeDimensionalFormat: Word.PresetThreeDimensionalFormat) Sets the preset extrusion format.
z Specifies the position on the z-axis for the shape.
XmlMapping customXmlNode Returns a CustomXmlNode object that represents the custom XML node in the data store that the content control in the document maps to.
customXmlPart Returns a CustomXmlPart object that represents the custom XML part to which the content control in the document maps.
delete() Deletes the XML mapping from the parent content control.
isMapped Returns whether the content control in the document is mapped to an XML node in the document's XML data store.
prefixMappings Returns the prefix mappings used to evaluate the XPath for the current XML mapping.
setMapping(xPath: string, options?: Word.XmlSetMappingOptions) Allows creating or changing the XML mapping on the content control.
setMappingByNode(node: Word.CustomXmlNode) Allows creating or changing the XML data mapping on the content control.
xpath Returns the XPath for the XML mapping, which evaluates to the currently mapped XML node.
XmlSetMappingOptions prefixMapping If provided, specifies the prefix mappings to use when querying the expression provided in the xPath parameter of the XmlMapping.setMapping calling method.
source If provided, specifies the desired custom XML data to map the content control to.

Web-only API list

The following table lists the Word JavaScript APIs currently in preview only in Word on the web. To see a complete list of all Word JavaScript APIs (including preview APIs and previously released APIs), see all Word JavaScript APIs.

Class Fields Description
Body onCommentAdded Occurs when new comments are added.
onCommentChanged Occurs when a comment or its reply is changed.
onCommentDeleted Occurs when comments are deleted.
onCommentDeselected Occurs when a comment is deselected.
onCommentSelected Occurs when a comment is selected.
CommentDetail id Represents the ID of this comment.
replyIds Represents the IDs of the replies to this comment.
CommentEventArgs changeType Represents how the comment changed event is triggered.
commentDetails Gets the CommentDetail array which contains the IDs and reply IDs of the involved comments.
source The source of the event.
type The event type.
ContentControl onCommentAdded Occurs when new comments are added.
onCommentChanged Occurs when a comment or its reply is changed.
onCommentDeselected Occurs when a comment is deselected.
onCommentSelected Occurs when a comment is selected.
Paragraph onCommentAdded Occurs when new comments are added.
onCommentChanged Occurs when a comment or its reply is changed.
onCommentDeleted Occurs when comments are deleted.
onCommentDeselected Occurs when a comment is deselected.
onCommentSelected Occurs when a comment is selected.
Range onCommentAdded Occurs when new comments are added.
onCommentChanged Occurs when a comment or its reply is changed.
onCommentDeselected Occurs when a comment is deselected.
onCommentSelected Occurs when a comment is selected.

See also