word package

Classes

Word.Application

Represents the application object.

[ API set: WordApi 1.3 ]

Word.Body

Represents the body of a document or a section.

[ API set: WordApi 1.1 ]

Word.ContentControl

Represents a content control. Content controls are bounded and potentially labeled regions in a document that serve as containers for specific types of content. Individual content controls may contain contents such as images, tables, or paragraphs of formatted text. Currently, only rich text content controls are supported.

[ API set: WordApi 1.1 ]

Word.ContentControlCollection

Contains a collection of Word.ContentControl objects. Content controls are bounded and potentially labeled regions in a document that serve as containers for specific types of content. Individual content controls may contain contents such as images, tables, or paragraphs of formatted text. Currently, only rich text content controls are supported.

[ API set: WordApi 1.1 ]

Word.CustomProperty

Represents a custom property.

[ API set: WordApi 1.3 ]

Word.CustomPropertyCollection

Contains the collection of Word.CustomProperty objects.

[ API set: WordApi 1.3 ]

Word.CustomXmlPart

Represents a custom XML part.

[ API set: WordApi BETA (PREVIEW ONLY) ]

Word.CustomXmlPartCollection

Contains the collection of Word.CustomXmlPart objects.

[ API set: WordApi BETA (PREVIEW ONLY) ]

Word.CustomXmlPartScopedCollection

Contains the collection of Word.CustomXmlPart objects with a specific namespace.

[ API set: WordApi BETA (PREVIEW ONLY) ]

Word.Document

The Document object is the top level object. A Document object contains one or more sections, content controls, and the body that contains the contents of the document.

[ API set: WordApi 1.1 ]

Word.DocumentCreated

The DocumentCreated object is the top level object created by Application.CreateDocument. A DocumentCreated object is a special Document object.

[ API set: WordApi 1.3 ]

Word.DocumentProperties

Represents document properties.

[ API set: WordApi 1.3 ]

Word.Font

Represents a font.

[ API set: WordApi 1.1 ]

Word.InlinePicture

Represents an inline picture.

[ API set: WordApi 1.1 ]

Word.InlinePictureCollection

Contains a collection of Word.InlinePicture objects.

[ API set: WordApi 1.1 ]

Word.List

Contains a collection of Word.Paragraph objects.

[ API set: WordApi 1.3 ]

Word.ListCollection

Contains a collection of Word.List objects.

[ API set: WordApi 1.3 ]

Word.ListItem

Represents the paragraph list item format.

[ API set: WordApi 1.3 ]

Word.Paragraph

Represents a single paragraph in a selection, range, content control, or document body.

[ API set: WordApi 1.1 ]

Word.ParagraphCollection

Contains a collection of Word.Paragraph objects.

[ API set: WordApi 1.1 ]

Word.Range

Represents a contiguous area in a document.

[ API set: WordApi 1.1 ]

Word.RangeCollection

Contains a collection of Word.Range objects.

[ API set: WordApi 1.1 ]

Word.RequestContext

The RequestContext object facilitates requests to the Word application. Since the Office add-in and the Word application run in two different processes, the request context is required to get access to the Word object model from the add-in.

Word.SearchOptions

Specifies the options to be included in a search operation.

[ API set: WordApi 1.1 ]

Word.Section

Represents a section in a Word document.

[ API set: WordApi 1.1 ]

Word.SectionCollection

Contains the collection of the document's Word.Section objects.

[ API set: WordApi 1.1 ]

Word.Setting

Represents a setting of the add-in.

[ API set: WordApi BETA (PREVIEW ONLY) ]

Word.SettingCollection

Contains the collection of Word.Setting objects.

[ API set: WordApi BETA (PREVIEW ONLY) ]

Word.Table

Represents a table in a Word document.

[ API set: WordApi 1.3 ]

Word.TableBorder

Specifies the border style.

[ API set: WordApi 1.3 ]

Word.TableCell

Represents a table cell in a Word document.

[ API set: WordApi 1.3 ]

Word.TableCellCollection

Contains the collection of the document's TableCell objects.

[ API set: WordApi 1.3 ]

Word.TableCollection

Contains the collection of the document's Table objects.

[ API set: WordApi 1.3 ]

Word.TableRow

Represents a row in a Word document.

[ API set: WordApi 1.3 ]

Word.TableRowCollection

Contains the collection of the document's TableRow objects.

[ API set: WordApi 1.3 ]

Interfaces

Word.ContentControlEventArgs

