Skip to main content

Summary

Apply detected DOCX template/substrate (styles, numbering, settings, theme, font table, web settings, headers/footers, section defaults) from a source package onto the current document, preserving body content. Scopes are auto-detected from source package evidence.
  • Operation ID: templates.apply
  • API member path: await editor.doc.templates.apply(...)
  • Mutates document: yes
  • Idempotency: conditional
  • Supports tracked mode: no
  • Supports dry run: yes
  • Returns a promise (must be awaited): yes
  • Deterministic target resolution: yes

Expected result

Returns a TemplatesApplyReceipt with detected/applied/skipped scopes, unsupported items, changed parts, id mappings, and warnings.

Input fields

Example request

Output fields

Variant 1 (success=true)

Variant 2 (success=false)

Example response

Pre-apply throws

  • INVALID_INPUT
  • CAPABILITY_UNAVAILABLE
  • REVISION_MISMATCH

Non-applied failure codes

  • UNSUPPORTED_SOURCE
  • INVALID_PACKAGE
  • CAPABILITY_UNAVAILABLE
  • UNSUPPORTED_TEMPLATE_CONTENT

Raw schemas