# export.toDocx

> Serialize the current document to DOCX bytes under an explicit tracked-change export mode. `review-preserving` (default) keeps open tracked changes as Word revision markup, `final` resolves them as accepted, and `original` resolves them as rejected. Returns the exported bytes plus a structured degradation report of allowed warnings. An invalid mode fails closed with INVALID_INPUT before any work happens.



- Member path: `doc.export.toDocx(…)`
- Mutates document: no
- Idempotency: `idempotent`
- Supports tracked mode: no
- Supports dry run: no

## Expected result

Returns an ExportToDocxResult with the resolved mode, base64 DOCX bytes, byte length, and a report.warnings array.

## Input schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$defs": {},
  "type": "object",
  "properties": {
    "mode": {
      "enum": [
        "review-preserving",
        "final",
        "original"
      ]
    }
  },
  "additionalProperties": false
}
```

## Output schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$defs": {},
  "type": "object",
  "properties": {
    "mode": {
      "enum": [
        "review-preserving",
        "final",
        "original"
      ]
    },
    "byteLength": {
      "type": "integer"
    },
    "contentBase64": {
      "type": "string"
    },
    "report": {
      "type": "object",
      "properties": {
        "warnings": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "feature": {
                "type": "string",
                "enum": [
                  "comments",
                  "trackedChanges"
                ]
              },
              "severity": {
                "const": "warning"
              },
              "affectedObjectId": {
                "type": "string"
              },
              "affectedPartUri": {
                "type": "string"
              },
              "canProceed": {
                "type": "boolean"
              }
            },
            "additionalProperties": false,
            "required": [
              "code",
              "message",
              "feature",
              "severity",
              "canProceed"
            ]
          }
        }
      },
      "additionalProperties": false,
      "required": [
        "warnings"
      ]
    }
  },
  "additionalProperties": false,
  "required": [
    "mode",
    "byteLength",
    "contentBase64",
    "report"
  ]
}
```

## Pre-apply throws

- `INVALID_INPUT`
- `CAPABILITY_UNSUPPORTED`

## Non-applied receipt codes

- None

