Skip to content

Repository files navigation

DocReader

A browser-based viewer for .docx and .xlsx files. Everything runs client-side — uploaded files are parsed and rendered entirely in the browser and never leave your machine.

Features

  • Create new Word documents from a blank page or a starter template (letter, report, meeting notes)
  • Edit .docx documents with a full formatting toolbar, autosaved as you type
  • Drag-and-drop or click-to-browse upload for .docx and .xlsx files
  • Export to .docx or PDF, and rename documents in place
  • Find within a document (Ctrl+F), with keyboard shortcuts throughout
  • Browser-tab-style interface for multiple open documents
  • Resizable sidebar (document outline for Word docs, sheet list for Excel workbooks) and main viewer
  • Side-by-side compare mode for two open documents
  • Light/dark theme, persisted across sessions

Getting started

npm install
npm run dev

Building for production

npm run build
npm run preview

Testing

npm test

Regression tests (Vitest + jsdom) cover the pure logic layer — documentsReducer, fileRouter, the parseDocx/parseXlsx parsers (including that the DOMPurify allowlist actually strips unsafe docx HTML), document templates and in-document find — plus a small React Testing Library layer for the tab bar and empty state.

Keyboard shortcuts

Shortcut Action
Alt+N New document
Ctrl+O Open file
Ctrl+S Download DOCX
Ctrl+P Export PDF
Ctrl+F Find in document
Ctrl+E Toggle editing
F2 Rename document
Alt+W Close tab
Alt+19 Switch tab

New document, close tab and switch tab use Alt rather than Ctrl because browsers reserve Ctrl+N, Ctrl+W and Ctrl+Tab for themselves — a web page never receives them.

Notes

  • xlsx (SheetJS) is installed at the last version published to the npm registry (0.18.5), which has known advisories (prototype pollution, ReDoS) with no npm-registry fix available — SheetJS only publishes patched builds via their own CDN (cdn.sheetjs.com), which this environment's npm config blocks installing from directly. Since parsing is entirely client-side and single-user (a malicious .xlsx can only affect the browser tab of whoever opens it), this is an accepted risk for now. To pick up the patched build, run npm install https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz from an environment that allows remote tarball installs.

About

A browser-based viewer for `.docx` and `.xlsx` files. Everything runs client-side — uploaded files are parsed and rendered entirely in the browser and never leave your machine.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages