Skip to content

0.14.0 ​

Word 97-2003 .doc files can now be read as a full document model, not only as main-story paragraph text. readDocModel(bytes, limits?) returns, for every story (main text, headers and footers, footnotes, endnotes, comments and text boxes), an ordered block tree:

  • paragraphs with resolved paragraph and character properties (style cascade plus direct formatting), list references and inline items: text, line, page and column breaks, inline pictures with their image data, embedded OLE objects with their preview, field begin, instruction, separator and end marks with typed fields (HYPERLINK, REF, PAGEREF, TOC, PAGE, NUMPAGES, DATE, TIME, SEQ, MERGEFIELD, INCLUDEPICTURE), bookmarks, note and comment references, and floating shape and text box anchors;
  • tables with their grid, horizontal and vertical merges, borders, shading, row heights, header rows and nested tables.

The model also carries sections (page size, orientation, margins, columns, break type, title page, page numbering) with their header and footer references and inheritance, footnotes, endnotes, comments with author, initials and date, floating pictures and shapes with position and wrap, styles, lists with their overrides, fonts, the stylesheet default fonts and document properties. Pictures are returned as stored (PNG, JPEG, TIFF), DIB as a BMP file, and EMF, WMF and PICT inflated.

The building blocks are exported too: readDocFormatting, readDocStructure and readDocObjects, plus the shared sprm parser, stylesheet, list and font readers. All readers are bounded by DocModelLimits and throw DocResourceLimitError when a budget is exceeded; damage in an optional part becomes a warning. See the DOC model and DOC objects.

Not decoded yet: comment ranges (comments are anchored at their reference), symbol-font characters, revision marks, form-field data, hyperlink binary data, drawing shapes other than pictures and text boxes beyond their raw OfficeArt properties, and paragraph properties stored in the Data stream. Writing remains limited to the existing paragraph edits.

This release also contains the compatibility work described in compatibility coverage: typed compound-file storage operations, exact FILETIME round trips, XLS scalar editing and RK promotion, and stricter DOC, PPT and VSD edit guards.

Released under the Apache-2.0 License.