# API

**Kind**: interface | **Module**: [Word](https://docs.interop.io/adapters/reference/javascript/word/index.md) | **Access**: `io.word`

**Source**: https://docs.interop.io/adapters/reference/javascript/word/api/index.html

Word API.

## Properties

- **`addinStatus`** (`boolean`, required)
  Flag indicating the status of the Word Adapter.
  If `true`, the Word Adapter is available and you can use the Word API.
- **`all`** (`Document[]`, required)
  Retrieves all documents opened by the current app in Word.

## Methods

### onAddinStatusChanged

Notifies when the Word Adapter status has changed.

```ts
(callback: (args: { connected: boolean }) => void) => UnsubscribeFunction
```

**Parameters**

- **`callback`** (`(args: { connected: boolean }) => void`, required)
  Callback function for handling the event.
  Receives as an argument an object with a `connected` Boolean property indicating the status of the Word Adapter.
  The callback will be invoked immediately with the current status of the Word Adapter on subscribe.

**Returns**: `UnsubscribeFunction`

**Example**

```ts
```javascript
office.word.onAddinStatusChanged(({ connected }) => {
    if (connected) {
        console.log("The Word Adapter is available.");
    } else {
        console.log("The Word Adapter is unavailable.");
    }
});
```
```

### openDocument

Opens a document in Word.

```ts
(config: OpenDocumentConfig) => Promise<Document>
```

**Parameters**

- **`config`** (`OpenDocumentConfig`, required)
  Configuration for opening the Word document.

**Returns**: `Promise<Document>`

**Example**

```ts
```javascript
const options = {
    name: "MyFirstDocument",
    data: "<html><h1>Hello world!</h1></html>",
    isDocx: false
};

const myDoc = await office.word.openDocument(options);
console.log(myDoc);
```
```

### ready

Resolves with the Word API object.

```ts
() => Promise<object>
```

**Returns**: `Promise<object>`

## Related types

- [Document](https://docs.interop.io/adapters/reference/javascript/word/document/index.md)
- [OpenDocumentConfig](https://docs.interop.io/adapters/reference/javascript/word/opendocumentconfig/index.md)
