Adeu icon

Adeu

Operate on Microsoft Word (.docx) files: extract LLM-friendly Markdown with CriticMarkup, navigate large documents via a structural outline, apply tracked changes and comments, generate sub-word diffs or one-step redline comparisons, and sanitize/finalize documents. Seven operations on the Document resource: (1) Extract Markdown — project a .docx into Markdown plus a Semantic Appendix (or a Fields Content Controls ledger in mode='fields'); toggle Clean View to simulate Accept All; pass an optional Page number or 'N-M' page range to fetch a slice of a large document. (2) Extract Outline — return a token-cheap structural map (headings with level, page number, end_page, paragraph style, has_table, footnote IDs) plus total_pages. Pair with Extract Markdown to navigate large documents. (3) Apply Edits — apply a JSON array of DocumentChange objects sequentially as native Word tracked changes (or manual strikethrough/underline formatting when Markup Mode is 'manual'); modify edits support match_mode ('strict'|'first'|'all'), regex (boolean), Markdown headings/bold/italic/'\n\n' splits/pipe tables, `{#cell:<id>}` empty-cell anchors, and single or multi-author comments; set_field fills content controls by CC:<N>, tag, or alias. (4) Apply Text Revision — hand back the COMPLETE revised clean text of the document and let the engine diff it against the clean view and write the tracked changes; it refuses CriticMarkup and partial-page text, and fails without returning a document when the applied result's clean text does not match the text supplied. (5) Generate Diff — produce a @@ Word Patch @@ sub-word diff, unified diff, structured DocumentChange JSON array, or a one-step redlined .docx comparison (`diffFormat='redlineDocx'`) between two .docx files. (6) Finalize Document — strip metadata, optionally accept all pending markup, and optionally lock the file read-only. (7) Hydrate Tool Output — re-attach a redlined .docx that Apply Edits, Apply Text Revision, or Generate Diff (`redlineDocx`) stashed while running as an AI Agent tool; place it on the main line downstream of the Agent, because n8n's tool wrapper strips binaries from tool output. DocumentChange schema (used by Apply Edits): each object has a 'type' field discriminator, and changes in a batch evaluate SEQUENTIALLY against the state produced by prior changes. type='modify' requires target_text (string — plain text resolves across hyperlinks, cross-references, and bookmarks; empty table cells emit `{#cell:<id>}`) and new_text (string — supports '#'–'######' headings, '**bold**', '_italic_', '\n\n' paragraph splits, and Markdown pipe tables `| H1 | H2 |\n|---|---|\n| A | B |`; omit new_text with a comment to annotate without changing text; empty string deletes); optional comment (string or `[{text, author?}]`); optional match_mode ('strict'|'first'|'all', default 'strict'); optional regex (boolean, default false — when true, target_text is an ES2022 RegExp pattern with optional inline flags like `(?i)`, and new_text may reference $1, $2 capture groups). type='set_field' requires field (string like 'CC:3', tag, or alias from Extract Markdown mode='fields') and value (string — checkboxes take true/false, dates YYYY-MM-DD, dropdowns a listed option); optional match_mode and comment. type='accept' or type='reject' requires target_id (string like 'Chg:12' from the Markdown projection); optional part (e.g. 'word/header1.xml' when the same id exists in several parts); optional comment. type='reply' requires target_id (string like 'Com:45') and text (string). type='insert_row' requires target_text (string), position ('above' or 'below'), and cells (array of strings). type='delete_row' requires target_text (string). Never wrap new_text in CriticMarkup tags like {++ ++} or {-- --}; the engine applies tracking automatically. Never target text already wrapped in another author's pending tracked change; accept or reject their change first by target_id. Binary handling for AI Agents: this tool cannot receive .docx files through JSON arguments because JSON cannot carry binary data. To process a document, set 'Document Source' to 'From Another Node' and 'Source Node Name' to the exact name of the workflow node that produced the .docx binary (typically the trigger node, e.g. 'Gmail Trigger', 'When clicking Test workflow', or an HTTP Request node configured to download a file). Node names are case-sensitive and must match the canvas label exactly. For the Generate Diff operation, set both 'Original Source Node Name' and 'Modified Source Node Name' independently.

Document → Apply Edits

AI-generated

Summary

Apply tracked edits to a DOCX file using a batch of document changes, then return the redlined file and optionally its Markdown projection.

Inputs

  • Document source (required) — Read the DOCX binary from the current input item, or name an upstream node and binary property. An optional source binary ID can select a stored document instead of the node’s baseline binary.
  • Input binary property (required) — Binary property containing the DOCX; defaults to data.
  • Output binary property (required) — Binary property for the redlined DOCX; defaults to data and overwrites the input property on the outgoing item when the names match.
  • Reasoning — Optional rationale captured for auditability; it is not sent to the edit engine.
  • Edits source (required) — Read changes from the node’s Changes (JSON) field, or from a dot-notation path in the input item’s JSON (defaults to changes).
  • Changes (JSON) (required) — An array of document changes: modify text, accept or reject tracked changes, reply to comments, or insert or delete table rows. Modify edits specify exact target text and replacement text, with optional comment, match mode, and regex; accept/reject edits use a revision ID, and replies use a comment ID and text. Row edits use target text as an anchor. Under the default atomic behavior, one invalid edit rejects the whole batch and leaves the document untouched.
  • Author — Name attached to tracked changes and comments; defaults to Adeu AI.
  • Return Markdown output — Defaults to true; includes the post-edit Markdown projection in the outgoing JSON.
  • Allow partial application — Defaults to false. When enabled, applies valid edits and reports failures with their input indexes; output status is partial if any fail.
  • Ignore content control locks — Defaults to false; permits edits inside locked or grouped content controls.
  • Ignore document protection — Defaults to false; permits edits despite enforced document editing protection.
  • Allow untracked writes — Defaults to false; permits writes in fill-in-forms-protected documents where Word does not record tracked changes. Such writes are flagged.

Output shape

One outgoing item containing the redlined DOCX in the configured binary property, plus JSON metadata and optionally a Markdown projection.

When partial application is enabled, the output reports status partial and lists failed edits with their zero-based indexes. Otherwise, batch validation is atomic: any invalid edit leaves the document untouched.

Links

Discussion