---
title: "Export custom styles to .docx"
description: "Learn how to export custom styles from Tiptap JSON to DOCX in our documentation."
canonical_url: "https://tiptap.dev/docs/conversion/export/docx/styles"
---

# Export custom styles to .docx

Learn how to export custom styles from Tiptap JSON to DOCX in our documentation.

- **1. Activate trial or subscribe**

  Start a [free trial](https://cloud.tiptap.dev/v2?trial=true) or [subscribe to the Start
  plan](https://cloud.tiptap.dev/v2/billing) in your account.
- **2. Install from private registry**

  To install this frontend extensions, authenticate to Tiptap's private npm registry by following
  the [setup guide](https://tiptap.dev/docs/guides/pro-extensions.md).

When exporting to `DOCX`, you can define custom styles that will be applied to the exported document. This is useful when you want to have a consistent look and feel across your documents.

## Per-node overrides with a function

Every element override — `paragraphOverrides`, `textRunOverrides`, `tableOverrides`, `tableRowOverrides`, `tableCellOverrides`, and `imageOverrides` — accepts a function in addition to a static object. The function receives the node currently being converted and returns the overrides for that node, so you can vary overrides per node based on its attributes. The object form keeps working unchanged, so this is a drop-in addition.

```ts
ExportDocx.configure({
  onCompleteExport: (result) => {
    /* ... */
  },
  // `node` is the image node currently being converted, including its `attrs`.
  imageOverrides: (node) => ({
    // Carry the editor's alt text into Word's accessibility metadata.
    altText: { name: node.attrs?.alt, description: node.attrs?.alt },
    // Derive the rendered size from the dimensions set on the node.
    transformation: {
      width: Number(node.attrs?.width),
      height: Number(node.attrs?.height),
    },
  }),
  // The function receives the matching node for every override type.
  paragraphOverrides: (node) => ({
    keepNext: node.attrs?.keepWithNext === true,
  }),
})
```

The value returned by the function is applied exactly like the static object — with the same precedence as the object form of that override. Returning an empty object leaves every default in place for that node.

> **Function form is DOCX-only:**
>
> The function form of the element overrides is supported by the DOCX export. Other export formats
> accept the static object form.
