DOCX Viewer, Word Viewer & DOCX Preview (Dark Mode)

DOCX Viewer, Word Viewer & DOCX Preview (Dark Mode), a VS Code extension by Zovo

For developers who get specs, contracts and reports as Word files, DOCX Viewer opens .docx, .odt and old .doc files in VS Code as a dark-mode preview with an outline, search, tables, charts and equations.

Install in VS CodeOpen the Marketplace page

Free, MIT license. Needs VS Code 1.90.0 or newer. Extension ID zovo.docx-viewer-vscode, version 0.3.0.

A Word report open in VS Code in dark mode, with the heading outline on the left and a search for revenue on match 1 of 6

A real VS Code 1.142 window running this extension on test/fixtures/sample.docx, a generated 2 page field report with a table and a chart.

Quick start

  1. Install DOCX Viewer.
  2. Click any .docx or .dotx file in the Explorer. It opens as a read-only preview. Press Ctrl+F (Cmd+F on macOS) to search.
A click on the .docx file opens it. Typing revenue marks 6 matches and Enter steps through them, a click on Installations in the outline jumps to that heading, and the theme button switches to white paper

Recorded in the same window. The white arrow is drawn in to show where each click lands.

No .docx at hand? Run "DOCX Viewer: Open Sample Document" from the Command Palette.

Questions people ask

Is DOCX Viewer, Word Viewer & DOCX Preview (Dark Mode) free?

Yes. DOCX Viewer, Word Viewer & DOCX Preview (Dark Mode) is free and MIT licensed.

How do I install DOCX Viewer, Word Viewer & DOCX Preview (Dark Mode)?

Click "Install in VS Code" above, or search for zovo.docx-viewer-vscode in the Extensions view.

What it shows

Headings, paragraphs, bold, italic, underline and strikethrough. Bulleted and numbered lists, including nested ones. Tables with merged cells. Images inline (PNG, JPEG, GIF, BMP and WebP). Equations and charts (see below). Figure and table numbers. Footnotes and endnotes, with links between the reference and the note. Hyperlinks, which open in your browser.

It reads .docx, .dotx (templates) and .docm files, and OpenDocument text files (.odt and .ott templates) from LibreOffice, Google Docs downloads and pandoc. Macros in .docm files never run. The viewer only reads the text and images.

Old Word 97-2003 .doc and .dot files open as text. You get the paragraphs, simple tables, and the headers, footers, footnotes, comments and text boxes in their own sections. A grey bar says that formatting, images and layout are not shown, with a button to open the file in your default app. Search, Copy as Markdown, Open as Text and both compare commands work on them. An old .doc file renamed to .docx or .docm opens the same way. Many websites publish RTF files with a .doc name; those open as text too, with their tables. A password-protected file gets a short message that says so, and so does an HTML file saved with a .doc name.

The same report on white paper while VS Code stays dark, showing the revenue table and the installed capacity chart
The report in a light VS Code theme with a search for "region", on match 4 of 8
An old Word 97-2003 .doc file shown as text, with the grey text-only bar and its table

Equations and charts

Word equations show as real math in Reading view: fractions, roots, sub- and superscripts, sums and integrals with limits, brackets, matrices and equation arrays. Copy as Markdown and Open as Text write them as one line of text, such as x=(-b±√(b^2-4ac))/(2a).

Charts are drawn again from the numbers Word saves inside the file, so you see them without Excel: column, bar, line, area, pie, doughnut and scatter charts, with the title, the legend and a value on hover. "Chart data" under each chart opens its table, and Copy as Markdown copies that table.

An engineering note in Reading view with the Darcy-Weisbach equation and a column chart of pump flow, drawn from the values in the .docx

Page view

Click "Page view" in the toolbar to see the document the way Word lays it out. You get the page size and margins, portrait and landscape pages, headers and footers, fonts, colors, highlights, table borders and shading, and footnotes. "Reading view" switches back. VS Code keeps your choice for the workspace, and docxViewer.defaultView sets it for new ones.

A supply contract in Page view in dark mode, with the header, a table and a chart on the first page
The same contract in Page view on white paper

Tracked changes and comments

When a .docx has tracked changes or comments, a bar at the top of Reading view counts them, for example "12 changes by 2 people · 4 comments". Markup underlines insertions and strikes through deletions in one color per author, and when you hover a change you see who made it and when. Comments get small numbered markers and a Comments section at the end with the author and date.

"Final" shows the document as if every change were accepted, and "Original" as if every change were rejected. Copy as Markdown, Open as Text and the compare commands always use Final. The viewer only reads the file, so nothing gets accepted or rejected in it.

A contract with one deletion and one insertion by two people, the bar with Markup, Final and Original, and a comment at the end

Compare versions

Word files are binary, so git diff shows nothing useful for them. Right-click a .docx or .odt file in the Explorer or in Source Control and pick "Compare with Git HEAD". Both versions are turned into Markdown and open in the VS Code diff view, with changed words, table rows and headings marked. It's also in the ... menu of the viewer.

