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 only be available in Word on the web.

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. 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.
type Gets the type of the body.
BookmarkCollection add(name: string, range: Word.Range) Returns a Bookmark object that represents a bookmark added to a range.
getItem(index: number) Gets a Bookmark object by its index in the collection.
BorderUniversalCollection getItem(index: number) Gets a Border object by its index in the collection.
CommentDetail id Represents the ID of this comment.
replyIds Represents the IDs of the replies to this comment.
CommentEventArgs changeType Represents how the commentChanged event is raised.
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.
ConflictCollection getItem(index: number) Gets a Conflict object by its index in the collection.
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.
resetState() Resets the state of the content control.
setState(contentControlState: Word.ContentControlState) Sets the state of the content control.
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.
CustomXmlNodeCollection getItem(index: number) Returns a CustomXmlNode object that represents the specified item in the collection.
CustomXmlPart errors Gets a CustomXmlValidationErrorCollection object that provides access to any XML validation errors.
CustomXmlPrefixMappingCollection getItem(index: number) Returns a CustomXmlPrefixMapping object that represents the specified item in the collection.
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.
node Gets the node associated with this CustomXmlValidationError object, if any exist.
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.
Document checkIn(options?: Word.DocumentCheckInOptions) Checks in the document from the local computer to a server and sets the local document to read-only so that it cannot be edited locally.
checkInWithVersion(options?: Word.DocumentCheckInWithVersionOptions) Saves the document to a server from a local computer, and sets the local document to read-only so that it cannot be edited locally.
checkSpelling(options?: Word.DocumentCheckSpellingOptions) Begins a spelling check for the document.
computeStatistics(statistic: Word.StatisticType, includeFootnotesAndEndnotes?: boolean) Returns a statistic based on the contents of the document.
countNumberedItems(options?: Word.DocumentCountNumberedItemsOptions) Returns the number of bulleted or numbered items and LISTNUM fields in the document.
endReview(options?: Word.DocumentEndReviewOptions) Terminates a review of the file that has been sent for review.
exportAsFixedFormat(outputFileName: string, exportFormat: Word.ExportFormat, options?: Word.DocumentExportAsFixedFormatOptions) Saves the document in PDF or XPS format.
exportAsFixedFormat2(outputFileName: string, exportFormat: Word.ExportFormat, options?: Word.DocumentExportAsFixedFormat2Options) Saves the document in PDF or XPS format.
exportAsFixedFormat3(outputFileName: string, exportFormat: Word.ExportFormat, options?: Word.DocumentExportAsFixedFormat3Options) Saves the document in PDF or XPS format with improved tagging.
followHyperlink(options?: Word.DocumentFollowHyperlinkOptions) Displays a cached document, if it has already been downloaded.
getRange(options?: Word.DocumentRangeOptions) Returns a Range object by using the specified starting and ending character positions.
goTo(options?: Word.GoToOptions) Returns a Range object that represents the start position of the specified item, such as a page, bookmark, or field.
merge(fileName: string, options?: Word.DocumentMergeOptions) Merges the changes marked with revision marks from one document to another.
printOut(options?: Word.DocumentPrintOutOptions) Prints all or part of the document.
protect(type: Word.ProtectionType, options?: Word.DocumentProtectOptions) Protects the document from unauthorized changes.
replyWithChanges(options?: Word.DocumentReplyWithChangesOptions) Sends an email message to the author of the document that has been sent out for review, notifying them that a reviewer has completed review of the document.
sendFaxOverInternet(options?: Word.DocumentSendFaxOverInternetOptions) Sends the document to a fax service provider, who faxes the document to one or more specified recipients.
sendForReview(options?: Word.DocumentSendForReviewOptions) Sends the document in an email message for review by the specified recipients.
DocumentCheckInOptions comment If provided, specifies a comment for the check-in operation.
makePublic If provided, specifies whether to make the document public after check-in.
saveChanges If provided, specifies whether to save changes before checking in.
DocumentCheckInWithVersionOptions comment If provided, specifies a comment for the check-in operation.
makePublic If provided, specifies whether to make the document public after check-in.
saveChanges If provided, specifies whether to save changes before checking in.
versionType If provided, specifies the version type for the check-in.
DocumentCheckSpellingOptions alwaysSuggest If provided, specifies whether to always suggest spelling corrections.
customDictionary10 If provided, specifies an additional custom dictionary to use for spell checking.
customDictionary2 If provided, specifies an additional custom dictionary to use for spell checking.
customDictionary3 If provided, specifies an additional custom dictionary to use for spell checking.
customDictionary4 If provided, specifies an additional custom dictionary to use for spell checking.
customDictionary5 If provided, specifies an additional custom dictionary to use for spell checking.
customDictionary6 If provided, specifies an additional custom dictionary to use for spell checking.
customDictionary7 If provided, specifies an additional custom dictionary to use for spell checking.
customDictionary8 If provided, specifies an additional custom dictionary to use for spell checking.
customDictionary9 If provided, specifies an additional custom dictionary to use for spell checking.
customDictionary If provided, specifies the custom dictionary to use for spell checking.
ignoreUppercase If provided, specifies whether to ignore uppercase words during spell checking.
DocumentCountNumberedItemsOptions level If provided, specifies the level of numbering to count.
numberType If provided, specifies the type of numbered items to count.
DocumentEndReviewOptions includeAttachment If provided, specifies whether to include the document as an attachment.
recipients If provided, specifies the recipients to notify when ending the review.
showMessage If provided, specifies whether to show the message before sending.
subject If provided, specifies the subject of the notification email.
DocumentExportAsFixedFormat2Options bitmapMissingFonts If provided, specifies whether to bitmap missing fonts.
createBookmarks If provided, specifies the bookmark creation mode.
documentStructureTags If provided, specifies whether to include document structure tags.
fixedFormatExtClassPtr If provided, specifies the extension class pointer.
from If provided, specifies the starting page number.
includeDocProps If provided, specifies whether to include document properties.
item If provided, specifies the item to export.
keepInformationRightsManagement If provided, specifies whether to keep Information Rights Management (IRM) settings.
openAfterExport If provided, specifies whether to open the file after export.
optimizeFor If provided, specifies the optimization target for the export.
optimizeForImageQuality If provided, specifies whether to optimize for image quality in the exported file.
range If provided, specifies the range to export.
to If provided, specifies the ending page number.
useIso19005_1 If provided, specifies whether to use ISO 19005-1 compliance.
DocumentExportAsFixedFormat3Options bitmapMissingFonts If provided, specifies whether to bitmap missing fonts.
createBookmarks If provided, specifies the bookmark creation mode.
documentStructureTags If provided, specifies whether to include document structure tags.
fixedFormatExtClassPtr If provided, specifies the extension class pointer.
from If provided, specifies the starting page number.
improveExportTagging If provided, specifies to improve export tagging for better accessibility.
includeDocProps If provided, specifies whether to include document properties.
item If provided, specifies the item to export.
keepInformationRightsManagement If provided, specifies whether to keep Information Rights Management (IRM) settings.
openAfterExport If provided, specifies whether to open the file after export.
optimizeFor If provided, specifies the optimization target for the export.
optimizeForImageQuality If provided, specifies whether to optimize for image quality in the exported file.
range If provided, specifies the range to export.
to If provided, specifies the ending page number.
useIso19005_1 If provided, specifies whether to use ISO 19005-1 compliance.
DocumentExportAsFixedFormatOptions bitmapMissingFonts If provided, specifies whether to bitmap missing fonts.
createBookmarks If provided, specifies the bookmark creation mode.
documentStructureTags If provided, specifies whether to include document structure tags.
fixedFormatExtensionClassPointer If provided, specifies the extension class pointer.
from If provided, specifies the starting page number.
includeDocProps If provided, specifies whether to include document properties.
item If provided, specifies the item to export.
keepInformationRightsManagement If provided, specifies whether to keep Information Rights Management (IRM) settings.
openAfterExport If provided, specifies whether to open the file after export.
optimizeFor If provided, specifies the optimization target for the export.
range If provided, specifies the range to export.
to If provided, specifies the ending page number.
useIso19005_1 If provided, specifies whether to use ISO 19005-1 compliance.
DocumentFollowHyperlinkOptions addHistory If provided, specifies whether to add the link to the browsing history.
address If provided, specifies the hyperlink address to follow.
extraInfo If provided, specifies additional information to pass with the request.
headerInfo If provided, specifies header information for the HTTP request.
httpMethod If provided, specifies the HTTP method to use for the request.
newWindow If provided, specifies whether to open the link in a new window.
subAddress If provided, specifies the sub-address within the document.
DocumentMergeOptions addToRecentFiles If provided, specifies whether to add the merged document to recent files.
detectFormatChanges If provided, specifies whether to detect format changes during the merge.
mergeTarget If provided, specifies the target of the merge operation.
useFormattingFrom If provided, specifies the source of formatting to use in the merge.
DocumentPrintOutOptions activePrinterMacGX If provided, specifies the printer name.
append If provided, specifies whether to append to an existing file.
background If provided, specifies whether to print in the background.
collate If provided, specifies whether to collate pages.
copies If provided, specifies the number of copies to print.
from If provided, specifies the starting page number.
item If provided, specifies the item to print.
manualDuplexPrint If provided, specifies whether to manually duplex print.
outputFileName If provided, specifies the name of the output file.
pageType If provided, specifies the page order.
pages If provided, specifies specific pages to print.
printToFile If provided, specifies whether to print to file.
printZoomColumn If provided, specifies the zoom column setting.
printZoomPaperHeight If provided, specifies the paper height for printing in twips (20 twips = 1 point; 72 points = 1 inch).
printZoomPaperWidth If provided, specifies the paper width for printing in twips (20 twips = 1 point; 72 points = 1 inch).
printZoomRow If provided, specifies the zoom row setting.
range If provided, specifies the range to print.
to If provided, specifies the ending page number.
DocumentProtectOptions enforceStyleLock If provided, specifies whether to enforce style lock restrictions.
noReset If provided, specifies whether to reset form fields when protecting the document.
password If provided, specifies the password to apply for document protection.
useInformationRightsManagement If provided, specifies whether to use Information Rights Management (IRM).
DocumentRangeOptions end If provided, specifies the ending character position.
start If provided, specifies the starting character position.
DocumentReplyWithChangesOptions includeAttachment If provided, specifies whether to include the document as an attachment.
recipients If provided, specifies the recipients of the reply.
showMessage If provided, specifies whether to show the message before sending.
subject If provided, specifies the subject of the reply email.
DocumentSendFaxOverInternetOptions recipients If provided, specifies the recipients of the fax.
showMessage If provided, specifies whether to show the message before sending.
subject If provided, specifies the subject of the fax.
DocumentSendForReviewOptions includeAttachment If provided, specifies whether to include the document as an attachment.
recipients If provided, specifies the recipients of the review request.
showMessage If provided, specifies whether to show the message before sending.
subject If provided, specifies the subject of the review email.
GoToOptions count If provided, specifies the number of the item in the document.
direction If provided, specifies the direction the range or selection is moved to.
item If provided, specifies the kind of item the range or selection is moved to.
name If provided, specifies the name if the item property is set to Word.GoToItem type bookmark, comment, field, or object.
IndexCollection getItem(index: number) Gets an Index object by its index in the collection.
ListTemplateAddOptions name If provided, specifies the name of the list template to be added.
outlineNumbered If provided, specifies whether to apply outline numbering to the new list template.
ListTemplateCollection add(options?: Word.ListTemplateAddOptions) Adds a new ListTemplate object.
getItem(index: number) Gets a ListTemplate object by its index in the collection.
ListTemplateGalleryCollection getItem(index: number) Gets a ListTemplateGallery object by its index in the collection.
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.
underline Specifies the type of underline applied to the range.
RangeScopedCollection getItem(index: number) Gets a Range object by its index in the collection.
RepeatingSectionContentControl xmlMapping Returns an XmlMapping object that represents the mapping of the content control to XML data in the data store of the document.
ReviewerCollection getItem(index: number) Returns a Reviewer object that represents the specified item in the collection.
RevisionCollection getItem(index: number) Returns a Revision object that represents the specified item in the collection.
Selection convertToTable(options?: Word.SelectionConvertToTableOptions) Converts text within a range to a table.
goTo(options?: Word.GoToOptions) Returns a Range object that represents the area specified by the options and moves the insertion point to the character position immediately preceding the specified item.
SelectionConvertToTableOptions applyBorders If provided, specifies whether to apply borders to the table of the specified format.
applyColor If provided, specifies whether to apply color formatting to the table of the specified format.
applyFirstColumn If provided, specifies whether to apply special formatting to the first column of the specified format.
applyFont If provided, specifies whether to apply font formatting to the table of the specified format.
applyHeadingRows If provided, specifies whether to format the first row as a header row of the specified format.
applyLastColumn If provided, specifies whether to apply special formatting to the last column of the specified format.
applyLastRow If provided, specifies whether to apply special formatting to the last row of the specified format.
applyShading If provided, specifies whether to apply shading to the table of the specified format.
autoFit If provided, specifies whether to automatically resize the table to fit the contents.
autoFitBehavior If provided, specifies the auto-fit behavior for the table.
defaultTableBehavior If provided, specifies whether Microsoft Word automatically resizes cells in a table to fit the contents.
format If provided, specifies a preset format to apply to the table.
initialColumnWidth If provided, specifies the initial width of each column in the table, in points.
numColumns If provided, specifies the number of columns in the table.
numRows If provided, specifies the number of rows in the table.
separator If provided, specifies the character used to separate text into cells.
SourceCollection getItem(index: number) Gets a Source by its index in the collection.
Style description Gets the description of the style.
TabStopCollection getItem(index: number) Gets a TabStop object by its index in the collection.
Window state Specifies the state of the document window or task window.
XmlNode type Gets the type of node.
value Specifies the value of this XML node.
XmlNodeCollection getItem(index: number) Gets a XmlNode object by its index in the collection.

See also