Provides information about the content control that raised an event.

[ API set: WordApi BETA (PREVIEW ONLY) ]

Word.Interfaces.BodyData

An interface describing the data returned by calling "body.toJSON()".

Word.Interfaces.BodyLoadOptions

Represents the body of a document or a section.

[ API set: WordApi 1.1 ]

Word.Interfaces.BodyUpdateData

An interface for updating data on the Body object, for use in "body.set({ ... })".

Word.Interfaces.CollectionLoadOptions

Provides ways to load properties of only a subset of members of a collection.

Word.Interfaces.ContentControlCollectionData

An interface describing the data returned by calling "contentControlCollection.toJSON()".

Word.Interfaces.ContentControlCollectionLoadOptions

Contains a collection of Word.ContentControl objects. Content controls are bounded and potentially labeled regions in a document that serve as containers for specific types of content. Individual content controls may contain contents such as images, tables, or paragraphs of formatted text. Currently, only rich text content controls are supported.

[ API set: WordApi 1.1 ]

Word.Interfaces.ContentControlCollectionUpdateData

An interface for updating data on the ContentControlCollection object, for use in "contentControlCollection.set({ ... })".

Word.Interfaces.ContentControlData

An interface describing the data returned by calling "contentControl.toJSON()".

Word.Interfaces.ContentControlLoadOptions

Represents a content control. Content controls are bounded and potentially labeled regions in a document that serve as containers for specific types of content. Individual content controls may contain contents such as images, tables, or paragraphs of formatted text. Currently, only rich text content controls are supported.

[ API set: WordApi 1.1 ]

Word.Interfaces.ContentControlUpdateData

An interface for updating data on the ContentControl object, for use in "contentControl.set({ ... })".

Word.Interfaces.CustomPropertyCollectionData

An interface describing the data returned by calling "customPropertyCollection.toJSON()".

Word.Interfaces.CustomPropertyCollectionLoadOptions

Contains the collection of Word.CustomProperty objects.

[ API set: WordApi 1.3 ]

Word.Interfaces.CustomPropertyCollectionUpdateData

An interface for updating data on the CustomPropertyCollection object, for use in "customPropertyCollection.set({ ... })".

Word.Interfaces.CustomPropertyData

An interface describing the data returned by calling "customProperty.toJSON()".

Word.Interfaces.CustomPropertyLoadOptions

Represents a custom property.

[ API set: WordApi 1.3 ]

Word.Interfaces.CustomPropertyUpdateData

An interface for updating data on the CustomProperty object, for use in "customProperty.set({ ... })".

Word.Interfaces.CustomXmlPartCollectionData

An interface describing the data returned by calling "customXmlPartCollection.toJSON()".

Word.Interfaces.CustomXmlPartCollectionLoadOptions

Contains the collection of Word.CustomXmlPart objects.

[ API set: WordApi BETA (PREVIEW ONLY) ]

Word.Interfaces.CustomXmlPartCollectionUpdateData

An interface for updating data on the CustomXmlPartCollection object, for use in "customXmlPartCollection.set({ ... })".

Word.Interfaces.CustomXmlPartData

An interface describing the data returned by calling "customXmlPart.toJSON()".

Word.Interfaces.CustomXmlPartLoadOptions

Represents a custom XML part.

[ API set: WordApi BETA (PREVIEW ONLY) ]

Word.Interfaces.CustomXmlPartScopedCollectionData

An interface describing the data returned by calling "customXmlPartScopedCollection.toJSON()".

Word.Interfaces.CustomXmlPartScopedCollectionLoadOptions

Contains the collection of Word.CustomXmlPart objects with a specific namespace.

[ API set: WordApi BETA (PREVIEW ONLY) ]

Word.Interfaces.CustomXmlPartScopedCollectionUpdateData

An interface for updating data on the CustomXmlPartScopedCollection object, for use in "customXmlPartScopedCollection.set({ ... })".

Word.Interfaces.DocumentCreatedData

An interface describing the data returned by calling "documentCreated.toJSON()".

Word.Interfaces.DocumentCreatedLoadOptions

The DocumentCreated object is the top level object created by Application.CreateDocument. A DocumentCreated object is a special Document object.

[ API set: WordApi 1.3 ]

Word.Interfaces.DocumentCreatedUpdateData

An interface for updating data on the DocumentCreated object, for use in "documentCreated.set({ ... })".

Word.Interfaces.DocumentData

An interface describing the data returned by calling "document.toJSON()".

Word.Interfaces.DocumentLoadOptions

The Document object is the top level object. A Document object contains one or more sections, content controls, and the body that contains the contents of the document.

[ API set: WordApi 1.1 ]

Word.Interfaces.DocumentPropertiesData

An interface describing the data returned by calling "documentProperties.toJSON()".

Word.Interfaces.DocumentPropertiesLoadOptions

Represents document properties.

[ API set: WordApi 1.3 ]

Word.Interfaces.DocumentPropertiesUpdateData

An interface for updating data on the DocumentProperties object, for use in "documentProperties.set({ ... })".

Word.Interfaces.DocumentUpdateData

An interface for updating data on the Document object, for use in "document.set({ ... })".

Word.Interfaces.FontData

An interface describing the data returned by calling "font.toJSON()".

Word.Interfaces.FontLoadOptions

Represents a font.

[ API set: WordApi 1.1 ]

Word.Interfaces.FontUpdateData

An interface for updating data on the Font object, for use in "font.set({ ... })".

Word.Interfaces.InlinePictureCollectionData

An interface describing the data returned by calling "inlinePictureCollection.toJSON()".

Word.Interfaces.InlinePictureCollectionLoadOptions

Contains a collection of Word.InlinePicture objects.

[ API set: WordApi 1.1 ]

Word.Interfaces.InlinePictureCollectionUpdateData

An interface for updating data on the InlinePictureCollection object, for use in "inlinePictureCollection.set({ ... })".

Word.Interfaces.InlinePictureData

An interface describing the data returned by calling "inlinePicture.toJSON()".

Word.Interfaces.InlinePictureLoadOptions

Represents an inline picture.

[ API set: WordApi 1.1 ]

Word.Interfaces.InlinePictureUpdateData

An interface for updating data on the InlinePicture object, for use in "inlinePicture.set({ ... })".

Word.Interfaces.ListCollectionData

An interface describing the data returned by calling "listCollection.toJSON()".

Word.Interfaces.ListCollectionLoadOptions

Contains a collection of Word.List objects.

[ API set: WordApi 1.3 ]

Word.Interfaces.ListCollectionUpdateData

An interface for updating data on the ListCollection object, for use in "listCollection.set({ ... })".

Word.Interfaces.ListData

An interface describing the data returned by calling "list.toJSON()".

Word.Interfaces.ListItemData

An interface describing the data returned by calling "listItem.toJSON()".

Word.Interfaces.ListItemLoadOptions

Represents the paragraph list item format.

[ API set: WordApi 1.3 ]

Word.Interfaces.ListItemUpdateData

An interface for updating data on the ListItem object, for use in "listItem.set({ ... })".

Word.Interfaces.ListLoadOptions

Contains a collection of Word.Paragraph objects.

[ API set: WordApi 1.3 ]

Word.Interfaces.ParagraphCollectionData

An interface describing the data returned by calling "paragraphCollection.toJSON()".

Word.Interfaces.ParagraphCollectionLoadOptions

Contains a collection of Word.Paragraph objects.

[ API set: WordApi 1.1 ]

Word.Interfaces.ParagraphCollectionUpdateData

An interface for updating data on the ParagraphCollection object, for use in "paragraphCollection.set({ ... })".

Word.Interfaces.ParagraphData

An interface describing the data returned by calling "paragraph.toJSON()".

Word.Interfaces.ParagraphLoadOptions

Represents a single paragraph in a selection, range, content control, or document body.

[ API set: WordApi 1.1 ]

Word.Interfaces.ParagraphUpdateData

An interface for updating data on the Paragraph object, for use in "paragraph.set({ ... })".

Word.Interfaces.RangeCollectionData

An interface describing the data returned by calling "rangeCollection.toJSON()".

Word.Interfaces.RangeCollectionLoadOptions

Contains a collection of Word.Range objects.

[ API set: WordApi 1.1 ]

Word.Interfaces.RangeCollectionUpdateData

An interface for updating data on the RangeCollection object, for use in "rangeCollection.set({ ... })".

Word.Interfaces.RangeData

An interface describing the data returned by calling "range.toJSON()".

Word.Interfaces.RangeLoadOptions

Represents a contiguous area in a document.

[ API set: WordApi 1.1 ]

Word.Interfaces.RangeUpdateData

An interface for updating data on the Range object, for use in "range.set({ ... })".

Word.Interfaces.SearchOptionsData

An interface describing the data returned by calling "searchOptions.toJSON()".

Word.Interfaces.SearchOptionsLoadOptions

Specifies the options to be included in a search operation.

[ API set: WordApi 1.1 ]

Word.Interfaces.SearchOptionsUpdateData

An interface for updating data on the SearchOptions object, for use in "searchOptions.set({ ... })".

Word.Interfaces.SectionCollectionData

An interface describing the data returned by calling "sectionCollection.toJSON()".

Word.Interfaces.SectionCollectionLoadOptions

Contains the collection of the document's Word.Section objects.

[ API set: WordApi 1.1 ]

Word.Interfaces.SectionCollectionUpdateData

An interface for updating data on the SectionCollection object, for use in "sectionCollection.set({ ... })".

Word.Interfaces.SectionData

An interface describing the data returned by calling "section.toJSON()".

Word.Interfaces.SectionLoadOptions

Represents a section in a Word document.

[ API set: WordApi 1.1 ]

Word.Interfaces.SectionUpdateData

An interface for updating data on the Section object, for use in "section.set({ ... })".

Word.Interfaces.SettingCollectionData

An interface describing the data returned by calling "settingCollection.toJSON()".

Word.Interfaces.SettingCollectionLoadOptions

Contains the collection of Word.Setting objects.

[ API set: WordApi BETA (PREVIEW ONLY) ]

Word.Interfaces.SettingCollectionUpdateData

An interface for updating data on the SettingCollection object, for use in "settingCollection.set({ ... })".

Word.Interfaces.SettingData

An interface describing the data returned by calling "setting.toJSON()".

Word.Interfaces.SettingLoadOptions

Represents a setting of the add-in.

[ API set: WordApi BETA (PREVIEW ONLY) ]

Word.Interfaces.SettingUpdateData

An interface for updating data on the Setting object, for use in "setting.set({ ... })".

Word.Interfaces.TableBorderData

An interface describing the data returned by calling "tableBorder.toJSON()".

Word.Interfaces.TableBorderLoadOptions

Specifies the border style.

[ API set: WordApi 1.3 ]

Word.Interfaces.TableBorderUpdateData

An interface for updating data on the TableBorder object, for use in "tableBorder.set({ ... })".

Word.Interfaces.TableCellCollectionData

An interface describing the data returned by calling "tableCellCollection.toJSON()".

Word.Interfaces.TableCellCollectionLoadOptions

Contains the collection of the document's TableCell objects.

[ API set: WordApi 1.3 ]

Word.Interfaces.TableCellCollectionUpdateData

An interface for updating data on the TableCellCollection object, for use in "tableCellCollection.set({ ... })".

Word.Interfaces.TableCellData

An interface describing the data returned by calling "tableCell.toJSON()".

Word.Interfaces.TableCellLoadOptions

Represents a table cell in a Word document.

[ API set: WordApi 1.3 ]

Word.Interfaces.TableCellUpdateData

An interface for updating data on the TableCell object, for use in "tableCell.set({ ... })".

Word.Interfaces.TableCollectionData

An interface describing the data returned by calling "tableCollection.toJSON()".

Word.Interfaces.TableCollectionLoadOptions

Contains the collection of the document's Table objects.

[ API set: WordApi 1.3 ]

Word.Interfaces.TableCollectionUpdateData

An interface for updating data on the TableCollection object, for use in "tableCollection.set({ ... })".

Word.Interfaces.TableData

An interface describing the data returned by calling "table.toJSON()".

Word.Interfaces.TableLoadOptions

Represents a table in a Word document.

[ API set: WordApi 1.3 ]

Word.Interfaces.TableRowCollectionData

An interface describing the data returned by calling "tableRowCollection.toJSON()".

Word.Interfaces.TableRowCollectionLoadOptions

Contains the collection of the document's TableRow objects.

[ API set: WordApi 1.3 ]

Word.Interfaces.TableRowCollectionUpdateData

An interface for updating data on the TableRowCollection object, for use in "tableRowCollection.set({ ... })".

Word.Interfaces.TableRowData

An interface describing the data returned by calling "tableRow.toJSON()".

Word.Interfaces.TableRowLoadOptions

Represents a row in a Word document.

[ API set: WordApi 1.3 ]

Word.Interfaces.TableRowUpdateData

An interface for updating data on the TableRow object, for use in "tableRow.set({ ... })".

Word.Interfaces.TableUpdateData

An interface for updating data on the Table object, for use in "table.set({ ... })".

