You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/develop/office-javascript-api-object-model.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -125,7 +125,7 @@ The [CustomXmlParts](/javascript/api/office/office.customxmlparts) and [CustomXm
125
125
126
126
**Applies to:** Task pane add-ins for Word and PowerPoint
127
127
128
-
The [Document.getFileAsync](/javascript/api/office/office.document#office-office-document-getfileasync-member(1)) method and members of the [File](/javascript/api/office/office.file) and [Slice](/javascript/api/office/office.slice) objects to provide functionality for getting entire Word and PowerPoint document files in slices (chunks) of up to 4 MB at a time. For more information, see [Get the whole document from an add-in for PowerPoint or Word](../word/get-the-whole-document-from-an-add-in-for-word.md).
128
+
The [Document.getFileAsync](/javascript/api/office/office.document#office-office-document-getfileasync-member(1)) method and members of the [File](/javascript/api/office/office.file) and [Slice](/javascript/api/office/office.slice) objects to provide functionality for getting entire Word and PowerPoint document files in slices (chunks) of up to 4 MB at a time. For more information, see [Get the whole document from an add-in for PowerPoint or Word](../develop/get-the-whole-document-from-an-add-in-for-powerpoint-or-word.md).
Copy file name to clipboardExpand all lines: docs/develop/support-for-task-pane-and-content-add-ins.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,7 +90,7 @@ If your task pane add-in runs in PowerPoint or Word, you can use the [Document.g
90
90
91
91
When you call `Document.getFileAsync` you get a copy of the document in a [File](/javascript/api/office/office.file) object. The `File` object provides access to the document in "chunks" represented as [Slice](/javascript/api/office/office.slice) objects. When you call `getFileAsync`, you can specify the file type (text or compressed Open Office XML format), and size of the slices (up to 4MB). To access the contents of the `File` object, you then call `File.getSliceAsync` which returns the raw data in the [Slice.data](/javascript/api/office/office.slice#office-office-slice-data-member) property. If you specified compressed format, you will get the file data as a byte array. If you are transmitting the file to a web service, you can transform the compressed raw data to a Base64-encoded string before submission. Finally, when you are finished getting slices of the file, use the `File.closeAsync` method to close the document.
92
92
93
-
For more details, see how to [get the whole document from an add-in for PowerPoint or Word](../word/get-the-whole-document-from-an-add-in-for-word.md).
93
+
For more details, see how to [get the whole document from an add-in for PowerPoint or Word](../develop/get-the-whole-document-from-an-add-in-for-powerpoint-or-word.md).
94
94
95
95
## Read and write custom XML parts of a Word document
Copy file name to clipboardExpand all lines: docs/reference/overview/powerpoint-add-ins-reference-overview.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: JavaScript API for PowerPoint
3
3
description: Overview of the PowerPoint JavaScript API.
4
-
ms.date: 07/05/2019
4
+
ms.date: 05/29/2025
5
5
ms.service: powerpoint
6
6
ms.localizationpriority: high
7
7
---
@@ -10,20 +10,20 @@ ms.localizationpriority: high
10
10
11
11
A PowerPoint add-in interacts with objects in PowerPoint by using the Office JavaScript API, which includes two JavaScript object models:
12
12
13
-
***PowerPoint JavaScript API**: The [PowerPoint JavaScript API](/javascript/api/powerpoint) provides strongly-typed objects that you can use to access objects in PowerPoint.
13
+
-**PowerPoint JavaScript API**: The [PowerPoint JavaScript API](/javascript/api/powerpoint) provides strongly-typed objects that you can use to access objects in PowerPoint. To learn about the asynchronous nature of the PowerPoint JavaScript APIs and how they work with the presentation, see [Using the application-specific API model](../../develop/application-specific-api-model.md).
14
14
15
-
***Common APIs**: Introduced with Office 2013, the [Common API](/javascript/api/office) can be used to access features such as UI, dialogs, and client settings that are common across multiple types of Office applications.
15
+
-**Common APIs**: The [Common API](/javascript/api/office) can be used to access features such as UI, dialogs, and client settings that are common across multiple Office applications. To learn more about using the Common API, see [Common JavaScript API object model](../../develop/office-javascript-api-object-model.md).
16
16
17
17
## Learn programming concepts
18
18
19
19
See [PowerPoint add-ins overview](../../powerpoint/powerpoint-add-ins.md) for information about important programming concepts.
20
20
21
21
## Learn about API capabilities
22
22
23
-
For hands-on experience using the Common API to interact with content in PowerPoint, complete the [PowerPoint add-in tutorial](../../tutorials/powerpoint-tutorial-yo.md).
24
-
25
23
For detailed information about the PowerPoint JavaScript API object model, see the [PowerPoint JavaScript API reference documentation](/javascript/api/powerpoint).
26
24
25
+
For hands-on experience interacting with content in PowerPoint, complete the [PowerPoint add-in tutorial](../../tutorials/powerpoint-tutorial-yo.md).
26
+
27
27
## Try out code samples in Script Lab
28
28
29
29
Use [Script Lab](../../overview/explore-with-script-lab.md) to get started quickly with a collection of built-in samples that show how to complete tasks with the API. You can run the samples in Script Lab to instantly see the result in the task pane or document, examine the samples to learn how the API works, and even use samples to prototype your own add-in.
Copy file name to clipboardExpand all lines: docs/reference/overview/word-add-ins-reference-overview.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Word JavaScript API overview
3
3
description: Overview of the Word JavaScript API.
4
-
ms.date: 02/24/2023
4
+
ms.date: 05/29/2025
5
5
ms.topic: concept-article
6
6
ms.service: word
7
7
ms.localizationpriority: high
@@ -13,7 +13,7 @@ A Word add-in interacts with objects in Word by using the Office JavaScript API,
13
13
14
14
***Word JavaScript API**: These are the [application-specific APIs](../../develop/application-specific-api-model.md) for Word. Introduced with Office 2016, the [Word JavaScript API](/javascript/api/word) provides strongly-typed objects that you can use to access objects and metadata in a Word document.
15
15
16
-
***Common APIs**: Introduced with Office 2013, the [Common API](/javascript/api/office)can be used to access features such as UI, dialogs, and client settings that are common across multiple types of Office applications.
16
+
***Common APIs**: The [Common API](/javascript/api/office), introduced with Office 2013, can be used to access features such as UI, dialogs, and client settings that are common across multiple Office applications.
17
17
18
18
This section of the documentation focuses on the Word JavaScript API, which you'll use to develop the majority of functionality in add-ins that target Word on the web, or Word 2016 and later. For information about the Common API, see [Common JavaScript API object model](../../develop/office-javascript-api-object-model.md).
19
19
@@ -23,7 +23,7 @@ See [Word JavaScript object model in Office Add-ins](../../word/word-add-ins-cor
23
23
24
24
## Learn about API capabilities
25
25
26
-
Use other articles in this section of the documentation to learn how to [get the whole document from an add-in](../../word/get-the-whole-document-from-an-add-in-for-word.md), [use search options in your Word add-in to find text](../../word/search-option-guidance.md), and more. See the table of contents for the complete list of available articles.
26
+
Use other articles in this section of the documentation to learn how to [get the whole document from an add-in](../../develop/get-the-whole-document-from-an-add-in-for-powerpoint-or-word.md), [use search options in your Word add-in to find text](../../word/search-option-guidance.md), and more. See the table of contents for the complete list of available articles.
27
27
28
28
For hands-on experience using the Word JavaScript API to access objects in Word, complete the [Word add-in tutorial](../../tutorials/word-tutorial.md).
Copy file name to clipboardExpand all lines: docs/word/word-add-ins-core-concepts.md
+14-13Lines changed: 14 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Word JavaScript object model in Office Add-ins
3
3
description: Learn about the key components in the Word-specific JavaScript object model.
4
-
ms.date: 02/24/2023
4
+
ms.date: 05/29/2025
5
5
ms.topic: concept-article
6
6
ms.localizationpriority: high
7
7
---
@@ -10,33 +10,34 @@ ms.localizationpriority: high
10
10
11
11
This article describes concepts that are fundamental to using the [Word JavaScript API](../reference/overview/word-add-ins-reference-overview.md) to build add-ins.
12
12
13
-
> [!IMPORTANT]
14
-
> See [Using the application-specific API model](../develop/application-specific-api-model.md) to learn about the asynchronous nature of the Word APIs and how they work with the document.
15
-
16
13
## Office.js APIs for Word
17
14
18
15
A Word add-in interacts with objects in Word by using the Office JavaScript API. This includes two JavaScript object models:
19
16
20
-
***Word JavaScript API**: The [Word JavaScript API](/javascript/api/word) provides strongly-typed objects that work with the document, ranges, tables, lists, formatting, and more.
17
+
***Word JavaScript API**: The [Word JavaScript API](/javascript/api/word) provides strongly-typed objects that work with the document, ranges, tables, lists, formatting, and more. To learn about the asynchronous nature of the Word APIs and how they work with the document, see [Using the application-specific API model](../develop/application-specific-api-model.md).
21
18
22
-
***Common APIs**: The [Common API](/javascript/api/office) give access to features such as UI, dialogs, and client settings that are common across multiple Office applications.
19
+
***Common APIs**: The [Common API](/javascript/api/office) give access to features such as UI, dialogs, and client settings that are common across multiple Office applications. To learn more about using the Common API, see [Common JavaScript API object model](../develop/office-javascript-api-object-model.md).
23
20
24
21
While you'll likely use the Word JavaScript API to develop the majority of functionality in add-ins that target Word, you'll also use objects in the Common API. For example:
25
22
26
23
*[Office.Context](/javascript/api/office/office.context): The `Context` object represents the runtime environment of the add-in and provides access to key objects of the API. It consists of document configuration details such as `contentLanguage` and `officeTheme` and also provides information about the add-in's runtime environment such as `host` and `platform`. Additionally, it provides the `requirements.isSetSupported()` method, which you can use to check whether a specified requirement set is supported by the Word application where the add-in is running.
27
24
*[Office.Document](/javascript/api/office/office.document): The `Office.Document` object provides the `getFileAsync()` method, which you can use to download the Word file where the add-in is running. This is separate from the [Word.Document](/javascript/api/word/word.document) object.
28
25
29
-

26
+
:::image type="content" source="../images/word-js-api-common-api.png" alt-text="Differences between the Word JS API and Common APIs.":::
30
27
31
28
## Word-specific object model
32
29
33
-
To understand the Word APIs, you must understand how the components of a document are related to one another.
30
+
To understand the Word APIs, you must understand how key components of a document are related to one another.
31
+
32
+
* The document contains sections, pages, and document-level entities such as settings and custom XML parts.
33
+
* A section contains a body.
34
+
* A body has paragraphs, content controls, and range objects, among others.
35
+
* A range is a contiguous area of content, including text, whitespace, tables, and images. The [Word.Range](/javascript/api/word/word.range) object contains most of the text manipulation methods.
36
+
* A list contains numbered or bulleted paragraphs.
37
+
* The document is contained in a window.
38
+
* A window has panes. A pane surrounds the visible area of the document.
34
39
35
-
* The **Document** contains the **Section**s, and document-level entities such as settings and custom XML parts.
36
-
* A **Section** contains a **Body**.
37
-
* A **Body** gives access to **Paragraph**s, **ContentControl**s, and **Range** objects, among others.
38
-
* A **Range** represents a contiguous area of content, including text, white space, **Table**s, and images. It also contains most of the text manipulation methods.
39
-
* A **List** represents text in a numbered or bulleted list.
40
+
For the full set of objects supported by the Word JavaScript API, see [Word JavaScript API](/javascript/api/word).
paragraphs.items[0].insertText(' New sentence in the paragraph.',
35
36
Word.InsertLocation.end);
36
37
awaitcontext.sync();
37
38
});
38
-
39
39
```
40
40
41
-
You can use any web server technology to host your Word add-in, such as ASP.NET, NodeJS, or Python. Use your favorite client-side framework—Ember, Backbone, Angular, React—or stick with plain JavaScript to develop your solution. You can also use services like Azure to [authenticate](../develop/overview-authn-authz.md) and host your application.
41
+
You can use any web server technology to host your Word add-in, such as ASP.NET, NodeJS, or Python. Use your favorite client-side framework—Ember, Backbone, Angular, React—or stick with plain JavaScript to develop your solution. You can also use services like Microsoft Entra and Microsoft Azure to [authenticate](../develop/overview-authn-authz.md) and host your application respectively.
42
42
43
43
The Word JavaScript APIs give your application access to the objects and metadata found in a Word document. You can use these APIs to create add-ins that target the following clients.
44
44
@@ -51,11 +51,13 @@ Write your add-in once, and it will run in all supported versions of Word across
51
51
52
52
## JavaScript APIs for Word
53
53
54
-
You can use two sets of JavaScript APIs to interact with the objects and metadata in a Word document. The first is the [Common API](/javascript/api/office), which was introduced in Office 2013. Many of the objects in the Common API can be used in add-ins hosted by two or more Office clients. This API uses callbacks extensively.
54
+
You can use two sets of JavaScript APIs to interact with the objects and metadata in a Word document.
55
+
56
+
The first is the [Word JavaScript API](/javascript/api/word). This is an [application-specific API model](../develop/application-specific-api-model.md) that was introduced with Word 2016. It's a strongly-typed object model that you can use to create Word add-ins that target Word 2016 and later on Windows and on Mac. This object model uses promises and provides access to Word-specific objects like [body](/javascript/api/word/word.body), [content controls](/javascript/api/word/word.contentcontrol), [inline pictures](/javascript/api/word/word.inlinepicture), and [paragraphs](/javascript/api/word/word.paragraph). The Word JavaScript API includes TypeScript definitions and vsdoc files so that you can get code hints in your IDE.
55
57
56
-
The second is the [Word JavaScript API](/javascript/api/word). This is an [application-specific API model](../develop/application-specific-api-model.md) that was introduced with Word 2016. It's a strongly-typed object model that you can use to create Word add-ins that target Word 2016 and later on Windows and on Mac. This object model uses promises and provides access to Word-specific objects like [body](/javascript/api/word/word.body), [content controls](/javascript/api/word/word.contentcontrol), [inline pictures](/javascript/api/word/word.inlinepicture), and [paragraphs](/javascript/api/word/word.paragraph). The Word JavaScript API includes TypeScript definitions and vsdoc files so that you can get code hints in your IDE.
58
+
The second is the [Common API](/javascript/api/office), which was introduced in Office 2013. Many of the objects in the Common API can be used in add-ins hosted by two or more Office clients. This API uses callbacks extensively.
57
59
58
-
Currently, all Word clients support the shared Office JavaScript API, and most clients support the Word JavaScript API. For details about supported clients, see [Office client application and platform availability for Office Add-ins](/javascript/api/requirement-sets).
60
+
Currently, all Word clients support Word JavaScript API and the shared Office JavaScript API. For details about supported clients, see [Office client application and platform availability for Office Add-ins](/javascript/api/requirement-sets).
59
61
60
62
We recommend that you start with the Word JavaScript API because the object model is easier to use. Use the Word JavaScript API if you need to access the objects in a Word document.
0 commit comments