word package
Classes
Word.Annotation |
Represents an annotation attached to a paragraph. |
Word.AnnotationCollection |
Contains a collection of Word.Annotation objects. |
Word.Application |
Represents the application object. |
Word.Body |
Represents the body of a document or a section. |
Word.CheckboxContentControl |
The data specific to content controls of type CheckBox. |
Word.Comment |
Represents a comment in the document. |
Word.CommentCollection |
Contains a collection of Word.Comment objects. |
Word.CommentContentRange | |
Word.CommentReply |
Represents a comment reply in the document. |
Word.CommentReplyCollection |
Contains a collection of Word.CommentReply objects. Represents all comment replies in one comment thread. |
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, plain text, and checkbox content controls are supported. |
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 and plain text content controls are supported. |
Word.CritiqueAnnotation |
Represents an annotation wrapper around critique displayed in the document. |
Word.CustomProperty |
Represents a custom property. |
Word.CustomPropertyCollection |
Contains the collection of Word.CustomProperty objects. |
Word.CustomXmlPart |
Represents a custom XML part. |
Word.CustomXmlPartCollection |
Contains the collection of Word.CustomXmlPart objects. |
Word.CustomXmlPartScopedCollection |
Contains the collection of Word.CustomXmlPart objects with a specific namespace. |
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. |
Word.DocumentCreated |
The DocumentCreated object is the top level object created by Application.CreateDocument. A DocumentCreated object is a special Document object. |
Word.DocumentProperties |
Represents document properties. |
Word.Field |
Represents a field. |
Word.FieldCollection |
Contains a collection of Word.Field objects. |
Word.Font |
Represents a font. |
Word.InlinePicture |
Represents an inline picture. |
Word.InlinePictureCollection |
Contains a collection of Word.InlinePicture objects. |
Word.List |
Contains a collection of Word.Paragraph objects. |
Word.ListCollection |
Contains a collection of Word.List objects. |
Word.ListItem |
Represents the paragraph list item format. |
Word.NoteItem |
Represents a footnote or endnote. |
Word.NoteItemCollection |
Contains a collection of Word.NoteItem objects. |
Word.Paragraph |
Represents a single paragraph in a selection, range, content control, or document body. |
Word.ParagraphCollection |
Contains a collection of Word.Paragraph objects. |
Word.ParagraphFormat |
Represents a style of paragraph in a document. |
Word.Range |
Represents a contiguous area in a document. |
Word.RangeCollection |
Contains a collection of Word.Range objects. |
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. To learn more about how to use search options in the Word JavaScript APIs, read Use search options to find text in your Word add-in. |
Word.Section |
Represents a section in a Word document. |
Word.SectionCollection |
Contains the collection of the document's Word.Section objects. |
Word.Setting |
Represents a setting of the add-in. |
Word.SettingCollection |
Contains the collection of Word.Setting objects. |
Word.Shading |
Represents the shading object. |
Word.Style |
Represents a style in a Word document. |
Word.StyleCollection |
Contains a collection of Word.Style objects. |
Word.Table |
Represents a table in a Word document. |
Word.TableBorder |
Specifies the border style. |
Word.TableCell |
Represents a table cell in a Word document. |
Word.TableCellCollection |
Contains the collection of the document's TableCell objects. |
Word.TableCollection |
Contains the collection of the document's Table objects. |
Word.TableRow |
Represents a row in a Word document. |
Word.TableRowCollection |
Contains the collection of the document's TableRow objects. |
Word.TableStyle |
Represents the TableStyle object. |
Word.TrackedChange |
Represents a tracked change in a Word document. |
Word.TrackedChangeCollection |
Contains a collection of Word.TrackedChange objects. |
Interfaces
Word.AnnotationClickedEventArgs |
Holds annotation information that is passed back on annotation inserted event. |
Word.AnnotationHoveredEventArgs |
Holds annotation information that is passed back on annotation hovered event. |
Word.AnnotationInsertedEventArgs |
Holds annotation information that is passed back on annotation added event. |
Word.AnnotationPopupActionEventArgs |
Represents action information that's passed back on annotation pop-up action event. |
Word.AnnotationRemovedEventArgs |
Holds annotation information that is passed back on annotation removed event. |
Word.AnnotationSet |
Annotations set produced by the add-in. Currently supporting only critiques. |
Word.ContentControlAddedEventArgs |
Provides information about the content control that raised contentControlAdded event. |
Word.ContentControlDataChangedEventArgs |
Provides information about the content control that raised contentControlDataChanged event. |
Word.ContentControlDeletedEventArgs |
Provides information about the content control that raised contentControlDeleted event. |
Word.ContentControlEnteredEventArgs |
Provides information about the content control that raised contentControlEntered event. |
Word.ContentControlExitedEventArgs |
Provides information about the content control that raised contentControlExited event. |
Word.ContentControlOptions |
Specifies the options that define which content controls are returned. |
Word.ContentControlSelectionChangedEventArgs |
Provides information about the content control that raised contentControlSelectionChanged event. |
Word.Critique |
Critique that will be rendered as underline for the specified part of paragraph in the document. |
Word.CritiquePopupOptions |
Properties defining the behavior of the pop-up menu for a given critique. |
Word.GetTextOptions |
Specifies the options to be included in a getText operation. |
Word.InsertFileOptions |
Specifies the options to determine what to copy when inserting a file. |
Word.Interfaces.AnnotationCollectionData |
An interface describing the data returned by calling |
Word.Interfaces.AnnotationCollectionLoadOptions |
Contains a collection of Word.Annotation objects. |
Word.Interfaces.AnnotationCollectionUpdateData |
An interface for updating data on the |
Word.Interfaces.AnnotationData |
An interface describing the data returned by calling |
Word.Interfaces.AnnotationLoadOptions |
Represents an annotation attached to a paragraph. |
Word.Interfaces.BodyData |
An interface describing the data returned by calling |
Word.Interfaces.BodyLoadOptions |
Represents the body of a document or a section. |
Word.Interfaces.BodyUpdateData |
An interface for updating data on the |
Word.Interfaces.BorderCollectionData |
An interface describing the data returned by calling |
Word.Interfaces.BorderCollectionUpdateData |
An interface for updating data on the |
Word.Interfaces.BorderData |
An interface describing the data returned by calling |
Word.Interfaces.BorderUpdateData |
An interface for updating data on the |
Word.Interfaces.CheckboxContentControlData |
An interface describing the data returned by calling |
Word.Interfaces.CheckboxContentControlLoadOptions |
The data specific to content controls of type CheckBox. |
Word.Interfaces.CheckboxContentControlUpdateData |
An interface for updating data on the |
Word.Interfaces.CollectionLoadOptions |
Provides ways to load properties of only a subset of members of a collection. |
Word.Interfaces.ComboBoxContentControlData |
An interface describing the data returned by calling |
Word.Interfaces.CommentCollectionData |
An interface describing the data returned by calling |
Word.Interfaces.CommentCollectionLoadOptions |
Contains a collection of Word.Comment objects. |
Word.Interfaces.CommentCollectionUpdateData |
An interface for updating data on the |
Word.Interfaces.CommentContentRangeData |
An interface describing the data returned by calling |
Word.Interfaces.CommentContentRangeLoadOptions | |
Word.Interfaces.CommentContentRangeUpdateData |
An interface for updating data on the |
Word.Interfaces.CommentData |
An interface describing the data returned by calling |
Word.Interfaces.CommentLoadOptions |
Represents a comment in the document. |
Word.Interfaces.CommentReplyCollectionData |
An interface describing the data returned by calling |
Word.Interfaces.CommentReplyCollectionLoadOptions |
Contains a collection of Word.CommentReply objects. Represents all comment replies in one comment thread. |
Word.Interfaces.CommentReplyCollectionUpdateData |
An interface for updating data on the |
Word.Interfaces.CommentReplyData |
An interface describing the data returned by calling |
Word.Interfaces.CommentReplyLoadOptions |
Represents a comment reply in the document. |
Word.Interfaces.CommentReplyUpdateData |
An interface for updating data on the |
Word.Interfaces.CommentUpdateData |
An interface for updating data on the |
Word.Interfaces.ContentControlCollectionData |
An interface describing the data returned by calling |
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 and plain text content controls are supported. |
Word.Interfaces.ContentControlCollectionUpdateData |
An interface for updating data on the |
Word.Interfaces.ContentControlData |
An interface describing the data returned by calling |
Word.Interfaces.ContentControlListItemCollectionData |
An interface describing the data returned by calling |
Word.Interfaces.ContentControlListItemCollectionUpdateData |
An interface for updating data on the |
Word.Interfaces.ContentControlListItemData |
An interface describing the data returned by calling |
Word.Interfaces.ContentControlListItemUpdateData |
An interface for updating data on the |
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, plain text, and checkbox content controls are supported. |
Word.Interfaces.ContentControlUpdateData |
An interface for updating data on the |
Word.Interfaces.CritiqueAnnotationData |
An interface describing the data returned by calling |
Word.Interfaces.CritiqueAnnotationLoadOptions |
Represents an annotation wrapper around critique displayed in the document. |
Word.Interfaces.CustomPropertyCollectionData |
An interface describing the data returned by calling |
Word.Interfaces.CustomPropertyCollectionLoadOptions |
Contains the collection of Word.CustomProperty objects. |
Word.Interfaces.CustomPropertyCollectionUpdateData |
An interface for updating data on the |
Word.Interfaces.CustomPropertyData |
An interface describing the data returned by calling |
Word.Interfaces.CustomPropertyLoadOptions |
Represents a custom property. |
Word.Interfaces.CustomPropertyUpdateData |
An interface for updating data on the |
Word.Interfaces.CustomXmlPartCollectionData |
An interface describing the data returned by calling |
Word.Interfaces.CustomXmlPartCollectionLoadOptions |
Contains the collection of Word.CustomXmlPart objects. |
Word.Interfaces.CustomXmlPartCollectionUpdateData |
An interface for updating data on the |
Word.Interfaces.CustomXmlPartData |
An interface describing the data returned by calling |
Word.Interfaces.CustomXmlPartLoadOptions |
Represents a custom XML part. |
Word.Interfaces.CustomXmlPartScopedCollectionData |
An interface describing the data returned by calling |
Word.Interfaces.CustomXmlPartScopedCollectionLoadOptions |
Contains the collection of Word.CustomXmlPart objects with a specific namespace. |
Word.Interfaces.CustomXmlPartScopedCollectionUpdateData |
An interface for updating data on the |
Word.Interfaces.DocumentCreatedData |
An interface describing the data returned by calling |
Word.Interfaces.DocumentCreatedLoadOptions |
The DocumentCreated object is the top level object created by Application.CreateDocument. A DocumentCreated object is a special Document object. |
Word.Interfaces.DocumentCreatedUpdateData |
An interface for updating data on the |
Word.Interfaces.DocumentData |
An interface describing the data returned by calling |
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. |
Word.Interfaces.DocumentPropertiesData |
An interface describing the data returned by calling |
Word.Interfaces.DocumentPropertiesLoadOptions |
Represents document properties. |
Word.Interfaces.DocumentPropertiesUpdateData |
An interface for updating data on the |
Word.Interfaces.DocumentUpdateData |
An interface for updating data on the |
Word.Interfaces.DropDownListContentControlData |
An interface describing the data returned by calling |
Word.Interfaces.FieldCollectionData |
An interface describing the data returned by calling |
Word.Interfaces.FieldCollectionLoadOptions |
Contains a collection of Word.Field objects. |
Word.Interfaces.FieldCollectionUpdateData |
An interface for updating data on the |
Word.Interfaces.FieldData |
An interface describing the data returned by calling |
Word.Interfaces.FieldLoadOptions |
Represents a field. |
Word.Interfaces.FieldUpdateData |
An interface for updating data on the |
Word.Interfaces.FontData |
An interface describing the data returned by calling |
Word.Interfaces.FontLoadOptions |
Represents a font. |
Word.Interfaces.FontUpdateData |
An interface for updating data on the |
Word.Interfaces.InlinePictureCollectionData |
An interface describing the data returned by calling |
Word.Interfaces.InlinePictureCollectionLoadOptions |
Contains a collection of Word.InlinePicture objects. |
Word.Interfaces.InlinePictureCollectionUpdateData |
An interface for updating data on the |
Word.Interfaces.InlinePictureData |
An interface describing the data returned by calling |
Word.Interfaces.InlinePictureLoadOptions |
Represents an inline picture. |
Word.Interfaces.InlinePictureUpdateData |
An interface for updating data on the |
Word.Interfaces.ListCollectionData |
An interface describing the data returned by calling |
Word.Interfaces.ListCollectionLoadOptions |
Contains a collection of Word.List objects. |
Word.Interfaces.ListCollectionUpdateData |
An interface for updating data on the |
Word.Interfaces.ListData |
An interface describing the data returned by calling |
Word.Interfaces.ListItemData |
An interface describing the data returned by calling |
Word.Interfaces.ListItemLoadOptions |
Represents the paragraph list item format. |
Word.Interfaces.ListItemUpdateData |
An interface for updating data on the |
Word.Interfaces.ListLevelCollectionData |
An interface describing the data returned by calling |
Word.Interfaces.ListLevelCollectionUpdateData |
An interface for updating data on the |
Word.Interfaces.ListLevelData |
An interface describing the data returned by calling |
Word.Interfaces.ListLevelUpdateData |
An interface for updating data on the |
Word.Interfaces.ListLoadOptions |
Contains a collection of Word.Paragraph objects. |
Word.Interfaces.ListTemplateData |
An interface describing the data returned by calling |
Word.Interfaces.ListTemplateUpdateData |
An interface for updating data on the |
Word.Interfaces.NoteItemCollectionData |
An interface describing the data returned by calling |
Word.Interfaces.NoteItemCollectionLoadOptions |
Contains a collection of Word.NoteItem objects. |
Word.Interfaces.NoteItemCollectionUpdateData |
An interface for updating data on the |
Word.Interfaces.NoteItemData |
An interface describing the data returned by calling |
Word.Interfaces.NoteItemLoadOptions |
Represents a footnote or endnote. |
Word.Interfaces.NoteItemUpdateData |
An interface for updating data on the |
Word.Interfaces.ParagraphCollectionData |
An interface describing the data returned by calling |
Word.Interfaces.ParagraphCollectionLoadOptions |
Contains a collection of Word.Paragraph objects. |
Word.Interfaces.ParagraphCollectionUpdateData |
An interface for updating data on the |
Word.Interfaces.ParagraphData |
An interface describing the data returned by calling |
Word.Interfaces.ParagraphFormatData |
An interface describing the data returned by calling |
Word.Interfaces.ParagraphFormatLoadOptions |
Represents a style of paragraph in a document. |
Word.Interfaces.ParagraphFormatUpdateData |
An interface for updating data on the |
Word.Interfaces.ParagraphLoadOptions |
Represents a single paragraph in a selection, range, content control, or document body. |
Word.Interfaces.ParagraphUpdateData |
An interface for updating data on the |
Word.Interfaces.RangeCollectionData |
An interface describing the data returned by calling |
Word.Interfaces.RangeCollectionLoadOptions |
Contains a collection of Word.Range objects. |
Word.Interfaces.RangeCollectionUpdateData |
An interface for updating data on the |
Word.Interfaces.RangeData |
An interface describing the data returned by calling |
Word.Interfaces.RangeLoadOptions |
Represents a contiguous area in a document. |
Word.Interfaces.RangeUpdateData |
An interface for updating data on the |
Word.Interfaces.SearchOptionsData |
An interface describing the data returned by calling |
Word.Interfaces.SearchOptionsLoadOptions |
Specifies the options to be included in a search operation. To learn more about how to use search options in the Word JavaScript APIs, read Use search options to find text in your Word add-in. |
Word.Interfaces.SearchOptionsUpdateData |
An interface for updating data on the |
Word.Interfaces.SectionCollectionData |
An interface describing the data returned by calling |
Word.Interfaces.SectionCollectionLoadOptions |
Contains the collection of the document's Word.Section objects. |
Word.Interfaces.SectionCollectionUpdateData |
An interface for updating data on the |
Word.Interfaces.SectionData |
An interface describing the data returned by calling |
Word.Interfaces.SectionLoadOptions |
Represents a section in a Word document. |
Word.Interfaces.SectionUpdateData |
An interface for updating data on the |
Word.Interfaces.SettingCollectionData |
An interface describing the data returned by calling |
Word.Interfaces.SettingCollectionLoadOptions |
Contains the collection of Word.Setting objects. |
Word.Interfaces.SettingCollectionUpdateData |
An interface for updating data on the |
Word.Interfaces.SettingData |
An interface describing the data returned by calling |
Word.Interfaces.SettingLoadOptions |
Represents a setting of the add-in. |
Word.Interfaces.SettingUpdateData |
An interface for updating data on the |
Word.Interfaces.ShadingData |
An interface describing the data returned by calling |
Word.Interfaces.ShadingLoadOptions |
Represents the shading object. |
Word.Interfaces.ShadingUpdateData |
An interface for updating data on the |
Word.Interfaces.StyleCollectionData |
An interface describing the data returned by calling |
Word.Interfaces.StyleCollectionLoadOptions |
Contains a collection of Word.Style objects. |
Word.Interfaces.StyleCollectionUpdateData |
An interface for updating data on the |
Word.Interfaces.StyleData |
An interface describing the data returned by calling |
Word.Interfaces.StyleLoadOptions |
Represents a style in a Word document. |
Word.Interfaces.StyleUpdateData |
An interface for updating data on the |
Word.Interfaces.TableBorderData |
An interface describing the data returned by calling |
Word.Interfaces.TableBorderLoadOptions |
Specifies the border style. |
Word.Interfaces.TableBorderUpdateData |
An interface for updating data on the |
Word.Interfaces.TableCellCollectionData |
An interface describing the data returned by calling |
Word.Interfaces.TableCellCollectionLoadOptions |
Contains the collection of the document's TableCell objects. |
Word.Interfaces.TableCellCollectionUpdateData |
An interface for updating data on the |
Word.Interfaces.TableCellData |
An interface describing the data returned by calling |
Word.Interfaces.TableCellLoadOptions |
Represents a table cell in a Word document. |
Word.Interfaces.TableCellUpdateData |
An interface for updating data on the |
Word.Interfaces.TableCollectionData |
An interface describing the data returned by calling |
Word.Interfaces.TableCollectionLoadOptions |
Contains the collection of the document's Table objects. |
Word.Interfaces.TableCollectionUpdateData |
An interface for updating data on the |
Word.Interfaces.TableData |
An interface describing the data returned by calling |
Word.Interfaces.TableLoadOptions |
Represents a table in a Word document. |
Word.Interfaces.TableRowCollectionData |
An interface describing the data returned by calling |
Word.Interfaces.TableRowCollectionLoadOptions |
Contains the collection of the document's TableRow objects. |
Word.Interfaces.TableRowCollectionUpdateData |
An interface for updating data on the |
Word.Interfaces.TableRowData |
An interface describing the data returned by calling |
Word.Interfaces.TableRowLoadOptions |
Represents a row in a Word document. |
Word.Interfaces.TableRowUpdateData |
An interface for updating data on the |
Word.Interfaces.TableStyleData |
An interface describing the data returned by calling |
Word.Interfaces.TableStyleLoadOptions |
Represents the TableStyle object. |
Word.Interfaces.TableStyleUpdateData |
An interface for updating data on the |
Word.Interfaces.TableUpdateData |
An interface for updating data on the |
Word.Interfaces.TrackedChangeCollectionData |
An interface describing the data returned by calling |
Word.Interfaces.TrackedChangeCollectionLoadOptions |
Contains a collection of Word.TrackedChange objects. |
Word.Interfaces.TrackedChangeCollectionUpdateData |
An interface for updating data on the |
Word.Interfaces.TrackedChangeData |
An interface describing the data returned by calling |
Word.Interfaces.TrackedChangeLoadOptions |
Represents a tracked change in a Word document. |
Word.ParagraphAddedEventArgs |
Provides information about the paragraphs that raised the paragraphAdded event. |
Word.ParagraphChangedEventArgs |
Provides information about the paragraphs that raised the paragraphChanged event. |
Word.ParagraphDeletedEventArgs |
Provides information about the paragraphs that raised the paragraphDeleted event. |
Enums
Word.Alignment | |
Word.AnnotationState |
Represents the state of the annotation. |
Word.BodyType | |
Word.BorderLocation | |
Word.BorderType | |
Word.BreakType |
Specifies the form of a break. |
Word.BuiltInStyleName |
Represents the built-in style in a Word document. |
Word.CellPaddingLocation | |
Word.ChangeTrackingMode |
ChangeTracking mode. |
Word.ChangeTrackingState |
Specify the track state when ChangeTracking is on. |
Word.ChangeTrackingVersion |
Specify the current version or the original version of the text. |
Word.CloseBehavior |
Specifies the close behavior for |
Word.ContentControlAppearance |
ContentControl appearance. |
Word.ContentControlType |
Specifies supported content control types and subtypes. |
Word.CritiqueColorScheme |
Represents the color scheme of a critique in the document, affecting underline and highlight. |
Word.DocumentPropertyType | |
Word.ErrorCodes | |
Word.EventSource |
An enum that specifies an event's source. It can be local or remote (through coauthoring). |
Word.EventType |
Provides information about the type of a raised event. |
Word.FieldKind |
Represents the kind of field. Indicates how the field works in relation to updating. |
Word.FieldType |
Represents the type of Field. |
Word.HeaderFooterType | |
Word.InsertLocation |
The insertion location types. |
Word.ListBullet | |
Word.ListLevelType | |
Word.ListNumbering | |
Word.LocationRelation | |
Word.NoteItemType |
Note item type |
Word.OutlineLevel |
Represents the outline levels. |
Word.RangeLocation | |
Word.SaveBehavior |
Specifies the save behavior for |
Word.SelectionMode |
This enum sets where the cursor (insertion point) in the document is after a selection. |
Word.StyleType |
Represents the type of style. |
Word.TrackedChangeType |
TrackedChange type. |
Word.UnderlineType |
The supported styles for underline format. |
Word.VerticalAlignment |
Functions
Word. |
Executes a batch script that performs actions on the Word object model, using the RequestContext of previously created API objects. |
Word. |
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. |
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
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>
Office Add-ins