Skip to content

feat(documents): legacy .doc viewer (Word 97-2003) - #265

Merged
slaveofcode merged 1 commit into
developfrom
feat/doc-viewer
Aug 17, 2026
Merged

feat(documents): legacy .doc viewer (Word 97-2003)#265
slaveofcode merged 1 commit into
developfrom
feat/doc-viewer

Conversation

@slaveofcode

Copy link
Copy Markdown
Owner

Adds the Legacy .doc Viewer to the Documents category (/tools/doc-viewer) — the one item I'd previously deferred.

  • Opens old binary .doc files (pre-2007) and extracts their text in the browser, no Word needed.
  • cfb.lib.ts — a minimal OLE2/Compound-File reader that reassembles named streams from the FAT/mini-FAT sector chains.
  • doc.lib.ts — walks the Word piece table (located by scanning the table stream, which avoids the fragile version-specific FIB field offset) and decodes each piece as CP1252 or UTF-16LE, with an fcMin direct-read fallback. Handles paragraph/cell marks and strips field/anchor control chars.
  • Best-effort, text only — formatting/tables/images not preserved, clearly labeled in-UI and in the FAQ; suggests re-saving as .docx for odd files.
  • Pure libs unit-tested (6 tests: CP1252 map, piece-table scan, text cleanup). Fully client-side.

Verify: 1328 tests green, lint 0 errors, build OK; both /tools/doc-viewer/ locales built and listed on the Documents hub.

Open old binary .doc files and extract their text in the browser: a
minimal OLE2/CFB compound-file reader (cfb.lib.ts) reassembles the
WordDocument + table streams, then doc.lib.ts walks the Word piece table
(found by scanning the table stream, avoiding version-specific FIB
offsets) and decodes CP1252/UTF-16LE pieces, with an fcMin fallback.
Best-effort text only — labeled as such. Pure libs unit-tested. EN + ID SEO.
@slaveofcode
slaveofcode merged commit 082e856 into develop Aug 17, 2026
1 check passed
@slaveofcode
slaveofcode deleted the feat/doc-viewer branch August 17, 2026 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant