Introduction
DOCX is the default format of
Microsoft Word since Word 2007, replacing the older
binary .doc. It is part of
Office Open XML, standardised as ECMA-376 and ISO/IEC 29500. A DOCX file is a ZIP
archive of XML files: the text and its formatting, the styles, the numbering of lists,
comments, headers, footers and the pictures.
Related extensions use the same layout: .docm for documents with macros,
.dotx for templates and .dotm for templates with macros. See
Macros and templates. The format has
two forms, Transitional and Strict;
almost every file is Transitional.
Structure
The ZIP package follows the Open Packaging Conventions.
[Content_Types].xml gives the type of each part, and
_rels/.rels points to the main document,
word/document.xml. Its body is a list of paragraphs (w:p),
each made of runs (w:r) of text (w:t) that share the same
formatting. Tables, section settings and references to pictures sit among the
paragraphs.
The pages in the side menu cover the package and its relationships, then document.xml and each other part in turn.
zip[Content_Types].xml the media type of each partXMLzip_rels/.rels points to the main document and propertiesXMLzipword/document.xml the body: paragraphs, runs, tablesXMLzipword/styles.xml, numbering.xml, settings.xmlXMLzipword/media/ the picturesimageszipdocProps/ title, author, dates and statisticsXML
In the explorer
Drop a Word file on this site’s explorer to see inside it. The file stays in your browser: nothing is uploaded. The Document tab shows the text with its headings, bold, italic, lists, tables, links, footnotes and pictures. Overview lists the document’s properties, comments, tracked changes, headers and footers, fields and links. Parts lists the parts of the package, their relationships, styles, numbering and fonts. Each part opens on its own, and Structure shows the ZIP archive.
Pictures held in the file are shown, but a picture linked from elsewhere is only named: nothing is fetched from the network. Macros are listed and never run. Underlining, colours, alignment and merged cells do not appear in the Document tab, which is made through Markdown.
Headers and footers are shown at the top and the end of the Document tab, each once and
labelled with the sections and pages it serves; their pictures are drawn like the body’s.
A package whose ZIP directory is missing or cut short is still read from its local headers
when the document is in it: it opens as a Word document with the damage listed as an issue.
A password-protected file (a compound file holding EncryptionInfo and
EncryptedPackage) is shown as encrypted, with its cipher and key settings; the
viewer never asks for a password. A text file or a ZIP that is not a Word package, named
.docx, is reported as not a Word document.
Not described
This page and its sub-pages cover the package and the main WordprocessingML structures. They are not complete, so the ratings stay partial. By my check the checked parts agree with 405 real and downloaded files (Word’s own templates, python-docx and Apache POI test files, damaged and encrypted ones), but the rest below is unchecked.
Known, not yet covered
- Viewer: the Document tab is Markdown, so fonts, sizes, colours, underline, alignment, indents, merged cell shapes, page layout, columns and floating positions are not drawn; text boxes appear after their paragraph.
- Viewer: the tables of tracked changes, comments, hyperlinks and fields list at most their first 5,000 entries; a longer table says so in its title, with the true count where it is counted (the Overview counts are complete).
- Viewer: equations (
m:oMath) are shown as their text only, charts and SmartArt as labels, and VML or DrawingML shapes are not drawn; metafile (EMF, WMF) pictures are named, not drawn. - Viewer: the decoded theme colour scheme, latent styles, digital signatures, thumbnails, custom XML and the glossary document are listed as parts but not decoded further.
- Viewer: the encrypted package is not decrypted (no password is asked for); the algorithms of the Standard encryption header are named from the common values only.
- Reference: the element-by-element tables of ECMA-376 Part 1 for the whole
w:schema, the Strict namespace differences beyond the main ones, and the Markup Compatibility rules beyondmc:AlternateContent.
Unknown
- Reference: ECMA-376, [MS-DOCX] and [MS-OI29500] were not downloaded for this pass, so claims in the reference come from real files and prior knowledge, not a line-by-line check against the standard.
- Viewer: no real Strict file, SmartArt document or agile-encrypted file made by Word was available to check against; the encrypted check used two Apache POI samples.
Links
Software
- Microsoft Word – Microsoft’s word processor, which uses DOCX by default (Windows, macOS, web, mobile)
- LibreOffice Writer – free office suite’s word processor, which opens and saves DOCX (Windows, macOS, Linux)
- Google Docs – online word processor that imports and exports DOCX (web browsers)
- Apple Pages – Apple’s word processor, which imports and exports DOCX (macOS, iOS)
- ONLYOFFICE – office suite built around the Office Open XML formats (Windows, macOS, Linux, web)
- Pandoc – command-line converter between DOCX, Markdown, HTML and many other formats (Windows, macOS, Linux)
Developers
- python-docx – library that reads and writes DOCX (Python)
- Apache POI – library for Office files, DOCX through its XWPF classes (Java)
- Open XML SDK – Microsoft’s library for Office Open XML packages (.NET)
- Mammoth – library that converts DOCX to HTML (JavaScript)
Reference
- ECMA-376 Office Open XML File Formats – Ecma International’s standard for DOCX, XLSX and PPTX