Access via:
io.wordAPIinterface
Word API.
Properties (2)
| Property | Type | Default | Required | Description |
|---|---|---|---|---|
| addinStatus⚓︎ | boolean | x | Flag indicating the status of the Word Adapter.
If |
|
| all⚓︎ | Document[] | x | Retrieves all documents opened by the current app in Word. |
3 Methods
onAddinStatusChanged()⚓︎
(callback: (args: { connected: boolean }) => void) => UnsubscribeFunction
Notifies when the Word Adapter status has changed.
Parameters (1)
| Name | Type | Required | Description |
|---|---|---|---|
| callback⚓︎ | (args: { connected: boolean }) => void | Callback function for handling the event.
Receives as an argument an object with a |
Example
office.word.onAddinStatusChanged(({ connected }) => {
if (connected) {
console.log("The Word Adapter is available.");
} else {
console.log("The Word Adapter is unavailable.");
}
});
openDocument()⚓︎
(config: OpenDocumentConfig) => Promise<Document>
Opens a document in Word.
Parameters (1)
| Name | Type | Required | Description |
|---|---|---|---|
| config⚓︎ | OpenDocumentConfig | Configuration for opening the Word document. |
Example
const options = {
name: "MyFirstDocument",
data: "<html><h1>Hello world!</h1></html>",
isDocx: false,
};
const myDoc = await office.word.openDocument(options);
console.log(myDoc);