Files
zeekayandHanzo Dev cabb4373a7 parse: read docx, pptx and xlsx, and refuse doc, xls and ppt as themselves
The package doc said the Office formats needed decoders outside the standard
library. They do not: OOXML is a zip of XML parts, and archive/zip and
encoding/xml read it. Three readers now do, sharing one package walker and one
generic helper, part[T], that decodes a named part into whatever shape the
reader needs and reports a missing optional part as fs.ErrNotExist.

- docx: the body in order; a heading, by outline level or built-in heading
  style (inherited through basedOn), opens a section at its level; a table is
  records of "column: value" lines named by its first row; deleted and
  moved-away revisions are not read.
- pptx: one section per slide in the order the deck shows them, titled by the
  title placeholder, tables as records, speaker notes kept, slide numbers and
  footers left out.
- xlsx: one section per sheet, shared and rich strings resolved, and a number
  in a date format written as the date: RFC 3339 full-date, partial-time, or
  the two joined by T, with no zone because a workbook records none. The 1900
  system's phantom 29 February and the 1904 system are both honoured.

All three return the core properties as tags. A part whose stated size
exceeds 256 MiB is refused before it is inflated, and a tree nested past
10,000 elements is refused rather than recursed off the stack.

.doc, .xls and .ppt were mapped onto the OOXML names, so a compound file went
to a zip reader. They are now their own placeholders and fail with ErrFormat
naming what they are. Detect also recognises a document with no extension by
its bytes: %PDF-, or a zip whose main part lives under word/, xl/ or ppt/.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-23 00:00:05 -07:00
..