interplane.Get Omega
Read in your language

omega-office

Omega office documents: read and write office files in Omega

Brought by drakestapleton

Unfinished: not checked yet

There is no published receipt of a rebuild from its source yet. What a receipt is

Get this repository
Git over HTTPS
git clone --no-checkout https://interplane.io/projects/omega-office/repo.git omega-office && git -C omega-office checkout --detach 10d535a2161809313e16b4b39f0fa8cd588bc249
Source archive of 10d535a2161809313e16b4b39f0fa8cd588bc249
Download ZIP · tar.gz

README.md

omega-office

I wrote omega-office so that the text of a word processing document and the cells of a spreadsheet can be read by a tool whose every line anyone can inspect. It reads Office Open XML packages (ECMA-376, the same text as ISO/IEC 29500): a .docx main document part as plain UTF-8 text, and one worksheet of an .xlsx workbook as CSV. It is written in Omega (seeded Omegese) and built by the pinned seed-born compiler; nothing else runs inside it. It is slice S2 of the no-black-box tools and stands on slice S1, omega-zip, whose inflate and zip reader it carries in vendor/omega-zip/.

One program, officeread: (named ooffice until 2026-11-10; renamed because ooffice is another office suite's launcher on some Linux distributions)

commandwhat it does
officeread text FILE.docxthe text of the main document part, one paragraph per line (UTF-8, LF)
officeread csv FILE.xlsx [SHEET]one worksheet as CSV (RFC 4180, CR LF); SHEET is a sheet name, else a position 1, 2, ... when no sheet has that name; the first sheet by default
officeread sheets FILE.xlsxthe sheet names in workbook order, one per line
officeread xmlev FILE [ENTRY]the XML event sequence of FILE, or of the zip entry ENTRY in FILE (the form the gate compares with expat)

Every refusal is one line on stderr, officeread: MESSAGE (or ozip: MESSAGE from the zip engine), and a documented exit code (table below). Standard output is buffered and written in 64 KiB pieces, the last at the end, so only exit 0 means a complete result; after a refusal stdout may hold the pieces already written (a 70000-byte text run before a mismatched end tag leaves 65536 bytes on stdout and exits 62).

What the proof proves, and what it does not

The gate below proves that the officeread built from exactly these sources by the pinned compiler gives the oracles' output on the corpus (after the normalisation stated for each oracle, and with every difference classified), refuses the malformed and out-of-bound inputs with the stated codes, kills the stated mutants, and never traps or hangs on the cut and changed inputs of the sweep. It does not prove that officeread is correct on every input, that it is fast, or that a file it reads is harmless: it reads what the package says, within the bounds below.

Build

The compiler is omega-mv's seed-born seed/out/omc at the commit in PIN (sha256 in PIN). With an omega-mv checkout at that commit (sh seed/omega-from-seed.sh rebuilds omc from the seed and must give the same sha256):

OMC=/path/to/omega-mv/seed/out/omc
cat src/head.om vendor/omega-zip/vendor/omega-mv/seed/text/text.om vendor/omega-zip/src/io.om \
    vendor/omega-zip/src/crc32.om vendor/omega-zip/src/inflate.om vendor/omega-zip/src/unzip.om \
    src/xml.om src/sink.om src/opc.om src/docx.om src/xlsx.om src/main.om | $OMC > officeread && chmod +x officeread

The units must be in that order (src/head.om carries the om2 line; a text or const is visible only after its line). The output is a static Linux AArch64 executable. tests/gate.om builds the same way (its UNITS text) and is the receipt.

Gate

mkdir -p build && $OMC < tests/gate.om > build/gate-bin && chmod +x build/gate-bin && build/gate-bin $OMC

Run from the repository root. The last line on success:

OFFICEREADGATE PASS cases=182 mutants-killed=30/30 robust-runs=46464

It exits 0 on PASS, 1 on any failure, 3 (NOT_RUN) when the compiler's SHA-256 is not the pin. It computes that SHA-256 itself (FIPS 180-4). Then it:

  1. builds build/gate/officeread from the units;
  2. runs the cases of tests/cases.txt: exit status, stdout against the oracle (exactly, or after the stated normalisation), and stderr (empty after success, exactly one officeread: or ozip: line after a refusal);
  3. builds each mutant of tests/mutants.txt (one or more source lines replaced) and requires a case to fail on it;
  4. robustness: every corpus input cut at 64 points and changed at 256 single bytes, 10 s limit each. Every run must end with exit 0 or a documented refusal code, never a trap (101..114), a signal or the time limit. For a zip package an exit 0 must print exactly what the unchanged package prints (a changed byte inside compressed data is caught by the inflate checks or by the CRC-32, code 47). For a plain XML file an exit 0 with different output is counted as changed-plain: plain XML has no checksum, so a changed byte can simply be a changed character.
  5. before step 2, builds tests/docs.om with the same compiler and runs it: publication checks of the repository's own text (rules tests/docrules.txt: no local home paths, no source note citing a file outside the repository or missing from it, no note leaving a question open, the licence present). It prints DOCS PASS ... mutants-killed=K/K (its own mutants, tests/docmutants.txt); any other result fails the gate.

Recorded 2026-11-10T07:18:51Z to 07:20:23Z on a clean git archive export of e767cdab (omega-zip 231dd336 vendored unchanged, the command named officeread), in the pool-19 ticket (taskset -c 19, nice 10). The earlier receipts (ec493564: 169 cases, 20 mutants; c1a13734: 170 cases, 21 mutants, printed with the old prefix OOFFICEGATE) are in this file's history:

OFFICEREADGATE cases passed: expat=33 libreoffice-text=5 libreoffice-csv=9 exact=13; refusals passed: xml=65 package=41 zip=3 usage=4
OFFICEREADGATE mutants=23 killed=23
OFFICEREADGATE robustness files=137 runs=43584 refused=40220 exact=2191 changed-plain=737 accepted-after-change=436 failures=0
OFFICEREADGATE robustness exit codes: 10:72 11:91 12:63 13:1 14:256 15:364 16:344 17:134 18:226 19:1 21:791 40:4059 42:185 43:13 44:56 46:1515 47:489 48:14 50:731 53:1023 60:8522 61:3967 62:554 63:9096 64:301 65:586 66:683 67:612 68:56 70:83 71:38 72:111 73:206 74:21 75:110 80:616 81:1012 82:729 84:111 85:4 86:159 87:484 88:110 89:1621
OFFICEREADGATE PASS cases=173 mutants-killed=23/23 robust-runs=43584

Robustness: 137 files (22 packages and 17 XML files that are read, 41 package and 57 XML refusal fixtures) x (64 cuts + 256 one-byte changes). No trap, signal or timeout; no package ever exited 0 with output other than its unchanged output (2191 runs printed exactly that; 489 changed bytes were caught by the CRC-32, 47, and the rest by the inflate, zip, XML and package checks). 737 runs on plain XML printed other events (a changed character), and 436 runs turned a plain XML refusal fixture into a well-formed file.

Mutants (tests/mutants.txt; one or two lines replaced) and the case that killed each:

mutantchangekilled by
m-entityentity decoding off (&amp; gives ?)x-basic
m-charrefcharacter references offx-basic
m-sstindexshared string index off by onec-cells
m-colrefcolumn placement ignores the cell referencec-cells
m-hardpathrelationship lookup replaced by the hard-coded path word/document.xmlt-alt
m-prefixa prefixed element takes the default namespacex-basic
m-doctypeDOCTYPE skipped instead of refusedrx-doctype-ext
m-movefrommoved-from text printedt-alt
m-quoteCSV quoting offc-cells
m-attrspaceattribute-value normalisation offx-text
m-crlfline-end normalisation offx-basic
m-utf8UTF-8 refusal off (the end-of-input check still refuses)rx-utf8-then-mismatch
m-depthnesting bound offrb-depth1025
m-phoneticphonetic runs printed with shared stringsc-xalt
m-mediatypemedia type of the main part not checkedrp-ctype
m-dotdot.. segments not removedt-alt
m-cellseptable cells separated by a spacet-features
m-booleanTRUE printed as FALSEc-xstrict
m-utf16leUTF-16LE read as big-endianx-utf16le
m-fastpaththe inline character-data path stores a wrong bytez-plain
m-cdatafast] and > take the inline character-data path, so ]]> in a package part is not refusedrp-cdataend
m-attrfast< and & take the inline attribute-value path, so they are not refused in a package partz-squote (and rp-attramp)
m-attrquote' takes the inline attribute-value path, so a value opened by ' does not end at its 'z-squote
m-depthfastthe inline character-data path skips the depth check, so text after the root element of a package part is not refusedrp-textafter
m-namefastthe inline name path skips its first-character check, so </1p> in a package part is 62 (mismatched end tag), not 60rp-enddigit
m-ncnamean element's local part is not checked as an NCNamerx-ns-local-digit (and rx-ns-local-middot, rp-localdigit)
m-ncattran attribute's local part is not checked as an NCNamerx-ns-local-attr
m-ncdeclthe prefix of an xmlns:p declaration is not checked as an NCNamerx-ns-decl-digit
m-ncdec2the NameStartChar check after a colon decodes a two-byte character with the wrong lead-byte maskx-ns-local2
m-ncdec3the NameStartChar check after a colon reads one continuation byte of a three-byte character, not twox-ns-local2

Without the fixtures rp-attramp, rp-attrlt and h-squote (the cases and corpus of c6d510e3), both new mutants survive (2026-11-10T07:16Z): the inline paths of src/sink.om were only checked by plain-file refusals. Negative controls, 2026-11-10T07:20:23Z to 07:21:51Z on the same export: the gate with another omc (omega-mv seed/out/omc sha256 0bca06df...) prints `OFFICEREADGATE NOT_RUN: compiler sha256 is not the pin 6d1b1cf5...` and exits 3; with no argument it prints its usage and exits 3. A build whose stderr prefix is officereaX: (the first 9 bytes equal, which the gate's earlier fixed 9-byte compare let through) fails 111 cases on the stderr check. omega-zip 28e91f99's own src/io.om (its fn wout) next to src/sink.om is refused by omc (error 10): the vendored files need no patch only because the seam is now omega-zip's. The first negative control (06:15:04Z, seed/rung4/om4.bin) is in this file's history.

Proposed fix by factory inspection bay 3 (review of 06d4b937, needs its own review): the gate on a clean git archive export of 6307bdd2 (README.md is the only file that differs), 2026-11-10T08:17:06Z to 08:20:17Z, pool-0-2 (taskset -c 0-2, nice 19), exit 0, stderr empty: `cases passed: expat=34 libreoffice-text=5 libreoffice-csv=9 exact=13; refusals passed: xml=72 package=41 zip=3 usage=4`, mutants=28 killed=28, robustness files=145 runs=46144 ... failures=0, last line OFFICEREADGATE PASS cases=181 mutants-killed=28/28 robust-runs=46144. At 06d4b937 the mutants m-depthfast and m-namefast survive (the inline paths of src/sink.om again checked only by plain-file refusals), and 06d4b937's own build prints the text of rp-localdigit.docx with exit 0 and accepts every rx-ns-local and rx-ns-decl fixture (exit 0) where expat refuses: the NCName check (Namespaces in XML 1.0 section 3) was missing on both paths.

Proposed fix by factory inspection bay 8 (review of fb793565, needs its own review): the gate on a clean git archive export of 10e81848 (README.md is the only file that differs), 2026-11-10T13:38:04Z to 13:41:17Z, pool-0-2 (taskset -c 0-2, nice 19), exit 0, stderr empty: `DOCS PASS files=20 paths-files=8 forbid=5 need=2 cases-file=1 mutants-killed=7/7, cases passed: expat=35 libreoffice-text=5 libreoffice-csv=9 exact=13; refusals passed: xml=72 package=41 zip=3 usage=4, mutants=30 killed=30`, robustness files=146 runs=46464 ... failures=0, last line OFFICEREADGATE PASS cases=182 mutants-killed=30/30 robust-runs=46464. At fb793565 with only the two new mutant lines added (2026-11-10T13:41:17Z to 13:44:28Z, same pool), m-ncdec2 and m-ncdec3 survive and the gate exits 1 (mutants=30 killed=28): after a colon the corpus had only the lead bytes 0xC2, 0xC3, 0xE4, 0xE5 and 0xE6 (x-ns-local, x-names, rx-ns-local-middot), for which both mutated decodes give the same verdict.

tests/mkcases.om (Omega) regenerates every generated corpus file (corpus/gen) byte-identical.

Oracles

All oracles are test tools only, never part of omega-office; their outputs are committed with the commands that made them (corpus/SOURCES.txt), so the gate itself needs only the pinned compiler.

oraclewhat it checkscases
expat 2.6.1 through python3 3.12.3 xml.sax (xmllint is not installed on the Spark)the XML event sequence (xmlev) of 18 plain files and of 17 parts inside the corpus packages (the second set goes through the inflate sink and its fast path)35
LibreOffice 24.2.7.2 headless, txt:Text (encoded):UTF8text: equal after the normalisation below5
LibreOffice 24.2.7.2 headless, CSV filter with token 9 false (values as stored, not as shown) and token 12 = the sheetcsv: equal after the normalisation below9
reviewed or hand-derived expected filestext, csv, sheets outputs whose LibreOffice difference is classified (corpus/expect/*.lo.diff), and the packages LibreOffice does not open, derived by hand from the clauses below13

I chose LibreOffice over python3 zipfile plus xml.sax for the spreadsheet oracle because it is an independent implementation of the whole path (package, relationships, shared strings, cell placement), and with "values as stored" it prints the stored cell values; a Python reader would have been my own reading of the standard a second time.

Normalisation. Text: on both sides a leading UTF-8 byte order mark is removed (LibreOffice writes one), CR LF becomes LF, and spaces and tabs at the end of each line are removed. CSV: my CR LF record ends (RFC 4180 2.1) are read as LF (LibreOffice writes LF); nothing else is changed on either side.

Every difference class found, with its files and the reason:

classLibreOffice printsofficeread printswhyfiles
list and outline labelsthe label of a numbered or bulleted paragraph ( •, 1.), and 7 spaces for a heading with an empty outline labelno labellabels come from the numbering part and its counters, which this slice does not readfeatures, lists
tracked deletionsdeleted text (removed words) as if it were presentnothing for del (17.13.5.14) and moveFrom (17.13.5.22)I print the text with every tracked change accepted: deleted and moved-away content is not part of itfeatures (and h-alt, which LibreOffice does not open)
footnote marksthe reference mark (1)nothingthe mark is a counter of the footnotes part; footnotes are not readfeatures
recalculated fieldsits own value of a page field (0)the field result stored in the document (1)I print the stored result (17.16.18, 17.16.19); there is no layout to recompute itfeatures
tablesevery cell paragraph on its own lineone row per line, cells separated by a tab, paragraphs inside a cell separated by a spacethe table form this slice definesfeatures, tables, h-strict
formatted numbersa date, time or percentage cell in its number format (2026-11-10, 01:30:00 PM, 12.5%) although token 9 asks for stored valuesthe stored number (46336, 0.5625, 0.125)formats are in the styles part, the next slice; a date is stored as a numbertypes sheet 1
number textits canonical number (-0.0005, 7)the stored text (-0.5e-3, 007)values print as storedh-xalt sheet 1
ISO 8601 date cells (t="d")a serial number (46336)the stored text (2026-11-10T00:00:00)values print as storedh-xalt sheet 1
a formula with no stored valueits computed value (2)an empty fieldthere is no formula engine; only stored values are readh-xalt sheet 1

LibreOffice 24.2.7.2 writes no output for h-alt.docx (the main part under another name, prefixed package relationships, the prefix x) or h-deflt.docx (media type from a Default element, an absolute target, no prefix); I did not find which feature stops it. Their expected text is derived by hand from the clauses and checked against the rules above line by line.

The expat oracle and the XML refusals: expat refuses 51 of the 56 XML refusal fixtures too. The other five are rules of this reader: a document type declaration (rx-doctype, rx-doctype-ext: ECMA-376 Part 2 6.2.5 b forbids DTDs in package XML), an encoding other than UTF-8 or UTF-16 (rx-latin1: Part 2 6.2.5 a), UTF-16 without a byte order mark (rx-utf16-nobom: XML 1.0 4.3.3 requires it) and version 1.1 (rx-version11). Expat also accepts the six one-past-the-bound files. Its verdict on each is in corpus/refuse/ORACLE.txt.

Exit codes

codemeaningcases
0done
1usage: unknown command or wrong argumentsru-*
2cannot open the filerz-no-file
3, 4read error, write error
10..22, 30..32, 40..53the zip engine (omega-zip README "Exit codes"): input ends early, bad Huffman codes, distance too far back, output above the bound, not a zip file (40), ZIP64 (41), split archive (42), encrypted entry (43), method other than stored or deflated (44), local header disagrees (46), CRC-32 mismatch (47), entry above 1 GiB (48), malformed central directory (50), entries overlap, a possible zip bomb (51), size mismatch (52, 53)rz-not-zip, rz-empty, robustness
60not well-formed XML (XML 1.0 productions: tags, attributes, references, comments, CDATA, PIs, content outside the root, ]]> in text)rx-*
61the XML ends before the document is complete (no root element, an open element or construct)rx-truncated, rx-empty, rx-no-root, rx-comment-unclosed
62an end tag does not match its start tagrx-mismatch, rp-mismatch
63bad UTF-8 (tx_u8st: overlong, surrogate, above U+10FFFF, stray or missing continuation), bad UTF-16 (lone surrogate, odd length), no byte order mark before UTF-16, a C0 control other than tab, LF and CR, or U+FFFE, U+FFFF (XML 1.0 2.2)rx-utf8-, rx-utf16-, rx-control, rx-fffe
64the XML declaration names an encoding other than that of the input, or a version other than 1.0rx-latin1, rx-utf16-declared, rx-version11
65a document type declaration: refused outright, so no entity beyond the five predefined ones exists and nothing is ever expanded or fetched (ECMA-376 Part 2 6.2.5 b)rx-doctype, rx-doctype-ext, rp-doctype
66an entity other than amp lt gt quot apos, or a character reference to a character XML 1.0 does not allow (0, surrogates, U+FFFE, U+FFFF, above U+10FFFF)rx-entity, rx-cref*, rp-entity
67namespace error (Namespaces in XML 1.0): an undeclared prefix, xmlns:p="", the prefix xmlns declared or used on an element, xml bound elsewhere or another prefix bound to its URI, a name with two colons or a colon at either end, a prefix or local part that is not an NCName (p:1x)rx-ns-*, rp-prefix, rp-localdigit
68duplicate attribute, by name or by namespace URI and local namerx-dup-*
70a name longer than 256 bytesrb-name257
71more than 256 attributes on one elementrb-attr257
72attribute names and values of one start tag above 262144 bytesrb-abytes
73elements nested deeper than 1024rb-depth1025
74more than 4095 namespace declarations in scope, or above 262144 bytes of their prefixes and URIsrb-ns4096
75an entity or character reference longer than 32 bytes between & and ;rb-ref33
80not a package of the asked kind: no package relationships part, no relationship of type officeDocument, or the media type of the main part is not that of a word processing document (text) or a workbook (csv, sheets)rp-norels, rp-notype, rp-ctype, rp-text-on-xlsx, rp-csv-on-docx, rp-sheets-on-docx
81a part the package names is missing (the main part, the Media Types stream, a worksheet, the shared strings), or the sheet's relationship id is not in the workbook's Relationships partrp-nomain, rp-noct, rq-*miss, rq-norel
82a relationship target that is not a part name in this package: TargetMode External, a scheme, an empty or dot-ending segment, a directory, ?, #, \, a percent-encoded / or \, above 4095 bytesrp-external, rp-scheme, rp-trailing, rp-pctslash
83no sheet with that name or positionrq-nosheet*
84the chosen sheet's relationship is not of type worksheet (a chartsheet, dialogsheet, ...)rq-chart*
85shared strings above 1048576 items or 16777216 bytes, or one cell's text above 16777216 bytesrq-sstmany
86a shared string index that is not a decimal below the number of itemsrq-sst*
87a cell or row reference that is malformed (lowercase, no row), out of range (column above XFD = 16384, row 0 or above 1048576), not ascending, or a cell reference whose row is not its row'srq-ref*, rq-order, rq-roworder, rq-rowmis
88a cell type other than those of ST_CellType, or a boolean that is not 0 or 1rq-type, rq-bool
89a malformed package part: a wrong root element (Relationships, Types, workbook, sst, worksheet), a required attribute missing (Id, Type, Target; Extension, PartName, ContentType; sheet name and r:id), an unknown TargetMode, a media type or relationship id above 1024 bytesrp-relsroot, rp-ctroot, rp-notarget, rp-badmode, rq-noid, rq-wbroot, rq-wsroot

A trap (exit 101..114) would be a defect: the gate fails on one.

Bounds, and what happens at each

Nothing holds a whole part: the zip engine inflates a part 32 KiB at a time into the XML reader, which keeps only the tag being read and the open elements. Globals: 64,116 bytes from omega-zip, then the reader (1,095,268 bytes: a 256 KiB attribute pool, 256 KiB open-element names, 256 KiB namespace bytes, a 64 KiB text buffer), the output and file buffers (131,112 bytes), the package (26,880 bytes), the shared string table (16 MiB pool and 8 MiB of offsets) and one cell value (16 MiB): 43,265,936 bytes (41.26 MiB, computed by Wolfram from the declarations) in all; the compiler allows 1 GiB of globals and 16,777,216 elements per array (OMEGESE.md, Size limits). Like omega-zip, this is a streaming tool and is not a profiled unit: its loop bounds exceed the profile's 8192 and its globals the profile's 65,536 bytes (rule B3), by the lane's decision.

boundvalueat the bound
element, attribute, end-tag or PI-target name256 bytesrefused, 70
attributes on one element256refused, 71
attribute names and values of one start tag262144 bytesrefused, 72
element nesting1024refused, 73
namespace declarations in scope4095 (4096 bindings with xml), 262144 bytesrefused, 74
one entity or character reference32 bytes between & and ;refused, 75
the XML declaration512 bytesrefused, 60
character datanone: delivered in 64 KiB pieces
part names, relationship targets4095 bytes (merged path 8191)refused, 82
media type, relationship id1024 bytesrefused, 89
shared strings1,048,576 items, 16,777,216 bytes of textrefused, 85
one cell value (inline string or v)16,777,216 bytesrefused, 85
columns, rowsXFD (16384), 1048576refused, 87
zip entry, entries, names1 GiB, 65535, 4095 bytes (omega-zip)48, 41 (ZIP64), 45
plain XML file for xmlev64 TiB (1,000,000,000 reads of 64 KiB)a trap would follow; not reachable in practice

What it reads, and what it does not

text (ECMA-376 Part 1, WordprocessingML):

  • Reads document/body (17.2.3, 17.2.2): the character data of every t (17.3.3.31) that is a child of a run r (17.3.2.25), anywhere in the body: in paragraphs p (17.3.1.22), hyperlinks (17.16.22), inserted runs ins (17.13.5.18), moved-to runs moveTo (17.13.5.25), content controls sdt (17.5.2.29 to 17.5.2.36), smart tags and custom XML (17.5.1), simple fields (17.16.19), and the result runs of complex fields (17.16.18).
  • In a run: tab (17.3.3.32) and ptab (17.3.3.23) print a tab; br (17.3.3.1) of type textWrapping or with no type and cr (17.3.3.4) print a line end, while page and column breaks print nothing; noBreakHyphen (17.3.3.18) prints U+2011, softHyphen (17.3.3.29) prints U+00AD.
  • A paragraph ends with LF; an empty paragraph is an empty line.
  • Tables tbl (17.4.37): each row tr (17.4.78) is one line, the cells tc (17.4.65) separated by a tab. Inside a table, the paragraphs of one cell, and tabs and breaks, are separated by a space. A nested table's cells are joined into its outer cell with spaces.
  • Markup compatibility (ECMA-376 Part 3): in AlternateContent the Fallback is read and every Choice is skipped, since no Choice namespace is understood here.
  • Not printed: deleted runs del (17.13.5.14) with their delText (17.3.3.7), moved-from runs moveFrom (17.13.5.22); field codes instrText (17.16.23) and delInstrText (17.16.13); ruby text rt (17.3.3.24), whose base text is printed; drawings, VML pictures and embedded objects (drawing 17.3.3.9, pict, object 17.3.3.19) with any text box inside them; sym (17.3.3.30); all properties (pPr, rPr, sectPr, tblPr, tblPrEx, tblGrid, trPr, tcPr, sdtPr, sdtEndPr); footnote and endnote reference marks; list and heading labels.
  • Not read at all: footnotes, endnotes, comments, headers and footers (separate parts), the numbering and styles parts, the glossary document.
  • Deleted text, decided: it is not printed. The standard says del content "shall be treated as deleted content which has been tracked as a revision" (17.13.5.14), and moved-from content as "moved away from this location" (17.13.5.22). I print the document as it reads with its revisions accepted.

csv, sheets (ECMA-376 Part 1, SpreadsheetML):

  • The workbook (18.2.27): sheets (18.2.20) lists each sheet (18.2.19) with its name and r:id. The worksheet and the Shared String Table are found through the workbook's Relationships part by relationship type (worksheet, sharedStrings), never by a fixed name.
  • Shared String Table (18.4.9): an item si (18.4.8) is the text of its t (18.4.12), directly or in rich text runs r (18.4.4); phonetic runs rPh (18.4.6) are not part of the value. The whole table is held, up to its bound (above, 85).
  • Worksheet (18.3.1.99): sheetData (18.3.1.80), rows row (18.3.1.73), cells c (18.3.1.4). A cell is placed by its reference r, and follows the previous cell when r is absent (rows likewise); rows and cells must ascend (87).
  • A cell's value is v (18.3.1.96), or is (18.3.1.53) for an inline string. Its type t (18.18.11 ST_CellType) is used as follows: n (the default) and d print the stored text; s prints that shared string; str (a formula string) and e (an error such as #DIV/0!) print the stored text; inlineStr prints the inline string; b prints TRUE or FALSE. Numbers are printed as written in the file, never reformatted.
  • Dates are stored as numbers (a serial day count) in cells with a date format, and I print that number. Turning it into a date needs the number format in the styles part: the next slice.
  • Strings are ST_Xstring (22.9.2.19): _xHHHH_ is decoded on output (a surrogate pair of escapes is one character; _x005F_ is an underscore).
  • The output is rows 1 to the last row that holds a value, each with fields 1 to the last column that holds a value, so empty cells and rows are preserved and every record has the same number of fields. A cell holds a value when it has v or is; a formula without a stored v, or a styled empty cell, holds none. RFC 4180: a field with a comma, a quote, CR or LF is quoted with quotes doubled (2.6, 2.7), and records end with CR LF (2.1).
  • The sheet is read twice: once for the last row and column, once to print.
  • Not read: styles and number formats, formulas (only their stored results), hidden state (hidden sheets are listed and printed like any other), merged cells (the value is in the first cell), comments, tables, pivot tables, charts, external links, the dimension element.

Package (ECMA-376 Part 2, Open Packaging Conventions, 5th edition):

  • The package Relationships part _rels/.rels (6.5.2.2) names the main part (relationship type officeDocument, Transitional or Strict URI).
  • Its media type comes from the Media Types stream [Content_Types].xml (7.2.3, 7.3.7): an Override for the part name, else a Default for its extension. It must be the main part of a word processing document or template, or of a workbook or template (the media types of ECMA-376 Part 1). The part must exist before its media type is checked.
  • A part's own Relationships part is _rels/NAME.rels beside it (6.5.2.3).
  • A target is resolved against its source part (6.4.2, RFC 3986 5.2): dot segments are removed, and a leading / is relative to the package root.
  • The result is mapped to a ZIP item name (7.3.4): the leading / removed, every non-ASCII byte percent-encoded.
  • Part names and extensions compare ASCII case-insensitively (6.2.2.3); relationship types compare exactly (6.5.3.4); media types compare ASCII case-insensitively (RFC 7231 3.1.1.1).
  • Transitional and Strict namespaces are both read.
  • Not supported: macro-enabled and other vendor media types (.docm, .xlsm, .xlsb are refused with 80), percent-decoding of part names, interleaved parts (7.2.4), digital signatures (not checked), and a main part named only by a non-ASCII Override part name.

XML (W3C XML 1.0 Fifth Edition, Namespaces in XML 1.0 Third Edition):

  • Elements, attributes, character data, the five predefined entities, decimal and hexadecimal character references, CDATA sections (their text), comments and processing instructions (skipped), one XML declaration at the start (version 1.0; encoding, when named, that of the input; standalone yes or no).
  • Input is UTF-8, with or without a byte order mark, or UTF-16 with a byte order mark (big- or little-endian, surrogate pairs), turned into UTF-8.
  • Line ends are normalised (2.11). In attribute values, a literal tab or line end becomes a space (3.3.3); a character reference stays as written.
  • Names are checked against the Fifth Edition NameStartChar and NameChar ranges (2.3). The non-ASCII names in the corpus (U+00E9, U+4E2D, U+5B50, U+00B7, and after a colon U+0416, U+0905, U+30A2) are accepted by both readers; I did not compare the two readers range by range. One difference is known: a name with a character at or above U+10000 (< U+10000 />, or the local part of a: U+10000) is accepted here, as the Fifth Edition allows, and refused by expat 2.6.1 (invalid token); no gate case covers it, so the four-byte branch of the check after a colon has no oracle case.
  • Namespace prefixes resolve from the declarations in scope, and the handlers compare namespace URIs, never prefixes. A prefix and a local part are each an NCName (Namespaces 1.0 sections 3 and 4): the character after the colon must be a NameStartChar, so p:1x, p:-x, p:.x, p: U+00B7 x and xmlns:1p are 67.
  • Not supported: DTDs (65), entities other than the five, encodings other than UTF-8 and UTF-16, XML 1.1, colons in PI targets are not checked (Namespaces 1.0 section 7), and the xml:space and xml:base attributes have no effect.

Measured speed

MEASURED 2026-11-10T06:16:45Z to about 06:19Z on the Spark (DGX Spark GB10, Linux AArch64), one core: taskset -c 10 inside the pool-10 ticket, nice 10, load average 18 to 22 on 20 cores. Times are from /usr/bin/time (0.01 s resolution), using the binary the gate built (sha256 0b3fea09...c83ad7d5, then named ooffice; not re-measured since), 3 runs each with the same output bytes every time. Rates are by Wolfram from the median time. The inputs are made by build/mkcases DIR big and packed with zip -X -6; they are not committed.

commandinputmedian time (runs)rate
officeread text big.docx600000 paragraphs: a 109,689,060-byte (104.61 MiB) main part, 1,841,266 bytes zipped8.19 s (8.17, 8.19, 8.23)12.77 MiB/s of WordprocessingML; 57,488,890 bytes of text out
officeread csv big.xlsx400000 rows of five cells: an 86,445,114-byte (82.44 MiB) sheet, read twice, and 1000 shared strings; 11,379,691 bytes zipped20.13 s (19.70, 20.13, 20.23)4.10 MiB/s of sheet (8.19 MiB/s of XML read over the two passes); 21,311,575 bytes of CSV out
officeread xmlev big-document.xmlthe same main part as a plain file19.96 s (19.95, 19.96, 19.98)5.24 MiB/s in; 573,489,174 bytes of events out (27.40 MiB/s)

Where the time goes. I measured this with stub builds on a 20,018,876-byte part, before the last speed-ups: inflate alone took 0.40 s, and the XML reader the rest. Printable ASCII in text, names and attribute values is stored inline; every other byte goes through a chain of calls, and every element through its namespace resolution and handler. That per-element work sets the rate, which is why a sheet (many small elements) reads slower than a document. The first build took 21.94 s on the same text input. A typical document part (under 1 MB) takes well under 0.1 s.

Standards followed

  • ECMA-376 Part 1, 5th edition (December 2016): Fundamentals and Markup Language Reference, the clauses named above (WordprocessingML 17, SpreadsheetML 18, ST_Xstring 22.9.2.19).
  • ECMA-376 Part 2, 5th edition (December 2021): Open Packaging Conventions, 6.2.2, 6.2.5, 6.4, 6.5, 7.2.3, 7.3.4, 7.3.7.
  • ECMA-376 Part 3: Markup Compatibility and Extensibility (AlternateContent, Choice, Fallback).
  • W3C Extensible Markup Language (XML) 1.0, Fifth Edition: 2.2, 2.3, 2.4, 2.5, 2.6, 2.8, 2.11, 3.3.3, 4.1, 4.3.3, 4.6, appendix F.
  • W3C Namespaces in XML 1.0, Third Edition: sections 3 to 6.
  • RFC 4180 (CSV), RFC 3986 section 5.2 (resolving a relative reference), RFC 7231 3.1.1.1 (media types).
  • The zip, inflate and CRC-32 standards of omega-zip: RFC 1951, the PKWARE APPNOTE 6.3.10, ISO 3309 / ITU-T V.42.

I read the standards' text (the Ecma downloads, on the Spark, not in this repository) and no other program's source; the tools named above were only run as oracles on files of this corpus.

Reuse of omega-zip, and decisions recorded

  • vendor/omega-zip/ holds omega-zip at 231dd336: src/crc32.om, src/inflate.om, src/zlibd.om, src/unzip.om, src/io.om and its copy of omega-mv seed/text/text.om, all byte-identical (sha256 in vendor/omega-zip/PIN), with no patch.
  • The output seam is omega-zip's own: io.om's wflush runs w = wout n with the window win[0 .. n), and the program defines fn wout n ulong to ulong, returning n (ozip's src/main.om passes the window to woutfd, the output descriptor). Omega has no imports and one namespace, so the program that includes io.om supplies the one wout: here src/sink.om, the consumer of each inflated window. The call is an assignment so that a build without wout is refused by omc (error 3); a bare wout n would compile as the assignment wout = n and drop every byte. Before omega-zip d0490914 the seam was a one-line rename carried here as vendor/omega-zip/sink.patch (in this repository's history).
  • src/zlibd.om is vendored with the others by the lane's decision; nothing in officeread calls it (not in the build), and it is kept for the next slice (PDF streams are zlib).
  • Memory: like omega-zip, officeread streams and is not a profiled unit; the profile's 65,536-byte total does not apply to it (the lane's decision). Every bound is stated above with its refusal.
  • The zip engine's own refusals keep its ozip: prefix and its codes; mine start at 60.

Files

  • src/: the units (head, xml, sink, opc, docx, xlsx, main).
  • vendor/omega-zip/: S1, pinned and unchanged (PIN).
  • tests/gate.om, tests/cases.txt, tests/mutants.txt, tests/mkcases.om; tests/docs.om with tests/docrules.txt and tests/docmutants.txt (publication checks, run by the gate).
  • corpus/: sources, packages, refusal fixtures, oracle outputs; provenance and licences in corpus/SOURCES.txt.

Licence

Apache-2.0 (LICENSE, NOTICE). corpus/docx/letter.docx is made from a LibreOffice template, MPL-2.0, test data only (corpus/SOURCES.txt).

For developers: proof and records

The full record of this project. Words that are used only here are explained once:

ID
The project's permanent id on Interplane: the SHA-256 of its first signed record. This one is git:095729b11697ed2f6fe5d1673ed83a0f1c8228854986d6bf9232b3ac79340091. Its old id, kept only so that old links still work: z46DgsNgCBNEZwcUk3XMDF9hYzhA4.
Owner
The key that signs every record of the project. This forge lists the project under drakestapleton; its key is SHA256:qg3vxoE9ul3Cgk5heosQvPmO9pqIJNsdcsGJ2cHghTs.
Refs and HEAD
Refs are the names that point at versions: branches and tags. HEAD is the version a fresh copy starts from, the newest commit of the default branch.
Patch
A proposed change, reviewed before it is merged. This forge does not show proposed changes from its own store yet. The list is under Proposed changes.
Receipt
A public record that someone checked a claim, with the fingerprint of its evidence file. The state at the top of this page is read from the list at interplane.io/receipts. This project has no receipt in that list yet.

Clones and fetches over HTTPS: 0 by visitors (git smart-HTTP info/refs requests answered 200 in the front-door download log; our own addresses and bots left out; since 2026-11-08) · not measured git-upload-pack requests from all clients (the source of this count is retired)

Downloads: 1 by visitors (1 source archives, 0 release assets; forged access log; our own addresses left out; since 2026-11-07)

commit 10d535a2161809313e16b4b39f0fa8cd588bc249 Branches Tags History
10d535a docs: retire the hand-made Chinese README; readers translate with their own tools Drake Stapleton committed 2026-11-11
corpus/
src/
tests/
vendor/
.gitignore59
.goals.json1653
LICENSE11358
NOTICE521
PIN375
README.md36559

Every record: History (commits) · Branches · Tags · Releases, with the SHA-256 of each download · Patches · Issues · This project as JSON