Format: Keep a Changelog.
[Unreleased]
[1.3.0] - 2026-11-19
Added
-
docx smart tags typed. A
w:smartTagamong a paragraph's (or a revision's, a content control's, another smart tag's) inline children reads as{ type: 'smartTag', attrs, smartTagPr?, children, _extras? }, its inlines typed as a paragraph's, and is written back in its place;docx.toTextreads its text. It used to sit in the paragraph's_extras. -
pptx group shapes typed, opt-in. A new read option,
typedGroups, onpptx.readtypes ap:grpSp(in slides, layouts and masters, at any depth) as{ type: 'group', shapes, _extras }. Its shapes are parsed as the slide's, its pictures' images and its charts read and written as a top-level shape's, and the write puts it back at its place. The pptx walker reaches a group's shapes. The default read is unchanged: a group stays verbatim inspTreeExtras. -
A line's colour typed, opt-in. A new read option,
typedLineColors, onpptx.readandxlsx.read(threaded todrawingmlShape.parseShapeProperties(spPr, opts)) types a shape's line colour as the fill's is:'RRGGBB'for a barea:srgbClr, else{ rgb | schemeColor, mods? }(ana:srgbClr's transforms kept). The writer writes either form. The default is unchanged. -
The xlsx calculation chain, external links, XML maps, connections and query tables read and written through
xlsxFullBundle. A new extra,smlPackageParts, on a new xlsx walker hook pair,hydratePackage/dehydratePackage(called insidexlsx.read's pass and afterxlsx.writehas built its package). Each part is read only when it is written back as read, in the Transitional namespace, with relationships the write rebuilds. The write adds those parts, their relationships, the workbook'sexternalReferencesand their content types. The calculation chain keeps only the entries whose cell holds a formula in the written model, named by the written sheet ids. The pivot caches (workbook.pivotCaches, with their records) and a sheet's pivot tables (sheet.pivotTables) are read throughsmlPivotTables.xlsxLargeBundlereads as before. -
The xlsx workbook details and a drawing's text typed through
xlsxFullBundle. A new extra,smlWorkbookDetails(onhydrateWorkbook/dehydrateWorkbook), types, each only when it is written back as read:- the stylesheet's
slicerStyles/timelineStyles(itsextLst) andcolors; - a font's
condense/extend/outline/shadow; - a dxf's
protection; - a table column's
xmlColumnPrandcalculatedColumnFormula.
The xlsx walker now dispatches the DrawingML text hooks (
hydrateRunProperties,hydrateParagraphProperties,hydrateParagraph) over each drawing's text body, andxlsxFullBundleregistersdmlTextDetails.xlsxLargeBundlereads as before. - the stylesheet's
-
The pptx notes slides, notes and handout masters and unused layouts read and written through
pptxFullBundle. A new extra,pmlPackageParts, on a new pptx walker hook pair,hydratePackage/dehydratePackage(called insidepptx.read's pass and afterpptx.writehas built its package). Each part is read only when it is written back as read and names only parts the write rebuilds:- a notes slide becomes its slide's
notes; - the notes and handout masters become
notesMaster/handoutMaster, each with itstheme; - with one slide master, the layouts no slide uses join
slideLayoutsin the master's list order (layoutRefandlayoutIdsfollow).
The write adds those parts, their relationships, the presentation's
p:notesMasterIdLst/p:handoutMasterIdLstand their content types. The walker visits the notes parts like slides and their themes like the theme.pptxSlidegainsparseNotesSlide/parseNotesMaster/parseHandoutMasterand their serializers;ooxmlSharedthe notes relationship and content types.pptxLargeBundlereads as before. - a notes slide becomes its slide's
-
The slides', layouts' and masters' transition, timing and header / footer flags typed through
pptxFullBundle. A new extra,pmlPartDetails, typestransition(pmlTransitions),timing(pmlAnimations) andhf(pmlNotes), each only when it is written back as read. The pptx walker dispatches a new hook pair,hydrateSlidePart/dehydrateSlidePart, once per slide, layout and master.pptxLargeBundlereads as before. -
The pptx text details and the theme's script fonts typed through
pptxFullBundle. A new extra,dmlTextDetails, types each element only when it is written back as read:- a run's fill colour,
effectLst,gradFill,highlight,ea/cs/symfonts, hyperlinks anduFillTx/uLnTx/noFill; - a paragraph's
lnSpc/spcBef/spcAft, bullet colour, size and font, andtabLst; - a paragraph's
endParaRPr; - the theme's
majorFont/minorFontscript fonts (fonts).
The pptx walker now reaches table cells' text bodies and dispatches
hydrateParagraph/dehydrateParagraphandhydrateTheme/dehydrateTheme.pptxLargeBundlereads as before. - a run's fill colour,
-
The docx body's, sections' and settings' details typed through
docxFullBundle. A new extra,wmlDocumentDetails: a run'srtland characterspacing, a paragraph mark's revisions,rPrChange; a paragraph'sshd,pBdr, ownsectPr,pPrChange; a cell'sshd; a row'stblPrEx; a section'sdocGrid,cols,pgNumType,textDirection,formProtand its other attribute-only children; settings'mathPrand remaining toggles,compat's legacy toggles — each only when it is written back as read. The docx walker now dehydrates in reverse registration order and dispatcheshydrateSection/dehydrateSection(the body'ssectPr, a typed paragraphpPr.sectPr);hydrateLosslessmerges an object field whose keys are new (a group of elements).docxLargeBundlereads as before. -
The styles' and numbering's details typed through
docxFullBundle. A new extra,wmlStyleDetails(hydrateStyles/dehydrateStyles,hydrateNumbering/dehydrateNumbering): a style'sautoRedefine,hidden,semiHidden,unhideWhenUsed,qFormat,locked,personal*(booleans),aliases,link,rsid,uiPriority, a table style'stblStylePr(itspPr/rPrtyped by the run and paragraph hooks: the walker visits them; an empty property element as{}), the part'slatentStyles; the numbering part'snumIdMacAtCleanup, an abstract numbering'snsid,tmpl,styleLink,numStyleLink, a level'ssuff,pStyle,isLgl,legacy,lvlRestart,lvlPicBulletId.docxFullBundleregisters it;docxLargeBundlereads these elements in_extrasas before. Every element is typed only when it is written back as read (hydrateLossless, which now types a repeated name all or nothing). -
The docx walker reaches the styles' defaults and the numbering. The run and paragraph hooks visit
styles.docDefaultsand every numbering level'srPr/pPr; two hook pairs,hydrateStyles/dehydrateStylesandhydrateNumbering/dehydrateNumbering, take the whole part (hydrate before its properties, dehydrate after);docx.writedehydratesnumberingand writes the styles and numbering parts from what the hooks return. ThroughdocxLargeBundle, a numbering level's tabs and the defaults' run and paragraph properties are now typed. -
docxProperties.sameElementandhydrateLossless. Canonical element equality, and the lossless typing of a property bag's_extrasthe typing extensions now share (see Fixed). -
alternateContent: 'choice'read option ofdocx.read. A run'smc:AlternateContentwhose onemc:Choicerequires onlywps,wpgorwpcand holds onew:drawing— a Word 2010 shape, text box, group or drawing canvas with its VML fallback — reads as that drawing, typed as any other, with the new optional fieldalternate: { requires, fallback }; every other construct reads as under'keep'. The write wraps an untouched one back in its construct, Fallback included, and writes an edited one alone.docxDrawing.renderRunChildis the writer;typedFieldsleavesalternateout. Of the 1,469 real-world docx files of the test corpus, 220 hold 464 such constructs: the default read keeps their VML fallback and'keep'keeps them opaque, while'choice'types all 464 and its untouched save-back writes the same constructs as'keep''s. The defaults are unchanged.
Fixed
-
An empty DrawingML
a:pPris written back. A paragraph read with an empty<a:pPr/>(pPr: {}) was written without it; it now keeps the element, sopmlPackagePartsmodelstdf128550.pptx's notes master (its round trip equals its source). -
A docx settings toggle stated false is written back.
docxSettingswrotew:evenAndOddHeaders,w:updateFieldsandw:trackRevisionsonly when true, so a save-back dropped one the document stated false; it is now writtenw:val="0". 3 of 1,469 wild docx kept it only through thewmlSettingsextension. -
A docx save-back keeps a smart tag's text in its place. A smart tag kept in
_extraswas written after the paragraph's typed children, so its text moved to the paragraph's end: 36 paragraphs in 12 of 1,478 wild docx came back reordered, none now. -
smlPivotTableswrites a pivot table's children in the schema's order.renderPivotTablewrotecolFieldsbeforerowItems,rowItems/colItemsafterdataFields, and the formats, chart and conditional formats, hierarchies and filters out ofCT_pivotTableDefinition's sequence. -
xlsx rows keep their numbers through a read then a write. The read stored a sheet's rows densely and the write numbered them 1..n, so the rows after an empty one moved up (in the wild corpus 31,825 cells with content in 81 files changed address). The read now keeps each row's number in
sheet.rowNumberswhen one is not its index + 1, and the write numbers rows and cells by it.sheet.rowsis unchanged. -
xlsx formulas and tables write back what they read. A read then a write through the core lost:
- a shared formula's follower cells (their
<f t="shared" si="…"/>), a shared master'st,refandsi, and an array formula'st="array"andref: a cell now keepsformulaType,formulaRef,sharedIndexandformulaAttrs, a followerformula: ''. Every formula of the wild corpus is now written back (8,290 of 27,365 before); - a table's other root attributes (
tableType,insertRow, the dxf ids,xr:uid…), a column's other attributes, anautoFilter's attributes and children, and the table'ssortState/extLst: nowrootAttrs,extraAttrs,autoFilter.extraAttrs/_extrasand_extras.
- a shared formula's follower cells (their
-
pptx themes write back what they read.
pptxTheme.parsethenserializelost:- a font's attributes beyond
typeface(panose,pitchFamily,charset), now kept in the font kind'sfontAttrs; - a colour or font scheme's empty name, written
"Office"; - the root's
a:custClrLstanda:extLst, now kept in_extras; - the absence of
a:objectDefaults/a:extraClrSchemeLst, written empty: a theme read without one now holdsnullthere and is written without it.
- a font's attributes beyond
-
pptx slides, layouts and masters write back their root and shape properties. A read then a write through the core lost:
- a layout's
type(now read intolayoutType, which the writer already used) and the other root attributes of a slide, layout or master (show,showMasterSp,showMasterPhAnim,preserve,userDrawn,matchingName…), now kept inrootAttrs; - a
p:spPr'sbwMode, nowshapeProps.bwMode; - a
<p:cSld>'s leftovers (p:extLst,p:custDataLst,p:controls) when the root had leftovers too: the default read now keeps them incSldExtras, asslideExtrasByPartalways did.
A
p:extLst(or an unknown element) of a model withoutcSldExtrasis written once, inside<p:cSld>; it was written there and at the root. - a layout's
-
The DrawingML text model writes back what it reads. Through the core (pptx slides, layouts and masters; docx and xlsx DrawingML text bodies), a read then a write lost these, now kept in new fields of the model:
- a run's (and
defRPr's) attributes beyond the typed ones (kern,spc,cap,dirty,smtClean,altLang,err…):rPr.extraAttrs; - an
a:latin'spanose/pitchFamily/charset:rPr.fontAttrs; - a paragraph's other
a:pPrattributes (marR,rtl,defTabSz,eaLnBrk,fontAlgn,hangingPunct…):pPr.extraAttrs; - a field's
a:pPr: the field'spPr; - an auto-numbered bullet's
startAt:bullet.startAt.
A text body read without
a:lstStylegetslstStyle: nulland is written without one; a model without the field still gets an empty one. The pptx walker passes a field'spPrto the paragraph-properties hooks. - a run's (and
-
pmlAnimationswrites back what it reads.parseTimeNodedropped a sequence'sp:prevCondLst/p:nextCondLstand a motion path'sp:rCtr;renderTimeNodewrotep:by/p:from/p:toand acTn'sp:endSyncout of the schema's order, and an end sync's children not at all. -
The docx bundles' hooks save back what they read. Through
docxLargeBundle(anddocxFullBundle), a read then a write lost what a hook typed only in part:w:cnfStyle's conditional attributes,w:stylePaneFormatFilter's andw:themeFontLang's empty ones, a shading's theme attributes, emptyw:trPr/w:tcBorders/w:tblBorders/w:framePr/w:lang/w:tabs, a secondw:compat(measured on the wild docx corpus: 288 of 1,469 save-backs differed from the core's).wmlRunFormatting,wmlParagraphFormatting,wmlTablePropertiesandwmlSettingsnow type an element only when it is written back as read; the others stay in_extras.
[1.2.0] - 2026-11-02
Added
- A write without
carrykeeps the relationships of the content the model does not type.docx.readsets_relationshipson the document (document._relationships), on each header, footer, footnotes, endnotes, comments, numbering and settings model and on each chart model: the relationships that part's XML names and the model does not write itself (an OLE object, an ActiveX control, a SmartArt diagram, an external picture link, a VML picture, fill or stroke, a picture bullet, an attached template or mail-merge source, a chart's embedded workbook …), with the slice of the source package they reach.docx.writewithoutcarrywrites back those its XML still names, under their source ids, with their target parts, content types and own relationships (the reference repaircarryuses); the ids it allocates avoid them. Of the 1,469 real-world docx files of the test corpus, 135 left a dangling relationship id after a write withoutcarry; two do now, both truncated sources. An unedited chart is still written as read undercarry: the field is not chart content. A consumer deep-comparing models sees the new field. extensions: 'keep'read option ofdocx.read. Keeps the elements and attributes of the Office extension namespaces (w14,w15,w16*,wp14) that markup compatibility removes by default: thew14text effects,w14:checkbox,w15:appearance… stay in the model's_extrasand are written back. A paragraph's and a table row'sw14:paraId/w14:textIdthen read asparaId/textId(a paragraph holding only a display equation keeps them too) and are written back;docx.writewrites eachparaIdonce per part, so a copied paragraph does not repeat it. The default ('drop') is unchanged and gives noparaId; another value throwsdocx/invalid-extensions.alternateContentread option ofdocx.read.'fallback'(the default) resolves everymc:AlternateContentto itsmc:Fallback, as before;'keep'leaves it in place, verbatim, in the_extrasof the element that holds it (document, headers, footers, notes, comments), anddocx.writewrites it back: a save-back no longer turns DrawingML shapes, text boxes and charts into their VML fallback. A chart part only a kept Choice references is then left unparsed and listed inunmodelledParts, so thecarrywrite option writes it back with its relationship. Another value throwsdocx/invalid-alternate-content.carrywrite option (docx.write): the partsread()did not model are written back. Pass the read result ascarryand every part listed inunmodelledParts(theme, font table, web settings, document properties, glossary document, embedded objects, …) is written with its bytes, its content type and its relationships: from the package, the document, the headers and footers (matched through theopts.headers/opts.footerskeys), the comments, footnotes and endnotes parts, and the carried part's own relationships; external relationships of those parts other than hyperlinks too. A carried relationship keeps its source id, the writer allocating its own around them, so anr:idkept verbatim in_extrasstill resolves; a carried part whose name the writer uses for one of its own parts is written under a free name in the same folder. Acarrythat is not that envelope throwsdocx/invalid-carry. Without the option the output is unchanged by it.preserveInputwrite option (docx.write,xlsx.write,pptx.write). Withtruethe writer works on a structured clone of the model and of its options (docx.write'scarry, only read, excepted), so the given model is left exactly as it was: the dehydrate pass of a bundle no longer demotes typed fields back into_extrasin it, the ids the writer assigns (docx:embedRef,chartRef,docId,storeItemID; pptx:embedRef,chartRef, a master'slayoutIds) land on the clone, and so do the writers' own patches (xlsx: the threaded comments' authors added topersons). The bytes are the same. The default (false) is unchanged; another value throwsdocx/invalid-preserve-input,xlsx/invalid-preserve-inputorpptx/invalid-preserve-input.xlsx.writeandpptx.writenow take an options object.cleanupwrite option ofdocx.write.cleanup: ['emptyProperties']drops every emptyrPr/pPr(an empty<w:rPr/>/<w:pPr/>read from a source, written back otherwise) from the body and the story parts, working on a structured clone so the caller's model is unchanged. A named list, so further cleanups can join; an unknown or repeated name throwsdocx/invalid-cleanup.danglingNumberingwrite option (docx.write). With'keep', a paragraph, header, footer, note, comment or stylenumPrthat points at a num the written numbering does not declare — or written withoutnumbering— is written as given instead of throwingdocx/numbering-unknown-num/docx/numbering-missing, so a filedocx.readaccepted can be written back (Word ignores such a reference).'throw', the default, keeps both checks; another value throwsdocx/invalid-dangling-numbering.dmlWpDrawingextension: typed drawings, and an edit keeps its source. The opt-in extension (@awacloud/ooxml/extra/dml-wp-drawing,docx.use), now part ofdocx-large(and sodocx-full), gives every drawing a typedframe(Word'swp14ids, the effect extent, the frame locks,wp:docPr's hidden flag, hyperlink and decorative flag); an anchored one a typedlayout(simple position, horizontal and vertical position, wrap with its polygon, relative size); a picture apicture(alt text, hyperlink, decorative flag, locks, blip state, local-DPI flag and colour effects, blip fill, black-and-white mode, rotation and flips, adjust guides, fill, line, effect list); a shape (wps:wsp) ashape(text-box flag, locks, a connector's connections, the shape properties, thewps:stylereferences with their colours, the body properties — insets, anchor, columns, autofit, warp — and the text box's paragraphs asdocxStructureblocks); a group or canvas a typedgroup/canvaswhose children are typed shapes, pictures and nested groups. Each colour keeps every transform; a number written with its unit (strict) is kept as that string. Its edits are written into a copy of the drawing's kept source at dehydrate, elements created at their schema place, so a resized or retitled picture keeps its locks, blip state, extension list, line and fill; a drawing whose structure changed is rebuilt as before.hydrateDrawing/dehydrateDrawinghooks, and the drawing's kept source. The docx walker runs both on every drawing of a run, the drawing's kept source their input (_source, the<w:drawing>element as read, and_read, its typed fields as read): an extension may type the source and write an edit back by replacing_source.docxDrawingexportstypedFields,keepSourceandwithRelationshipsfor such extensions.- SVG pictures in DOCX. A picture whose
a:blipcarries the Office 2016 SVG extension (asvg:svgBlip r:embed) reads withsvgRefandimage.svg({ data, contentType: 'image/svg+xml', rId }) beside its PNG fallback, in the document and its headers, footers, notes and comments;docx.writewritesimage.svgback as Word does — the SVG part, its relationship, theimage/svg+xmlcontent type and the extension in the blip — anddocxDrawing.image(bytes, { svg })(sodocx.imageRun) builds such a picture. A picture withoutimage.svgis written as before. opcCoreProperties.read(pkg): the core properties of a read OPC package — the part its root…/metadata/core-propertiesrelationship names — typed into fifteen string fields (title,subject,creator,keywords,description,lastModifiedBy,revision,category,contentStatus,language,identifier,version,created,modified,lastPrinted);nullwithout such a part, aParseErroropc/core-properties-invalidfor a part that is not core properties.opcExtendedProperties.read(pkg): the extended properties of a read OPC package (docProps/app.xml, transitional or strict relationship) — the counts (pages,words, …) as non-negative integers, the flags as booleans, the strings as text;nullwithout such a part, aParseErroropc/extended-properties-invalidfor a part that is not extended properties.ignorablePrefixesoption ofmarkupCompatibility.process— prefixes ignorable from the root down, as if the root listed them inmc:Ignorable(a supported prefix still is not;keepElementsstill win) — andooxmlShared.WORD_EXTENSION_PREFIXES, the Office extension prefixeswordRootAttrslists inmc:Ignorable, whichdocx.readnow passes as that option.- Math keeps its property elements. Each OMML construct keeps the
untyped children of its property element (
m:ctrlPr,m:type,m:degHide,m:grow…) in_prExtras; a math run keeps its otherm:rPrchildren and itsw:rPr, anoMathParaitsm:oMathParaPr; an empty character (m:begChr m:val="") reads as''. - Theme colours of runs, and two run-level attributes. Run
properties read
w:color's theme link ascolorThemeandw:u's colour and theme link asunderlineColor/underlineTheme({ themeColor?, themeTint?, themeShade? }), written back; a break readsw:clearasclear, a note referencew:customMarkFollowsascustomMarkFollows. - A content control's end properties and inline content. A block or
inline control keeps
w:sdtEndPrin_extras; an inline control's content is typed as a paragraph's children (bookmarks, fields, revisions …), any other child kept in_contentExtras;w:textkeeps its attributes (w:multiLine). - A hyperlink's other attributes.
w:tgtFrame,w:tooltipandw:docLocationread as strings andw:historyas a boolean on a hyperlink node, and are written back. - The page background.
w:background(the page colour, and a VML background with its fill) reads asdocument.background({ color?, themeColor?, themeTint?, themeShade?, _extras? }) and is written back before the body. - The paper code of a section.
w:pgSz w:codereads aspageSize.code(a number) and is written back. w:spacing@w:lineRuletyped, and the otherw:spacing/w:indattributes kept.parseParagraphProperties(paragraphs, styles, numbering levels) readsspacing.lineRule(auto,exact,atLeast, as read) and keeps every attribute it does not type (beforeAutospacing,afterAutospacing,beforeLines,afterLines,start,end,leftChars,firstLineChars, …) in the new optionalspacing.extraAttrs/indent.extraAttrs, whichrenderParagraphPropertieswrites back after the typed attributes. Those attributes were dropped on every write before (exact and at-least line spacing became auto), and an element holding only such attributes was dropped whole.
Changed
- Tracked moves are typed.
w:moveFrom/w:moveToread asrevisionnodes{ type: 'moveFrom' | 'moveTo', id, author?, date?, children }in place among a paragraph's children, and write back there. They sat in the paragraph's_extras, so a write moved them to the paragraph's end; a consumer that read them from_extrasfinds them amongchildrennow.docx.toTextreads a move destination and skips a move source. - Revision range markers are kept in place. Inside a paragraph, a
move range marker or a custom XML revision range marker went to the
paragraph's
_extrasand was written at its end; between paragraphs, in the body or in a block control, it was dropped, and in a table cell it sat in the cell's_extras, written after the cell's blocks. The twelve revision range markers now read as arangeMarkernode (name,attrsverbatim) at their place and are written back there (new node type). - Permission and proofing markers, and the bookmarks and comment ranges
between blocks, are kept in place.
w:permStart,w:permEndandw:proofErrjoin therangeMarkernode, in place inline and between blocks: a paragraph held them in its_extrasand wrote them at its end, the body dropped them. Bookmarks and comment ranges between blocks — in the body (main document and story parts), a block control's content, a table cell — read as their typed nodes at their place and are written back there:docx.readdropped those of the body and of block controls and a cell held its own in its_extras, written after its blocks. A bookmark keepscolFirst/colLastand every markerdisplacedByCustomXml. A body child the model does not type is kept indocument._extras, a block control's in_contentExtras. A consumer walking the body or a cell must type-check the new marker nodes there. - Cells and rows inside a content control are read in place. A
row-level
w:sdt(wrapping cells) or a table-level one (wrapping rows) stayed raw in the row's or table's_extras, so every walker ofrow.cells/table.rowsmissed its content, and a write put a cell inside a control at the row's end, shifting the columns. Its cells and rows are now ordinary nodes at their place, with an optionalsdtlist naming the controls around them ({ group, properties?, _extras?, _contentExtras? }); the write puts them back inside their controls. A model withoutsdtwrites as before. - A cell's block-level content control is typed in place. A
w:sdtamong a cell's blocks reads as the body's does — ablockSdtat its place in the cell'schildren— and is written back there: it was kept raw in the cell's_extras, written after the cell's blocks. A consumer walking a cell's children must type-checkblockSdtthere. - The docx walker visits notes and comments. An extension's hooks now
see the footnotes', endnotes' and comments' blocks at read and at write,
as they see the body's, the headers' and the footers'
(
docx.writehands itsfootnotes/endnotes/commentsto the dehydrate pass). A consumer of the opt-inwml-*extras finds a note's or a comment's run, paragraph, table and settings properties typed where it found them in_extras, anddmlWpDrawingwrites an edited note drawing into its source. - Drawings are written from their source.
docx.readkeeps each drawing's<w:drawing>element (_source) and its typed fields as read (_read);docx.writewrites an untouched drawing from that source, the ids it assigns (docId,embedRef,svgRef,chartRef) set in it, so a picture's locks, blip state, line, alt text, extension list, a shape's style references, groups and canvases are no longer rebuilt away. An edited drawing, or one whose source names a relationship the written part does not hold, is built from its typed fields as before.docxDrawing.withRelationshipssets those relationships. The Office extension attributes the default read drops stay lost unless the read usesextensions: 'keep'. A consumer deep-comparing drawings sees the two new fields. maxPartsdefaults to 8,192 (was 1,024) inopc.defaultLimits, soopc.read,docx.read,xlsx.readandpptx.readaccept real packages of several thousand parts (a deck of about 5,000 parts, most of them media, or a 1,714-part LibreOffice export, both refused withopc/zip-bombbefore). Release note: a package of 1,025 to 8,192 parts that 1.1.0 refused now reads;maxUncompressed(256 MiB) andmaxRatio(200) are unchanged and still bound the payload, and an explicitmaxParts: 1024keeps the old cap.- The bundle pages say which extras type a read. Of all the bundles'
extras only
wmlRunFormatting,wmlParagraphFormatting,wmlTableProperties,wmlSettingsanddmlWpDrawingcarry a walker hook; the others are parse / render toolkits a read never calls, so a read throughxlsx-*/pptx-*types what the core types. Each bundle page lists the two groups, the unmeasured "~95 %" / "every element typed or preserved" claims are gone, and the coverage guide's+ Extrascolumn says it counts what an extra names. A test keeps each page's list and the code together.
Fixed
- An empty
w:tblBordersis written back. It read astblPr.borders = {}and was written as nothing, so a save dropped it; it has nothing to type, so it now stays verbatim intblPr._extras, written back in place (bordersis absent for such an element). - Colour transforms kept by the DrawingML toolkits. The shared colour
codec keeps a transform it does not list (
a:satMod,a:alpha,a:hueMod…) as{ kind, attrs }instead of dropping it, anddmlFillsAdvancedreads its gradient-stop and pattern colours with their transforms (mods). wmlSettingskeepsw:attachedTemplate. The extension read it as aw:valelement, but it names its template byr:id, so a write throughdocx-largedropped it; it now stays verbatim in_extras.- A false placeholder flag stays false.
w:showingPlcHdrread as true whatever its value, sow:val="0"was written as a placeholder shown; its value is read, and false is writtenw:val="0". - An empty section is written back. An empty
<w:sectPr/>read as nothing, so the save-back dropped it; it reads as{}and is written back empty. - No paragraph added to a cell whose block content is kept verbatim.
The write added an empty
<w:p/>to a cell with no typed paragraph, even when the cell held block-level content kept in its_extras(aw:customXmlorw:altChunk): the save-back gained a paragraph. It now adds one only to a cell with no block-level content at all. - No adjacent text nodes in a raw subtree. Where a read removed a
node between two pieces of text — an ignorable element (a
w15:appearancein a content control), anmc:AlternateContentresolved to nothing, an XML comment the parser skips (in aw:sectPr) — the raw subtree the read model keeps held the text as two adjacent nodes; the write serialises them as one, so read, write, read was not a fixed point.markupCompatibility.processnow merges them into one text node, on every part of docx, xlsx and pptx it runs on. - An undeclared Office extension prefix reads as the written part
does. A part that used
w14(orwp14,w15,w16*) without listing it inmc:Ignorablekept that content in the read model, while the writer lists every such prefix inmc:Ignorable, so the read of the written part dropped it: no fixed point.docx.readnow treats those prefixes as ignorable in every part, whether listed or not, as it already did for every part that lists them. - An empty drawing name is kept. An empty
wp:docPrname read as none and was written as'Picture', and an empty picture name (pic:cNvPr) was written as thewp:docPrname. Both now read and write as the empty string the source holds. - A hyperlink keeps its whole content. A
<w:hyperlink>read only its runs, so a revision (<w:del>,<w:ins>), a bookmark or comment-range marker, a<w:proofErr>or any other child inside a link was dropped on every write (a table of contents' deleted entries among them). Its children are now typed as a paragraph's, in place, and any other child stays in the hyperlink's own_extras. A hyperlink'schildrenare no longer only runs: a consumer walking them must type-check each, as for a paragraph's.docx.toTextreads them as a paragraph's (an insertion inside a link shows, a deletion does not). - Nothing inside a tracked change is dropped. A
w:ins/w:delkept only its runs: a hyperlink, simple field, inline SDT, math zone or nested revision inside it was lost on read. Its children are now typed as a paragraph's, and any other child stays verbatim in the revision's_extras.docx.toTextreads a hyperlink inside an insertion. - Preserved property children read in schema order. The run,
paragraph and table property bags kept their preserved children
(
_extras) in the source's order, which the writer corrects to the schema order, so a source listing them out of order did not read as its written form. They now read in that same order. - Field characters keep their child and their lock. A
<w:fldChar>read as its kind and dirty flag only, so the<w:ffData>of every legacy form field (text input, check box, drop-down), a<w:fldData>, a tracked<w:numberingChange>and thew:fldLockattribute were dropped on every write. The child now stays verbatim in the node's_extrasand the lock reads asfldLock: true(new optional key); both are written back. - Empty run and paragraph properties round-trip. An empty
<w:rPr/>or<w:pPr/>(LibreOffice writes them), and an empty paragraph-mark<w:rPr/>, read as an empty object but were not written back, so a read of the written file lost the object. The document writer now writes the empty element for an empty object; a run or paragraph without properties writes none, as before. - Strict page sizes and margins.
docx.readread the universal measures strict OOXML writes inw:pgSzandw:pgMar(612pt,21cm,1in) asNaN, anddocx.writewroteNaNback; they now read as twips. - Three more validity defects of the docx writers. A delimiter's
m:dPrwas writtenbegChr,endChr,sepChr(CT_DPrputssepChrsecond); an emptyw:authorof aw:ins/w:delor a comment was dropped although the attribute is required (it is now read as''and written back); and thewmlSettingsextension wrotew:noLineBreaksBefore/w:noLineBreaksAfterbare, losing their requiredw:langandw:val— the element read is now written back while its toggle stays on. - An unedited chart is written back as read (with
carry). A chart part was always rewritten from the chart model, which keeps the title, the plot and the legend only: styles, colours, text properties and the chart's ownmc:AlternateContentwere lost on every save-back. Withcarry, a chart whose model is unedited is now written with its source bytes (and its relationships); an edited one is still written from the model. - The relationships of the parts
docx.writewrites. The writer claimed fresh relationship ids (styles, numbering, settings, comments, notes) before reserving those it keeps from the model (header and footer keys, hyperlinks, pictures, charts), so a package could hold two relationships with one id. Withcarry,settings.xml,numbering.xmlandstyles.xmlnow keep their relationships to carried parts and their external ones (an attached template, a picture bullet), and every relationship id a written part still references in its XML is written back from the source with its target part and that part's own relationships: a VML picture or fill of a header or a footnote, a chart inside a text box, a written chart part's embedded workbook. - Schema order of the children the docx writers keep verbatim. The
core cell-properties writer appended the
w:tcPrchildren it keeps afterw:tcW,w:gridSpanandw:vMerge, so aw:cnfStyle(and, through thewmlTablePropertiesextension,w:tcBorders,w:noWrap,w:tcMar…) was written out ofCT_TcProrder; the extension's ownw:tblPrwriter putw:tblCellMarbeforew:tblLayoutand the kept children (w:shd) last;wmlSettingswrote thew:compatSettingchildren before the legacyw:compattoggles; andw:uiCompat97To2003was written last insettings.xml. All four now follow the schema; a document already in order is written unchanged. - DrawingML lines keep what they do not type, and kept shape
properties go back to their schema place.
drawingmlShape.parseLinedropped everya:lnchild but ana:srgbClrfill,prstDashandnoFill: a theme-coloured line (schemeClr, with its transforms), a gradient or pattern line, a custom dash, the joins and the arrow heads were lost on read and on write, and so was thealgnattribute. They are now kept verbatim in the optionalline._extrasandline.extraAttrsand written back in schema order;line.colorkeeps its meaning (theRRGGBBof ana:srgbClr,nullfornoFill), and a typedcolorordashset on such a line replaces the kept fill or dash.renderShapePropertiesalso wrote thespPrchildren it keeps verbatim aftera:ln; a custom geometry or a gradient fill now goes before it, effects after it, asCT_ShapePropertiesorders them. docx.writeimages: an entry without bytes is skipped.docx.readlists an external picture (a relationship withTargetMode="External") inimageswith nodata; passed back through theimageswrite option, it was written as a relationship to a media part holding no bytes. Such an entry (or anullone, which threw aTypeError) is now skipped; withcarrythe external relationship itself is written back.
[1.1.0] - 2026-10-21
Added
-
docx run fonts keep every
w:rFontsattribute. The run properties of runs, paragraph marks, styles, docDefaults and numbering levels gain an optionalfontsfield: every attribute of<w:rFonts>by its local name (ascii,hAnsi,eastAsia,cs,hintand the four theme attributes), written back as read.fontkeeps its meaning: a changedfontis written toascii,hAnsiandcs(their theme attributes dropped so the edit applies), a removed one removes them;eastAsiaandhintalways stay. A<w:rFonts>holding onlyw:hint— with its<w:rPr>— now survives a read and a write. Models withoutfontsare written as before; a read model compared field by field now showsfontsbesidefont. -
slideExtrasByPartread option (pptx.read, and the second argument ofparseSlide/parseSlideLayout/parseSlideMaster). Withtrue, the leftovers of each slide, layout and master's<p:cSld>are kept in a newcSldExtrasarray and_extrasholds the root's only; by default both go to_extrasand the root's replace those of<p:cSld>(a<p:cSld><p:extLst>beside a<p:timing>was lost). The writers put a split model's elements back at the level each came from, each written once. The default model is unchanged. -
DrawingML colours keep their transforms. Shape fills (
{ rgb }/{ schemeColor }) carrymods: [{ name, val? }](lumMod,lumOff,tint,shade,alpha, …) and write them back,shapePropsincluded.ooxmlSharedgainscreateTypedColorCodec, the codec behind the typed colour. -
typedRunColorsread option (pptx.read,xlsx.read, and thedrawingml/pptxSlide/pptxTable/xlsxDrawingsparse functions). Withtrue, a text-run fill that a bare'RRGGBB'cannot express — a theme colour, or any colour with transforms — is typed asrPr.color = { rgb | schemeColor, mods? }instead of staying verbatim inrPr._extras. The default keeps the 1.0.0 model;renderRunPropertieswrites both forms. -
Picture crop.
a:blipFill/a:srcRectreaches the docx drawing node and the pptx picture assrcRect: { l?, t?, r?, b? }(sides in 1/1000 of a percent) and is written back.ooxmlSharedgainsparseSrcRectandsrcRectAttrs. -
xlsxrow heights and hidden rows. The<row>attributesht,customHeightandhiddenreach the model assheet.rowProps(keyed by row index, with the row numberr) and are written back; a sheet with none of them has norowProps.
Changed
-
A new archive limit,
maxDepth, refuses an XML part nested deeper than 1,000 elements.opc.readscans every.xml,.relsand.vmlpart before any is parsed and throwsParseErroropc/xml-too-deep(context.limit,context.max,context.partName) for a part whose elements nest past the limit;docx.read,xlsx.readandpptx.readforwardmaxDepthfrom their options, and0disables it. The readers and every consumer of the model walk the trees recursively: a document of 5,000 nested tables overflowed the call stack with an untypedRangeError. Release note: a document whose XML nests deeper than 1,000 elements, which used to read up to the stack limit, is now refused by default — no real file of the 2,938 measured (Apache POI and LibreOffice test documents) nests past 52; passmaxDepthto read deeper ones.defaultLimitsgainsmaxDepth: 1000. -
xlsxreadstrueas well as1for boolean attributes. A<col>withhidden="true"orbestFit="true"was read as neither hidden nor best-fit; it now readshidden: true/bestFit: true, as the<row>attributes ofsheet.rowPropsdo. -
docx.writechecks every list reference.docx/numbering-missingnow also covers footnotes, endnotes, comments andopts.styles(each style and the docDefaults), and anumIdthatopts.numbering.numsdoes not declare throws the newContractErrordocx/numbering-unknown-num; both carrycontext.story(pluskey/styleId). A write that used to emit a danglingw:numIdnow throws instead. -
docx block math sits inside a paragraph. The schema allows
m:oMathParaonly inside aw:p, sodocx.writenow writes a body-leveloMathParanode (document body and story parts) as aw:pwith now:pPrholding only thatm:oMathPara, as Word does; it used to write it straight underw:body, which validators reject. Release note for readers:docx.readnow turns such a paragraph — now:pPr, onem:oMathParaas its only element child, the usual shape of a display equation in a Word file — into the body-level{ type: 'oMathPara' }node, where 1.0.0 read it as aparagraphwith them:oMathParain its_extras. A paragraph with aw:pPror any other child keeps the 1.0.0 shape, and a bare body-levelm:oMathParastill reads as before.
Fixed
-
Pictures on slide layouts and slide masters carry their image.
pptx.readresolved theimage(data,contentType,rId) of the pictures of slides only; a picture of a layout or a master, such as a template logo, kept itsembedRefwith no bytes. It is now resolved through the layout's or the master's own relationships.write()is unchanged: it does not readimageon layout or master shapes. -
A malformed XML part is a typed refusal in every reader. A part
docx.read,xlsx.readorpptx.readparses without a typed wrapper of its own (docx styles, numbering, settings, notes, comments, headers, footers, charts; xlsx shared strings, styles, tables, comments, drawings, charts; pptx slides, layouts, masters, theme, charts) let the fwXmlParseError(xml/parse-error) through, against the documented rule that every throw of the package is anOoxmlError. It now throwsParseErrordocx/invalid-part-xml,xlsx/invalid-part-xmlorpptx/invalid-part-xml, the parser's error kept ascause; a malformed worksheet part ofxlsx.readthrowsxlsx/invalid-sheet-xml(withcontext.partName), likexlsx/invalid-workbook-xml. Release note: code that caught these reads by the fwxml/parse-errorcode must now test for theParseErrorclass or the new codes. Any other error is unchanged. -
docx revision tracking is
w:trackRevisions.trackChanges: truein the settings was written as<w:trackChanges/>, an element the settings schema does not have, and a real file's<w:trackRevisions>stayed untyped in_extras. The writer now writes<w:trackRevisions/>and the reader types<w:trackRevisions>— and the<w:trackChanges>1.0.0 wrote — astrackChanges; an_extrascopy is not written twice. WithwmlSettings, a real file still reads as thetrackRevisionstoggle, and the core boolean is no longer written as<w:trackChanges/>. -
docx settings demoted by an extension are written.
docx.writeran thedehydrateSettingshooks but wroteopts.settingsas given, whilewmlSettingsreturns the demoted settings as a new object: every typed flag of that extension (autoHyphenation,trackRevisions,decimalSymbol…) was left out ofword/settings.xml. The part is now written from what the hook returns;opts.settingsis still left as given. -
pptx masters list only the layouts written.
pptx.readkeeps the layouts the slides use but the master's wholelayoutIdslist, andpptx.writenumbers the written layouts' relationshipsrId1…rIdKand wrote that list unchanged, so a deck with unused layouts was written withp:sldLayoutIdentries naming missing (or wrong) relationships. Each master'sp:sldLayoutIdLstnow names exactly the written layouts: other entries are left out, a missing one gets a fresh id. The model is not modified. -
pptx slide-level elements written once, at the slide level. A slide, layout or master's
_extrasholds the leftovers of the root, or those of<p:cSld>when the root has none; the writers put every one of them inside<p:cSld>AND at the root, so a slide's<p:transition>or<p:timing>was written twice, once where validators reject it. Each element is now written where the schema places it —<p:transition>,<p:timing>,<p:hf>at the root (in a master, before<p:txStyles>),<p:custDataLst>and<p:controls>inside<p:cSld>— in schema order;<p:extLst>keeps its two copies, except in a model read withslideExtrasByPart, which writes each leftover once, at its own level. The read model is unchanged. -
DrawingML text properties in schema order. The paragraph and run properties of every DrawingML text body (pptx slides, masters, layouts and tables, xlsx drawings, charts) were written with the typed children first — the bullet,
defRPr, the fill,latin— and the preserved ones after, so a read → write of real files put, for example,a:buCharbeforea:spcBefora:latinbeforea:effectLst, which validators reject.a:pPr,a:rPranda:defRPrnow follow the schema order; the read models are unchanged. -
docx anchored drawings in schema order.
docx.writewrote the preserved positioning and wrap children of awp:anchor(simplePos,positionH,positionV,wrapNone…) beforewp:extent, so every floating picture read from a Word file was written back out of theCT_Anchororder, which validators reject. The children now follow the schema order, the Word 2010wp14:sizeRelH/wp14:sizeRelVafter the graphic; the read model is unchanged. -
xlsx threaded-comment ids in upper case.
generateId(used by the xlsx writer for comment, person and parent ids it creates) wrote the GUID in lower-case hexadecimal; the schema'sST_Guidpattern, and Excel, use upper case, so validators rejected every generated id. Ids a caller passes are still written as given. -
docx drawing ids unique in the document. Every drawing built through the API (
imageRun,chartRun,shapeRun) was written with<wp:docPr id="1">, so a document with two drawings carried a duplicate id, which validators reject (ECMA-376 Part 1 § 20.4.2.5).docx.writenow gives each drawing of the body and of the story parts an id unique among them, keeping the ids it is given when they do not clash, and patchesdocIdin place. -
docx parts written in schema order. Every docx writer emitted its typed children, then the elements a read preserved in
_extras, at the end; OOXML child lists are sequences, so a read then write of a real document produced invalid styles, numbering, settings, section, run, paragraph and table properties, and table rows (w:trPrafter the cells). Run properties also wrotew:ubeforew:highlight. The run, paragraph and table properties, styles (each style and the part), numbering (levels, abstract numberings, the part), settings and section properties now order their children by their ECMA-376 sequence, anmc:AlternateContenttaking the place of the element it stands for; rows writew:tblPrExandw:trPrbefore the cells.ooxmlSharedanddocxPropertiesgainsequenceandorderBySequence. -
Chart series data in the form the schema allows, and Office charts read with their values. The chart writer put each literal inside a reference (
<c:strRef>holding<c:strLit>,<c:numRef>holding<c:numLit>, with an empty formula), whichCT_StrRef/CT_NumRefforbid: validators rejected every chart written in docx, xlsx and pptx. It now writes the name as<c:tx><c:v>, categories as<c:strLit>and values as<c:numLit>directly under their data element. The reader looked for that same nesting and never for the cache a reference holds (<c:strCache>/<c:numCache>), so a chart written by Office read with empty series; it now reads the cache, and the earlier form still reads the same. -
pptx slide size under its schema name. The writer emitted the slide size as
p:sldSize, an elementCT_Presentationdoes not have (p:sldSz), so validators rejected every written presentation; the reader looked for the same wrong name, so thep:sldSzof a real file was never typed (presentation.sldSizestayed absent) and a read then write replaced its size by the 4:3 default. Both now usep:sldSz; a file this package wrote before still reads itsp:sldSize. -
docx tables carry the
w:tblPrandw:tblGridthe schema requires. A table built through the API (tableFromRows, or any table node read with no grid) was written withoutw:tblGrid, and withoutw:tblPrwhen it had no properties;CT_Tblrequires both, and OOXML validators reject such a table. The writer now emits an emptyw:tblPrwhen the table has none, then the preserved grid or one derived from the rows: onew:gridColper column of the widest row (a cell counting itsgridSpan), withw:wwhen a span-free row as wide as the grid gives every cell adxawidth. Read back, both sit in the table's_extras, so a second write gives the same bytes. -
Pictures and charts in headers, footers, notes and comments. On write, a story-part drawing got no media / chart part and no relationship in that part's table, so its
r:embed/r:iddangled; on read, story drawings were resolved against the document part's relationships, so a header picture never came back (or came back as the body picture sharing its rId). Each story part now reads and writes its own image and chart relationships; media parts are shared with the body.write()patchesembedRefandchartRefin place on those drawings, as it does on the body's. -
The docx root declares every prefix it uses.
docx.writeemitted inline and anchored pictures aswp:elements with noxmlns:wpin scope, so Word refused the file.ooxmlShared.wordRootAttrsnow declares each known prefix used outside a declaration of its own (wp,v,o,m,w14, …) and every prefix anmc:Choicenames inRequires, extensions listed inmc:Ignorable, on the document, header, footer, notes, comments, styles and numbering roots (styles keptw14:ligaturesand numbering keptmc:AlternateContentundeclared on a read → write of real Word files). A part without such prefixes keeps its root byte for byte.wordRootAttrs(nodes, opts?)takesopts.r: falseto declareronly where a name uses it, as the styles and numbering roots do. -
Errors survive the fw sanity layer.
OoxmlErrordefinednameby assignment, which throws aTypeErroronceapplyBase()has frozenError.prototype, so the typed error (code, context) was lost.nameis now an own property set withObject.defineProperty(same shape: writable, enumerable, configurable).
[1.0.0] - 2026-10-07
Added
-
Archive limits on
read()—docx.read,pptx.readandxlsx.readacceptmaxParts,maxUncompressedandmaxRatioand forward them toopc.read; the defaults are unchanged and0disables a check. Thexlsx.readcell caps stay in the same options object. Committeddist/**bundles regenerated. -
ooxmlShared.wordRootAttrs(nodes)— the root attributes of a WordprocessingML part:wandralways;mc,w15andmc:Ignorable="w15"when aw15:element is present. The story-part parse functions (docxHeaders.parse,docxFootnotes.parseFootnotes/parseEndnotes,docxComments.parse) accept a parsed root. -
read()lists the parts a re-write drops —docx.read,xlsx.readandpptx.readreturnunmodelledParts: the package parts the model does not carry, whichwrite()does not reproduce ([{ partName, contentType }], sorted,[]when nothing is dropped). The record is computed by the newooxmlShared.trackUnmodelledParts(pkg, consume), which runs the read over an access-tracking view ofpkg.parts; the returnedpackagestays the plain object. Committeddist/**bundles regenerated. -
markupCompatibility.processoptionkeepElements— a list of qualified element names kept wherever they appear, even when their prefix is ignorable;mc:AlternateContentandmc:*attributes inside them are still resolved. Absent or not an array, nothing changes. -
Read-limit boundary tests — every
opc.readandxlsx.readlimit has an at-boundary, an over-boundary and a0(disabled) test. -
Typed table cell margins —
docxPropertiestypes<w:tblCellMar>astblPr.cellMargins(six edges:top,start,left,bottom,end,right, each a{ w, type }width; any other child verbatim incellMargins._extras), on tables and table styles alike, so a composer can pad table cells without hand-authoring XML.renderTablePropertieskeeps the schema order: the_extrasthat followtblCellMar(tblLook,tblCaption,tblDescription,tblPrChange) render after it, every other extra before it, so a schema-ordered<w:tblPr>round-trips unchanged.wmlTablePropertieskeeps its shape (it re-parses the core-rendered element). Committeddist/**docx bundles regenerated. -
Typed table properties —
docxPropertiesgainsparseTableProperties/renderTablePropertiesfor<w:tblPr>(style,width,borderswith six edges; everything else verbatim in_extras);docxStructuretypestblPron the table node anddocxStyleson a style (read + write, round-trip), so a composer can border a table without hand-authored XML. A table or style with notblPrrenders byte-identically to before. The opt-inwmlTablePropertiesextension re-derives its own fulltblPrshape from the core-typed bag (read shape and write bytes unchanged; pinned by parity tests). ABordercarries every attribute beyondval/sz/space/color(w:themeColor,w:themeTint,w:shadow,w:frame, ...) verbatim inextraAttrs, so atblBordersround trip is lossless with or without the extension. Committeddist/**docx bundles regenerated. -
Core surface — Open Packaging Conventions (
opcPackage,opcContentTypes,opcRelationships, ECMA-376 part 2) read/write ZIP-based packages with full[Content_Types].xml+.relsresolution. WordprocessingML (ECMA-376 §17) —docxorchestrator + part-level modules (properties,structure,styles,numbering,settings,comments,footnotes,headers,drawing,customXml,docx-walker,docx-text) covering paragraphs, runs, tables, sections, hyperlinks, bookmarks, ins/del, footnote/endnote/comment refs, header/footer parts, inline images, DrawingML shapes, custom XML data binding, OMML math. SpreadsheetML (ECMA-376 §18) —xlsxorchestrator + part-level modules (styles,tables,conditionalFormatting,comments,threadedComments,drawings,xlsx-walker) covering rows/cells, formulas, merges, columns, sheet views, auto-filter, hyperlinks, data validations, tables, conditional formatting + dxfs, comments (classic + threaded 2018+), drawings with charts and anchored images. PresentationML (ECMA-376 §19) —pptxorchestrator + part-level modules (theme,slide,picture,table,chart,pptx-walker) covering slides/layouts/masters, typed placeholders, text bodies, theme, inline pictures, tables, charts. DrawingML (ECMA-376 §20) —drawingml,drawingmlChart,drawingmlShape, the shared graphics surface used by all three formats. Office Math (ECMA-376 §22.1) —ooxmlMath(OMML parser/renderer). Markup Compatibility (ECMA-376 part 3) —markupCompatibilitystrips/preservesmc:AlternateContentblocks for Office 2010+ compatibility. XML parsing/serialization is delegated to@awacloud/fw/io/codec/xml.js(modulexml) — the package ships no local XML parser (see Changed). -
Typed errors — the
ooxmlErrorsfactory exposesOoxmlError,ParseError,RenderError,ContractError; everythrowin the package uses these classes with a stable, namespacedcodeand a structuredcontext. Consume viaruntime.resolve('ooxmlErrors')orooxmlErrors.factory(). -
Shared helper factory
ooxmlShared— canonical namespace map (NS.{W,A,R,SS,P,C,M,MC,WP,PIC,XDR,DS,TC,ACTIVEX}), relationship types (REL_TYPE.{DOC,HYPERLINK,IMAGE,STYLES,NUMBERING,SETTINGS,COMMENTS, FOOTNOTES,ENDNOTES,HEADER,FOOTER,CUSTOM_XML,CUSTOM_XML_PROPS,CHART, PACKAGE,DRAWING,TABLE,SHEET,SHARED_STRINGS,VML_DRAWING, THREADED_COMMENT,PERSON,SLIDE,SLIDE_LAYOUT,SLIDE_MASTER,THEME}), content types (CT.{DOCUMENT,STYLES_W,STYLES_X,NUMBERING,SETTINGS, COMMENTS_W,COMMENTS_X,FOOTNOTES,ENDNOTES,HEADER,FOOTER,WORKBOOK,SHEET, SHARED_STRINGS,DRAWING,TABLE,CHART,EMBEDDED_XLSX,PRESENTATION,SLIDE, SLIDE_LAYOUT,SLIDE_MASTER,THEME,VML_DRAWING,CUSTOM_XML_PROPS}), EMU conversion (EMU_PER_INCH,EMU_PER_CM,EMU_PER_PT,EMU_PER_PX_96,toEmu,inchesToEmu,cmToEmu,ptToEmu), boolean-attribute helpers (readBoolAttr/writeBoolAttr),partExt,lookupCT, a singleton-backed UTF-8 codec (encodeText/decodeText), and a stateful relationship-id allocatorcreateRidAllocator({ prefix, start, existing })(next/peek/reset/usedIds/claim/register, independent per-instance closure state — no shared global state). Color codec builders:createDmlColorCodec(xml)(DrawingML color parse/render with an opt-inwithModsflag reconciling thedml-effectstransforms-preserving semantics and thedml-fills-advancedflat-reference semantics; also backsdrawingml'ssrgbClrbuilder) andcreateXlsxColorCodec(xml)(union semantics overrgb/theme/tint/indexed/auto, emittingautoonly when truthy; consumed byxlsx/stylesandxlsx/conditionalFormatting).ModuleRuntimeconsumers getooxmlSharedinjected automatically wherever declared as a dependency. -
Coverage extras (opt-in, 36 modules under
src/extra/) reach 100% of the ECMA-376 strict surface with no load cost for the core: WordprocessingML (8 phase + misc —wml-run-formatting,wml-paragraph-formatting,wml-table-properties,wml-numbering-details,wml-settings,wml-fields,wml-tracked-changes,wml-vml-legacy,wml-misc), SpreadsheetML (5 phase + misc —sml-pivot-tables,sml-calculation,sml-sheet-config,sml-workbook-config,sml-form-controls,sml-misc), PresentationML (4 phase + misc —pml-animations,pml-transitions,pml-notes,pml-layouts-typed,pml-misc), DrawingML chart (5 phase + misc —dml-chart-data-labels,dml-chart-trendlines,dml-chart-axes-advanced,dml-chart-3d,dml-chart-other-types,dml-chart-misc), DrawingML main (3 phase + misc —dml-effects,dml-fills-advanced,dml-shapes-advanced,dml-main-misc), DrawingML positioning (dml-wp-positioning,dml-xdr-advanced), Math (math-advanced,math-misc), legacy/transitional (transitional— ECMA-376 part 4,legacy-vml— standalone VML). Each declares its own dependencies and is worker-safe (factory.toString()rehydration). -
Bundles —
docx-large/docx-full,xlsx-large/xlsx-full,pptx-large/pptx-full: pure fw module descriptors ({ name, dependencies, factory }) combining the core orchestrator with its P0/P1 extras (*-large, ~95% real-world usage) or the full P0–P2+misc+transitional+legacy-VML set (*-full, 100% strict coverage). Consumed exclusively viaModuleRuntime.register(...)+resolve('docxLargeBundle')etc.; all six descriptors are re-exported frommain.js. -
Extension hook
.use(...)ondocx/xlsx/pptx— afterread(), the walker offers each visitedrPr/pPr/tcPr/table/row/settings/workbook/sheetnode to extensions implementing the matchinghydrate*hook; beforewrite(), the symmetricaldehydrate*hook runs. Idempotent registration (.use()ignores an already-registered instance);docxWalkerpre-indexes hooks by name for O(N_hits) dispatch. -
Pre-built single-factory bundles — two-surface
dist/.tools/generate-bundles.mjs(bun run gen:bundles, a thin wrapper around@awacloud/tool-prebuild-generator) emits, per assembly root (9:docx/docx-large/docx-fulland the same forxlsx,pptx), two path-discriminated surfaces side by side underdist/:dist/standalone/<root>.{js,min.js,meta.json}(dependencies: [], every fw + ooxml-local factory inlined, zero runtime registration) anddist/build/<root>.{js,min.js,meta.json}(declares the 7 fw modules —xml,bitstream,huffman,lz77,deflate,zip,crc32— as dependencies, inlines only the ooxml-local factories, smallest payload). Each.jshas a minified.min.jstwin and a.meta.jsonsidecar (fwDependencies, sourcemodules, byte sizes);dist/build/ index.jsis a barrel re-exporting the whole@awacloud/ooxmlnamespace for bulk registration on an@awacloud/fwruntime. Both surfaces expose a single factory call returning the same enriched core orchestrator as the legacy declarative bundles, under the resolve keys<root>Bundled(standalone) /<root>Package(build) — e.g.docxLargeBundled/docxLargePackage.package.jsonexposes./build/*and./standalone/*. Documented indocs/api/bundles/prebuilt/README.md. Output is deterministic (see Changed — Dist). -
Documentation —
docs/README.mdtop-level index;docs/api/one page per source module (core,extra/opt-in,bundles/), following thedoc-format.mdconvention (YAML frontmatter — module/category/ dependencies/returns/worker-safe/status — metadata line, API table, examples, Notes, See also);docs/guide/user guides —getting-started,read-write-docx,read-write-xlsx,read-write-pptx,extending,performance(Web Worker integration recipe and resource-bound options),coverage,opc-overview;docs/api/errors.md— full catalog of error codes by namespace. -
Tests + integration — unit tests co-located per module; roundtrip integration test wiring all three formats through fw's
ModuleRuntime(tests/roundtrip.integration.test.js); fuzz/malformed-input test asserting a typed error on garbage/empty/corrupt input, including XXE and billion-laughs (tests/fuzz.test.js);tests/package-exports.test.jsverifying everypackage.json#exportssub-path resolves with at least one named export; a seeded random-attribute roundtrip pass over eachextra/misccatalog (src/extra/misc.test.js); shared test helpers (tests/_helpers/build.js—buildXml,buildDocxProps,buildOpc,buildDocxStack). -
Architecture — strict ECMA-376 coverage by default, transitional variants surfaced via the dedicated
extra/transitionalmapper; layered architecture (stable core delegates parsing depth to per-element extras opted in by the consumer, unknown elements kept in_extrasarrays for roundtrip fidelity); factory pattern ({ name, dependencies, factory }) compatible with@awacloud/fwModuleRuntimeDI; worker-safe (every factory is a self-contained closure, no closure on mutable module-level state — see Changed); browser-only (Uint8Array,TextEncoder,TextDecoderonly); zero external dependency beyond@awacloud/fw(workspace). -
Package surface —
package.jsonexposes:. src/main.js all modules + modules[] ./docx src/docx/docx.js core WordprocessingML ./docx-large src/bundles/docx-large.js ./docx-full src/bundles/docx-full.js ./xlsx src/xlsx/xlsx.js core SpreadsheetML ./xlsx-large src/bundles/xlsx-large.js ./xlsx-full src/bundles/xlsx-full.js ./pptx src/pptx/pptx.js core PresentationML ./pptx-large src/bundles/pptx-large.js ./pptx-full src/bundles/pptx-full.js ./opc src/opc/package.js ./drawingml src/drawingml/drawingml.js ./errors src/errors.js ./extra/* src/extra/*.js 36 opt-in modules ./bundles/* src/bundles/*.js 6 compositions ./build/* dist/build/* two-surface prebuilt (fw-DI variant) ./standalone/* dist/standalone/* two-surface prebuilt (framework-free)awa.maturity: "L4"(the initial core surface shipped at L2, then progressed L2 → L3 → L4 with the legal-metadata hygiene).
Changed
- API reference and source comments describe each opt-in module by what it
covers — internal milestone labels are removed from the
extra/pages and module comments, and thedocx/structuresource documentation now lists the hyperlink model'stargetandexternalfields. docx.writerejects a hyperlinkrIdit cannot resolve (breaking, pre-1.0) — it throwsContractErrordocx/hyperlink-unresolved-rid(context.rId,context.story) for a hyperlink whoserIdhas no relationship in its part, including a body node whoserIdis not a key of a suppliedopts.hyperlinks(that option still replaces the derived map). Thedocx/hyperlink-missing-ridcheck now also covers footnotes, endnotes and comments.docx.writefails explicitly instead of losing content (breaking, pre-1.0) — it throwsContractErrordocx/hyperlink-missing-ridfor a hyperlink with a target and norId, anddocx/numbering-missingfor list references (pPr.numPr) written withoutopts.numbering, instead of silently writing a lost target or dangling list references. Both checks run before any part is rendered and leave the input model untouched.opc.writeoutput is byte-reproducible — every entry is stamped 1980-01-01 00:00 by default (overridable withopts.mtime, aDateor a number), so.docx/.xlsx/.pptxoutput is byte-reproducible.- Generated ids need Web Crypto (security) — generated custom-XML store
ids and threaded-comment ids use
crypto.getRandomValuesonly; without it they throwdocx/no-random-source/xlsx/no-random-sourceinstead of falling back toMath.random. Pass the ids explicitly where Web Crypto is unavailable. - Coverage claims qualified — the coverage pages define "full" as every schema element typed or preserved as a passthrough (not a conformance measurement), no longer print unreproducible benchmark figures, and state the extras naming rule.
- Round-trip claims — the README, guides and API pages say what is preserved (elements inside the parts the model carries) and what is not (whole parts outside the model); the three read result shapes are documented.
- Source comments — translated to English; references to an internal audit page removed.
- Dist — dist regenerated with the licence banner: every committed
dist/**/*.js/.min.jsopens with the package's/*! … */legal block, each*.meta.jsonbytesentry is measured on the final bytes, and thebuiltAttimestamp is gone —bun run gen:bundlesis byte-deterministic. - Package contents — the npm tarball now ships
NOTICE(dual licence + third-party attributions) next toLICENSE. - Worker-safe factories — every ooxml factory is a self-contained
closure: nothing the factory body references is declared at module
scope. Module-level constants relocated into the owning factory body
(
DEFAULT_LIMITS/LEADING_SLASH_REinopc/package.js,HOOK_NAMESindocx/docx-walker.js,VML_ATTRS/VML_TAGSinextra/legacy-vml.js,NS_MAP/TRANSITIONAL_ELEMENTSinextra/transitional.js); the error classes (ParseError/RenderError/ContractError) are no longer imported from../errors.js: every factory that throws typed errors receives theooxmlErrorsinstance as its first dependency.factory.toString()produces JS that rehydrates inside a Web Worker without resolving any external module symbol. xml— the package's local XML parser (and its tests) is retired; every module now consumesxmlfrom@awacloud/fw/io/codec/xml.js(module namexml). Breaking for any external import of the formerooxmlXmlexport — acceptable pre-publication. Everydocs/reference toooxmlXml(dependency names, runtime resolves, imports) realigned to the canonicalxmlmodule name.- Namespaces, relationship types, content-types, EMU and
boolean-attribute helpers consolidated into
ooxmlShared(see Added) — ~250 LOC removed from consumers. The following factories gained'ooxmlShared'as an additional dependency and receive the shared instance as their last constructor argument (breaking for directfactory(...)callers; transparent forModuleRuntime.resolve(...)consumers, which inject it automatically):docx,docxStyles,docxNumbering,docxSettings,docxComments,docxFootnotes,docxHeaders,docxCustomXml,docxDrawing,xlsx,xlsxStyles,xlsxTables,xlsxComments,xlsxThreadedComments,xlsxDrawings,xlsxConditionalFormatting,pptx,pptxSlide,pptxTheme,pptxPicture,pptxTable,pptxChart,drawingml,drawingmlChart,drawingmlShape.opcPackagegained'ooxmlShared'as its 5th dependency (factory(errors, zip, contentTypes, rels, shared), up from 4 args).dmlEffects/dmlFillsAdvancedgained'ooxmlShared'as a second dependency (factory(xml, shared)). - UTF-8 codec and rId allocation consolidated in
ooxmlShared— theTextEncoder/TextDecoderpair instantiated locally in 22 worker-safe factories (opc/package;docx/{docx, comments, customXml, footnotes, headers, numbering, settings, styles};xlsx/{xlsx, styles, tables, comments, threadedComments, drawings};pptx/{pptx, slide, theme};drawingml/chart) is replaced byshared.encodeText/decodeText(bit-identical to the native Web APIs). The bespoke rId counter/collision-loop reimplemented at 5 sites is replaced byshared.createRidAllocator(...):docx.jsdocument rels (claimRid), image rels (collectImages.nextRId, prefixrImg), chart rels (collectCharts.nextRId, prefixrChart);xlsx.jshyperlink rIds (prefixrIdH);pptx.jspicture/chart/ layout rIds (see Fixed for the collision bug this last site's consolidation also closed). Every site's allocation sequence is byte-for-byte identical to the pre-refactor loop it replaced (createRidAllocatoryieldsprefix+start, prefix+(start+1), …skipping registered ids, matching the historicalwhile (… some(r => r.Id === id)) n++contracts) — exceptpptx.js, whose sequence changed as a side effect of fixing the collision bug (see Fixed). lookupCT(pkg, partName)consolidated intoooxmlShared(override > extension-default lookup,nullon no match);docx.js/pptx.jsconsume it instead of a duplicated local helper.opc/contentTypes.lookup(types, partName)keeps its complementary signature (flattypesobject rather than apkg).- Errors — granular namespaced kebab-case codes (
docx/missing-body,opc/zip-bomb,xlsx/limit-exceeded, etc.) replace the placeholder strings'ooxml/parse-error'/'ooxml/render-error'/'ooxml/contract-error'(catalog indocs/api/errors.md); every typed error carries a structuredcontext(partName,elementName,limit,cause, …); XML-parse/zip failures are re-thrown as typed errors withcausepreserved (e.g.docx/invalid-xml,opc/invalid-zip);docx.write/xlsx.write/pptx.writereject non-object models / wrong-typedbody/sheets/slideswithContractErrorinstead of a rawTypeError. - Internals —
docx.walkAllDrawingsnow descends intonode.txbxContentandnode.altContentso images nested in DrawingML textboxes / MC fallback are no longer dropped on write; the@typedef Drawingformalises the shape exchanged between thedocx/xlsx/pptxorchestrators anddrawingml*; text-extraction helpers (toText,textOfParagraph,textOfRun,textOfTable) extracted todocx/docx-text.js(factorydocxText, now adocxdependency) to shrink the orchestrator — public API unchanged; module-scopedRegExphoisted inopc/package.jshot paths. - Packaging —
awa.maturityprogressedL2→L3→L4;package.jsongaineddescription,keywords,engines,sideEffects: false, and the./errorssub-path export; the legal metadata (license,author,copyright,repository,bugs,homepage) is set andLICENSEcarries the AGPL-3.0-only text.
Removed
- The development playground (
playground/), never part of the published package. - The legacy
prebuilt/descriptors (the 18 single-surface generated descriptors that lived under the bundles source directory) and thetools/generate-prebuilds.mjsgenerator (bun run gen:prebuilds) — retired in favour of the two-surfacedist/build/+dist/standalone/convention (see Added). Exported factory names and resolve keys are unchanged; only the on-disk location and generator moved (tools/generate-bundles.mjs/bun run gen:bundles). - Imperative bundle builders
buildDocxLarge,buildDocxFull,buildXlsxLarge,buildXlsxFull,buildPptxLarge,buildPptxFull— bundles are now minimal fw descriptors consumed exclusively viaModuleRuntime.register(...)/resolve(...)(see Added — Bundles). - Named re-exports of extras from bundle entry points (e.g.
docxLarge.wmlRunFormatting,xlsxLarge.smlPivotTables) — import extras from@awacloud/ooxml(root) or@awacloud/ooxml/extra/*directly. - Top-level error class exports (
OoxmlError,ParseError,RenderError,ContractError) from@awacloud/ooxml/@awacloud/ooxml/errors— migrate toruntime.resolve('ooxmlErrors')orooxmlErrors.factory(). - Duplicated inline literal
…/relationships/imageinxlsx/xlsx.js(replaced byREL_TYPE.IMAGE) and a redundant localfindChildinextra/wml-numbering-details.js(replaced byxml.findChild).
Fixed
-
Story parts are namespace-well-formed — header, footer, footnotes, endnotes and comments parts are read through markup compatibility (as
word/document.xmlalready was) and written with the namespace declarations they use (w15andmc:Ignorablewhen needed;w:commentsnow declaresr), so a re-written story part declares every prefix it uses. Committeddist/**bundles regenerated. -
Hyperlinks are kept by
write(read(x).document, …)—read()copies a resolvable hyperlink'starget/externalonto the node, andwrite()emits the hyperlink relationships of headers, footers, footnotes, endnotes and comments in each part's own relationship table, so every resolvable link is kept by a re-write. -
word/settings.xmldeclares the prefixes it uses — settings re-written from a Word document declare every prefix the tree uses (m,o,v,w14,w15, …), withmc:Ignorablelisting the Office extension ones; a prefix with no known namespace throwsRenderErrordocx/settings-unknown-prefix(context.prefix). -
Documentation states measured facts — the transitional page and the
docx-fullbundle page no longer claim that the core reads Strict names or that the bundle rewrites namespaces; the docx guide's read-result sketch gives the real image and hyperlink entry shapes; the pptx and xlsx bundle pages give the full read envelope (unmodelledPartsincluded); round-trip claims say "re-emitted on write", name the whole-part caveat and make no percentage claim. -
xlsx.readcell cap fires (security) —maxCellsPerSheetcounted nothing. The row and cell caps are now checked on a pre-scan of each sheet before it is parsed and again while rows are mapped, and they bound the empty cells inserted for column gaps, so a far column reference cannot materialise an unbounded row. -
Repeating-section content controls are read from and written in the Word 2012 (
w15) namespace, with their title anddoNotAllowInsertDeleteSection; the legacyw:form is still read. Thew15declarations are added to the document root only when the body holds such an element. Built from the specification, and verified by a read / write / re-read round trip of a document saved by Microsoft Word 16.0 (a published third-party test file, MIT-licensed, vendored undertests/_fixtures/). -
docx.writedocuments itsimagesandcustomXmloptions. -
docxNumbering.bulletList()bullet glyph — the bullet level no longer forcesrPr: { font: 'Symbol' }:Symbolis a symbol-encoded font with no glyph at U+2022, so Word drew a hollow box.lvlTextstays•(U+2022) and renders with the paragraph font in Word and LibreOffice. The numbering model is unchanged (parse/serializestill round-trip a caller-suppliedrPr.font). Committeddist/**docx bundles regenerated. -
Documentation links resolve from the npm tarball. Links that pointed outside the package, or at files the tarball does not ship, now point at the public repository at this release's tag, so they resolve from the tarball; references to sources that are not published are plain-text citations, and a See also entry naming a page that exists nowhere is removed.
-
pptx rId allocator — historic uniqueness bug. Before the rId-allocator consolidation (see Changed),
pptx.js's picture path (shape.embedRef || 'rId' + nextRid++) never registered a preferred rId (shape.image.rId/shape.embedRef) with the counter, sonextRid++could re-emit an rId already used by an earlier relationship — producing a.relspart with two entries sharing the sameId(corrupt per OPC, silently tolerated by PowerPoint and undetected by the pre-existing roundtrip tests).createRidAllocator .claim(preferred)now registers every preferred id, closing the collision class; the no-opwhile (slideRels.some(...)) {}loop and the localparseRidNum/ensureUniquehelpers (15 LOC) were removed as dead code. The rId sequence emitted for pptx files whose pictures carry a preferred id may differ from previous versions — the new sequence is guaranteed collision-free; the public API (pptx.read/pptx.write) and roundtrip semantics (a free preferred rId is preserved) are unchanged. 3 regression tests added.
Security
opc.read(bytes, opts?)enforces three default bounds to prevent ZIP-bomb DoS:maxParts(1024),maxUncompressed(256 MiB),maxRatio(200). A breach raisesParseError('opc/zip-bomb', ...)withcontext.limitset; pass0per option to disable a given check.xlsx.read(bytes, opts?)boundsmaxSheets(64),maxRowsPerSheet(200k),maxCellsPerSheet(5M). A breach raisesParseError('xlsx/limit-exceeded', ...).- No DTD / no external entity policy is documented and pinned by
regression tests in
tests/fuzz.test.js(XXE + billion-laughs).
Documentation
- Documentation pass. The README now follows the published-package
layout (installation, quick start, package-specific sections, a sub-path
table with one row per
exportskey, maturity, licence and project links) and every quick-start snippet was executed. Registration snippets across the README and the guides now registerfw_require(the@awacloud/fwmodules the package consumes) beforemodules; without itresolvefails withModule not found. The guides open with a purpose and prerequisites, the coverage guide states what the*-miscpassthroughs do and do not model, and the hook tables of the extending guide match what the xlsx and pptx walkers pass to a hook. Four reference pages were added for modules that had none (docxWalker,docxText,xlsxWalker,pptxWalker), the French@fileoverviewprose of the three orchestrators is now English, and the package-local working notes (a TODO list and three audit pages) no longer live in the package or its tarball.