To compare two files, select both in the Explorer and pick "Compare with Another Document...", or run it on one file and pick the second. A .docx can be compared with an .odt.

Git runs on your machine with hooks and fsmonitor turned off, and only in a trusted workspace. The compare shows text and structure. Changes to fonts, colors or images alone don't show.

Commands

CommandWhat it does
"DOCX Viewer: Find in Document"Puts the cursor in the search box (Ctrl+F / Cmd+F)
"DOCX Viewer: Copy as Markdown"Copies the whole document as Markdown
"DOCX Viewer: Open as Text"Opens the plain text in a new untitled editor
"DOCX Viewer: Open as Markdown"Opens the Markdown in a new untitled editor
"DOCX Viewer: Open in Default App"Opens the file in Word, Pages or LibreOffice
"DOCX Viewer: Compare with Git HEAD"Shows what changed since the last commit, as a Markdown diff
"DOCX Viewer: Compare with Another Document..."Shows the differences between two documents, as a Markdown diff
"DOCX Viewer: Show or Hide the Toolbar"Hides the toolbar for more reading room, and shows it again (Ctrl+Shift+H / Cmd+Shift+H in the viewer). The small button at the top right also brings it back.
"DOCX Viewer: Open Sample Document"Opens a short sample report
"DOCX Viewer: Support the developer"Opens the GitHub Sponsors page
"DOCX Viewer: More free viewers"Lists the other Zovo extensions and installs the one you pick

"Copy as Markdown", "Open as Text" and the two compare commands are also in the Explorer right-click menu for .docx, .odt and .doc files, so you can grab the text without opening the preview.

In the search box, Enter goes to the next match and Shift+Enter to the previous one. Esc clears it.

Settings

SettingDefaultMeaning
docxViewer.themeautoauto follows VS Code, light shows white paper, dark a dark page
docxViewer.defaultViewreadingpage opens Word files in Page view in new workspaces. The toolbar switch is kept per workspace.
docxViewer.zoom1Zoom for both views, from 0.5 to 3
docxViewer.fontFamilyemptyFont for Reading view. Empty keeps the Word-like default, editor uses your editor font, or give a font list such as Georgia, serif
docxViewer.pageViewMaxMB100Bigger files open in Reading view, with a button to try Page view anyway
docxViewer.maxFileSizeMB100Bigger files ask before they open
docxViewer.maxImageSizeMB20Bigger images show a placeholder instead
docxViewer.maxTotalImagesMB300After this many MB of images, the rest show placeholders
docxViewer.askForRatingtrueAsk for a Marketplace rating after 3 files opened without an error on 2 different days. "Later" asks one more time after 7 days, "No thanks" never again. It never asks after an error. Turn it off with false.
docxViewer.showSupportLinkstrueShow the small Sponsor and More free viewers line at the bottom right of the viewer. Turn it off with false.

Big files

The converter runs in a worker thread with a memory cap and a 60 second limit, so a huge or broken file can't freeze VS Code. Pictures go to the viewer as raw bytes instead of text, which keeps big reports fast. The page fills in from the top in chunks of about 200 KB of HTML, and you can read the first screen while the rest arrives.

Measured in a real VS Code 1.142 window on an Apple M3 Pro, from the click in the Explorer to the finished page:

File0.2.50.3.0
47 MB government report, 41 photos, 31 headings4.1 s, 6 photos left out1.4 to 1.6 s, all 41 photos
Same report in Page viewReading view only (over 20 MB)0.4 s, 41 photos
475 KB report with 39,000 words1.9 s1.8 to 1.9 s

We test each release on 17 real-world files from public sources (Apache POI bug reports, a JNCC survey report, a gov.uk statistics file), including broken, password-protected and renamed files.

Privacy

DOCX Viewer works offline. It makes no network calls and sends no telemetry. The webview runs under a strict Content Security Policy with no remote scripts and no network access, and the document HTML is rebuilt from an allowlist with all text escaped before it reaches the page. Remote images, scripts and javascript: links in a document are dropped. Page view allows inline styles, which the page layout needs, and blocks the rest the same way.

Limits

Credits

The .docx conversion uses mammoth (BSD-2-Clause). Page view uses docx-preview (Apache-2.0), and .doc files are read with word-extractor (MIT). The .odt reader is part of this extension and uses JSZip (MIT) and @xmldom/xmldom (MIT), which mammoth already bundles. See THIRD-PARTY-NOTICES.md for every bundled package and its license.

License

MIT

Install DOCX Viewer, Word Viewer & DOCX Preview (Dark Mode)

Click the button to open VS Code and install it, or press Ctrl+P (Cmd+P on macOS) in VS Code and run ext install zovo.docx-viewer-vscode.

Free, MIT license. Needs VS Code 1.90.0 or newer. Extension ID zovo.docx-viewer-vscode, version 0.3.0.

Source code and issues are on GitHub.

All our VS Code extensions

Support this work

If this extension saves you time, you can support the work on GitHub Sponsors. Monthly tiers start at $5, and one-time tiers start at $15. Sponsorship is optional, and the tool works the same without it.