Skip to content

Say what a Word text box held — one written only as a drawing drops its text with no marker and no warning today #222

Closed

Description

@bencode

Problem

markUnconvertedContent puts a visible marker where Mammoth would drop Word content silently: equations, charts, diagrams and bare embedded objects each get one (ui-packages/web/src/formats/docx-unconverted.ts:49-83). A drawing whose payload is a text box gets none — drawingLabel (lines 59-63) recognizes only c:chart and dgm:relIds, so the drawing passes to Mammoth unmarked.

Mammoth 1.12.3 then loses it without a word. readDrawingElement in its lib/docx/body-reader.js reads a drawing only for image blips (a:graphic > a:graphicData > pic:pic > pic:blipFill > a:blip); a wps shape holding w:txbxContent has no pic:pic, so the result is empty — no text, and no warning either, which leaves reportDocxMessages (ui-packages/web/src/formats/docx.ts:10-17) with nothing to report. Every other lost part is either marked in place or issued (#209 headers, #191 footnotes); this one is the silent case.

Word's own floating text boxes survive, because Word writes them as mc:AlternateContent and Mammoth reads the VML mc:Fallback — the insideChoice filter exists for exactly that (docx-unconverted.ts:20-24). The loss hits documents whose text boxes are written only in DrawingML — Pages and Google Docs exports, python-docx-generated reports — where the box carries real content: the amount on an invoice, the date on a certificate, a callout's whole sentence.

Proposal

  • Add 'Text box' to drawingLabel: a drawing that contains wps:txbx is marked in place, like equations and charts.
  • The insideChoice filter already keeps Word's dual-form boxes out, so a bare DrawingML box is the case that receives the marker.

Goal

After this, a .docx whose text boxes arrive only as DrawingML shows "(Text box not converted)" where each one stood, as charts and equations do today; Word's own dual-form boxes stay unmarked, their text still arriving through the VML fallback.

Verification

grep -q "Text box" ui-packages/web/src/formats/docx-unconverted.ts
pnpm --filter -reader/web test --silent -- src/formats/docx-unconverted.test.ts
pnpm check

Refs

Activity

  1. added
    enhancement
    source:scheduled
    on Oct 26, 2026
  2. bencode commented on Oct 26, 2026

    @bencode
    OwnerAuthor

    Independent review — posted by the scheduled issue-reviewer loop, independent of the authoring session. Audited against main@1d515f9 (2026-10-26).

    Evidence audit: every citation holds, anchor-precise.

    • formats/docx-unconverted.ts:59–63 — drawingLabel recognizes exactly c:chart → 'Chart' and dgm:relIds → 'Diagram', returning null for anything else; a wps text-box drawing passes to Mammoth unmarked.
    • Mammoth 1.12.3 confirmed at lib/docx/body-reader.js:586 — readDrawingElement descends only a:graphic > a:graphicData > pic:pic > pic:blipFill > a:blip; a wps shape with w:txbxContent has no pic:pic, so the result is empty and no warning is issued, leaving docx.ts:10–17 reportDocxMessages nothing to report. The silent-loss mechanics are real.
    • insideChoice (:20–24) and the marker helper (:28–36, "(${label} not converted)") confirmed — the Goal's exact "(Text box not converted)" text comes free through the existing helper.

    Duplicates: none in open + closed — #209 (headers/footers), #191 (footnotes) and #45 (closed, the marker system) are different parts of the same honesty family.

    Sensor + Verification block repaired (logged here per policy): lint ✓; verify ✓ passed on unmodified main — a false pass: the block runs the existing docx-unconverted.test.ts and pnpm check, both green with "Text box" absent from the module. Prepended the deliverable-shaped anchor:

    grep -q "Text box" ui-packages/web/src/formats/docx-unconverted.ts

    Re-linted ✓; verify now ✗ on main for the right reason (fails fast).

    Sharpening: the namespaces map (:3–10) has no wps namespace today — the implementation must add the DrawingML wordprocessingShape URI and match contains(drawing, wps, 'txbx'). Keep drawingLabel's match order Chart → Diagram → Text box so a compound drawing (a chart carrying a callout) is still labeled by its dominant payload, and insideChoice already keeps Word's dual-form boxes out, as the Proposal states.

    Verdict: valid — stays open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementsource:scheduled

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions