# Document

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

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

Represents a Word document opened by the app in Word.

## Properties

- **`data`** (`string`, required)
  The content of the document in HTML format.
- **`name`** (`string`, required)
  Name of the Word document.

## Methods

### getHtml

Retrieves the HTML content of the Word document.

```ts
(callback: (html?: string) => void) => Promise<string>
```

**Parameters**

- **`callback`** (`(html?: string) => void`, required)
  Callback for handling the HTML content of the Word document.

**Returns**: `Promise<string>`

### onChanged

Notifies when the document has been modified in Word. Returns an unsubscribe function.

```ts
(callback: (html: string, docx?: string) => void) => UnsubscribeFunction
```

**Parameters**

- **`callback`** (`(html: string, docx?: string) => void`, required)
  Callback function for handling the event. Receives as arguments the content of the document as HTML and as DOCX.
  The DOCX content is represented as a Base64 string.

**Returns**: `UnsubscribeFunction`

### onClose

Notifies when the document is closed in Word. Returns an unsubscribe function.

```ts
(callback: () => void) => UnsubscribeFunction
```

**Parameters**

- **`callback`** (`() => void`, required)
  Callback function for handling the event.

**Returns**: `UnsubscribeFunction`