Enums

Word.Alignment

[ API set: WordApi ]

Word.BodyType

[ API set: WordApi ]

Word.BorderLocation

[ API set: WordApi ]

Word.BorderType

[ API set: WordApi ]

Word.BreakType

Specifies the form of a break.

[ API set: WordApi ]

Word.CellPaddingLocation

[ API set: WordApi ]

Word.ContentControlAppearance

ContentControl appearance

[ API set: WordApi ]

Word.ContentControlType

Specifies supported content control types and subtypes.

[ API set: WordApi ]

Word.DocumentPropertyType

[ API set: WordApi ]

Word.ErrorCodes

[ API set: WordApi ]

Word.EventType

Provides information about the type of a raised event. For each object type, please keep the order of: deleted, selection changed, data changed, added.

[ API set: WordApi ]

Word.FileContentFormat

[ API set: WordApi ]

Word.HeaderFooterType

[ API set: WordApi ]

Word.ImageFormat

[ API set: WordApi ]

Word.InsertLocation

The insertion location types

[ API set: WordApi ]

Word.ListBullet

[ API set: WordApi ]

Word.ListLevelType

[ API set: WordApi ]

Word.ListNumbering

[ API set: WordApi ]

Word.LocationRelation

[ API set: WordApi ]

Word.RangeLocation

[ API set: WordApi ]

Word.SelectionMode

[ API set: WordApi ]

Word.Style

[ API set: WordApi ]

Word.TapObjectType

[ API set: WordApi ]

Word.UnderlineType

Underline types

[ API set: WordApi ]

Word.VerticalAlignment

[ API set: WordApi ]

Functions

Word.run(objects, batch)

Executes a batch script that performs actions on the Word object model, using the RequestContext of previously created API objects.

Word.run(object, batch)

Executes a batch script that performs actions on the Word object model, using the RequestContext of a previously created API object. When the promise is resolved, any tracked objects that were automatically allocated during execution will be released.

Word.run(batch)

Executes a batch script that performs actions on the Word object model, using a new RequestContext. When the promise is resolved, any tracked objects that were automatically allocated during execution will be released.

Function Details

Word.run(objects, batch)

Executes a batch script that performs actions on the Word object model, using the RequestContext of previously created API objects.

export function run<T>(objects: OfficeExtension.ClientObject[], batch: (context: Word.RequestContext) => Promise<T>): Promise<T>;

Parameters

objects
OfficeExtension.ClientObject[]

An array of previously created API objects. The array will be validated to make sure that all of the objects share the same context. The batch will use this shared RequestContext, which means that any changes applied to these objects will be picked up by "context.sync()".

batch
(context: Word.RequestContext) => Promise<T>

A function that takes in a RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the Word application. Since the Office add-in and the Word application run in two different processes, the RequestContext is required to get access to the Word object model from the add-in.

Returns

Promise<T>

Word.run(object, batch)

Executes a batch script that performs actions on the Word object model, using the RequestContext of a previously created API object. When the promise is resolved, any tracked objects that were automatically allocated during execution will be released.

export function run<T>(object: OfficeExtension.ClientObject, batch: (context: Word.RequestContext) => Promise<T>): Promise<T>;

Parameters

object
OfficeExtension.ClientObject

A previously created API object. The batch will use the same RequestContext as the passed-in object, which means that any changes applied to the object will be picked up by "context.sync()".

batch
(context: Word.RequestContext) => Promise<T>

A function that takes in a RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the Word application. Since the Office add-in and the Word application run in two different processes, the RequestContext is required to get access to the Word object model from the add-in.

Returns

Promise<T>

Word.run(batch)

Executes a batch script that performs actions on the Word object model, using a new RequestContext. When the promise is resolved, any tracked objects that were automatically allocated during execution will be released.

export function run<T>(batch: (context: Word.RequestContext) => Promise<T>): Promise<T>;

Parameters

batch
(context: Word.RequestContext) => Promise<T>

A function that takes in a RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the Word application. Since the Office add-in and the Word application run in two different processes, the RequestContext is required to get access to the Word object model from the add-in.

Returns

Promise<T>

Remarks

In addition to this signature, the method also has the following signatures, which allow you to resume using the request context of previously created objects:

run(object: OfficeExtension.ClientObject, batch: (context: Word.RequestContext) => Promise): Promise;

run(objects: OfficeExtension.ClientObject[], batch: (context: Word.RequestContext) => Promise): Promise;