export.toDocx
Serialize a copy of the current document with independent policies for trackedChanges (review-preserving, final, original), comments (preserve, resolve, remove), and contentControls (preserve, flatten). Defaults preserve all three. Resolve closes every open comment thread in the copy. The mode alias selects trackedChanges; conflicting values and unknown policies reject with INVALID_INPUT. Unsupported revision semantics, loss of preserved comment anchors, and collaborative Document API export reject with CAPABILITY_UNSUPPORTED before returning bytes. Use browser export for collaborative sessions. Returns exported bytes and a structured report of allowed warnings without changing the live document.
doc.export.toDocx(…)Expected result
Returns an ExportToDocxResult with the resolved mode, base64 DOCX bytes, byte length, and a report.warnings array.
Inputs
mode"review-preserving" | "final" | "original"policiesobjectFields
trackedChanges"review-preserving" | "final" | "original"comments"preserve" | "resolve" | "remove"contentControls"preserve" | "flatten"Result
Output fields
mode"review-preserving" | "final" | "original"requiredbyteLengthintegerrequiredcontentBase64stringrequiredreportobjectrequiredFields
warningsobject[]requiredFailures
Pre-apply throws
INVALID_INPUTCAPABILITY_UNSUPPORTED
Raw schemas
Open the generated JSON artifact for the exact input, output, success, and failure schemas represented by this contract version.
View raw JSON schemas