Low-level (XML / ZIP / schema / packaging)
XML reader / writer, OPC packaging, schema, ZIP. Reach in only when wiring custom parts.
Namespaces
src/xml/namespaces.tsparseQName function
src/xml/namespaces.ts:213Inverse of qname. Returns { ns, local }. For unprefixed names ns
is the empty string.
function parseQName(name: string): { local: string; ns: string }Parameters
| Name | Type | Description |
|---|---|---|
name | string |
Returns
{ local: string; ns: string }
qname function
src/xml/namespaces.ts:203Build a Clark-notation QName: {namespace}localname. When namespace is
empty / undefined the local name is returned as-is.
function qname(namespace: string | undefined, local: string): stringParameters
| Name | Type | Description |
|---|---|---|
namespace | string | undefined | |
local | string |
Returns
string
ACTIVEX_TYPE const
src/xml/namespaces.ts:194const ACTIVEX_TYPE: "application/vnd.ms-office.activeX+xml"ARC_APP const
src/xml/namespaces.ts:162const ARC_APP: "docProps/app.xml"ARC_CONTENT_TYPES const
src/xml/namespaces.ts:158const ARC_CONTENT_TYPES: "[Content_Types].xml"ARC_CORE const
src/xml/namespaces.ts:161const ARC_CORE: "docProps/core.xml"ARC_CUSTOM const
src/xml/namespaces.ts:163const ARC_CUSTOM: "docProps/custom.xml"ARC_CUSTOM_UI const
src/xml/namespaces.ts:168const ARC_CUSTOM_UI: "customUI/customUI.xml"ARC_ROOT_RELS const
src/xml/namespaces.ts:159const ARC_ROOT_RELS: "_rels/.rels"ARC_SHARED_STRINGS const
src/xml/namespaces.ts:167const ARC_SHARED_STRINGS: "xl/sharedStrings.xml"ARC_STYLE const
src/xml/namespaces.ts:165const ARC_STYLE: "xl/styles.xml"ARC_THEME const
src/xml/namespaces.ts:166const ARC_THEME: "xl/theme/theme1.xml"ARC_WORKBOOK const
src/xml/namespaces.ts:164const ARC_WORKBOOK: "xl/workbook.xml"ARC_WORKBOOK_RELS const
src/xml/namespaces.ts:160const ARC_WORKBOOK_RELS: "xl/_rels/workbook.xml.rels"C14_NS const
src/xml/namespaces.ts:65const C14_NS: "http://schemas.microsoft.com/office/drawing/2010/chart"C15_NS const
src/xml/namespaces.ts:66const C15_NS: "http://schemas.microsoft.com/office/drawing/2012/chart"C16_NS const
src/xml/namespaces.ts:67const C16_NS: "http://schemas.microsoft.com/office/drawing/2017/03/chart"CHART_DRAWING_NS const
src/xml/namespaces.ts:44const CHART_DRAWING_NS: "http://schemas.openxmlformats.org/drawingml/2006/chartDrawing"CHART_NS const
src/xml/namespaces.ts:41const CHART_NS: "http://schemas.openxmlformats.org/drawingml/2006/chart"CHART_TYPE const
src/xml/namespaces.ts:188const CHART_TYPE: "application/vnd.openxmlformats-officedocument.drawingml.chart+xml"CHARTSHAPE_TYPE const
src/xml/namespaces.ts:190const CHARTSHAPE_TYPE: "application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml"CHARTSHEET_TYPE const
src/xml/namespaces.ts:186const CHARTSHEET_TYPE: stringCOMMENTS_NS const
src/xml/namespaces.ts:22const COMMENTS_NS: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments"COMMENTS_TYPE const
src/xml/namespaces.ts:184const COMMENTS_TYPE: stringCONTYPES_NS const
src/xml/namespaces.ts:36const CONTYPES_NS: "http://schemas.openxmlformats.org/package/2006/content-types"COREPROPS_NS const
src/xml/namespaces.ts:35const COREPROPS_NS: "http://schemas.openxmlformats.org/package/2006/metadata/core-properties"CPROPS_FMTID const
src/xml/namespaces.ts:29const CPROPS_FMTID: "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}"CPROPS_TYPE const
src/xml/namespaces.ts:192const CPROPS_TYPE: "application/vnd.openxmlformats-officedocument.custom-properties+xml"CTRLPROPS_TYPE const
src/xml/namespaces.ts:195const CTRLPROPS_TYPE: "application/vnd.ms-excel.controlproperties+xml"CUSTOMUI_NS const
src/xml/namespaces.ts:56const CUSTOMUI_NS: "http://schemas.microsoft.com/office/2006/relationships/ui/extensibility"CUSTPROPS_NS const
src/xml/namespaces.ts:28const CUSTPROPS_NS: "http://schemas.openxmlformats.org/officeDocument/2006/custom-properties"CX_NS const
src/xml/namespaces.ts:68const CX_NS: "http://schemas.microsoft.com/office/drawing/2014/chartex"DCMITYPE_NS const
src/xml/namespaces.ts:15const DCMITYPE_NS: "http://purl.org/dc/dcmitype/"DCORE_NS const
src/xml/namespaces.ts:13const DCORE_NS: "http://purl.org/dc/elements/1.1/"DCTERMS_NS const
src/xml/namespaces.ts:14const DCTERMS_NS: "http://purl.org/dc/terms/"DCTERMS_PREFIX const
src/xml/namespaces.ts:16const DCTERMS_PREFIX: "dcterms"DEFAULT_PREFIXES const
src/xml/namespaces.ts:103const DEFAULT_PREFIXES: Readonly<Record<string, string>>DRAWING_NS const
src/xml/namespaces.ts:42const DRAWING_NS: "http://schemas.openxmlformats.org/drawingml/2006/main"DRAWING_TYPE const
src/xml/namespaces.ts:187const DRAWING_TYPE: "application/vnd.openxmlformats-officedocument.drawing+xml"EXTERNAL_LINK_NS const
src/xml/namespaces.ts:25const EXTERNAL_LINK_NS: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink"EXTERNAL_LINK_TYPE const
src/xml/namespaces.ts:182const EXTERNAL_LINK_TYPE: stringIMAGE_NS const
src/xml/namespaces.ts:23const IMAGE_NS: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"MARKUP_COMPAT_NS const
src/xml/namespaces.ts:57const MARKUP_COMPAT_NS: "http://schemas.openxmlformats.org/markup-compatibility/2006"PACKAGE_CHARTS const
src/xml/namespaces.ts:151const PACKAGE_CHARTS: "xl/charts"PACKAGE_CHARTSHEETS const
src/xml/namespaces.ts:149const PACKAGE_CHARTSHEETS: "xl/chartsheets"PACKAGE_CHARTSHEETS_RELS const
src/xml/namespaces.ts:156const PACKAGE_CHARTSHEETS_RELS: "xl/chartsheets/_rels"PACKAGE_DRAWINGS const
src/xml/namespaces.ts:150const PACKAGE_DRAWINGS: "xl/drawings"PACKAGE_IMAGES const
src/xml/namespaces.ts:152const PACKAGE_IMAGES: "xl/media"PACKAGE_PIVOT_CACHE const
src/xml/namespaces.ts:154const PACKAGE_PIVOT_CACHE: "xl/pivotCache"PACKAGE_PIVOT_TABLE const
src/xml/namespaces.ts:153const PACKAGE_PIVOT_TABLE: "xl/pivotTables"PACKAGE_PROPS const
src/xml/namespaces.ts:144const PACKAGE_PROPS: "docProps"PACKAGE_RELS const
src/xml/namespaces.ts:146const PACKAGE_RELS: "_rels"PACKAGE_THEME const
src/xml/namespaces.ts:147const PACKAGE_THEME: "xl/theme"PACKAGE_WORKSHEET_RELS const
src/xml/namespaces.ts:155const PACKAGE_WORKSHEET_RELS: "xl/worksheets/_rels"PACKAGE_WORKSHEETS const
src/xml/namespaces.ts:148const PACKAGE_WORKSHEETS: "xl/worksheets"PACKAGE_XL const
src/xml/namespaces.ts:145const PACKAGE_XL: "xl"PICTURE_NS const
src/xml/namespaces.ts:45const PICTURE_NS: "http://schemas.openxmlformats.org/drawingml/2006/picture"PKG_REL_NS const
src/xml/namespaces.ts:34const PKG_REL_NS: "http://schemas.openxmlformats.org/package/2006/relationships"REL_NS const
src/xml/namespaces.ts:21const REL_NS: "http://schemas.openxmlformats.org/officeDocument/2006/relationships"SHARED_STRINGS_TYPE const
src/xml/namespaces.ts:181const SHARED_STRINGS_TYPE: stringSHEET_DRAWING_NS const
src/xml/namespaces.ts:43const SHEET_DRAWING_NS: "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"SHEET_MAIN_NS const
src/xml/namespaces.ts:40const SHEET_MAIN_NS: "http://schemas.openxmlformats.org/spreadsheetml/2006/main"STYLES_TYPE const
src/xml/namespaces.ts:185const STYLES_TYPE: stringTHEME_TYPE const
src/xml/namespaces.ts:191const THEME_TYPE: "application/vnd.openxmlformats-officedocument.theme+xml"THREADED_COMMENTS_NS const
src/xml/namespaces.ts:69const THREADED_COMMENTS_NS: "http://schemas.microsoft.com/office/spreadsheetml/2018/threadedcomments"VBA_TYPE const
src/xml/namespaces.ts:193const VBA_TYPE: "application/vnd.ms-office.vbaProject"VML_NS const
src/xml/namespaces.ts:24const VML_NS: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing"VTYPES_NS const
src/xml/namespaces.ts:26const VTYPES_NS: "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"WORKSHEET_TYPE const
src/xml/namespaces.ts:183const WORKSHEET_TYPE: stringX14_NS const
src/xml/namespaces.ts:58const X14_NS: "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"X15_NS const
src/xml/namespaces.ts:59const X15_NS: "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"X16_NS const
src/xml/namespaces.ts:64const X16_NS: "http://schemas.microsoft.com/office/spreadsheetml/2014/revision"XLSM_TYPE const
src/xml/namespaces.ts:179const XLSM_TYPE: stringXLSX_TYPE const
src/xml/namespaces.ts:177const XLSX_TYPE: stringXLTM_TYPE const
src/xml/namespaces.ts:180const XLTM_TYPE: stringXLTX_TYPE const
src/xml/namespaces.ts:178const XLTX_TYPE: stringXML_NS const
src/xml/namespaces.ts:10const XML_NS: "http://www.w3.org/XML/1998/namespace"XPROPS_NS const
src/xml/namespaces.ts:27const XPROPS_NS: "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"XSI_NS const
src/xml/namespaces.ts:11const XSI_NS: "http://www.w3.org/2001/XMLSchema-instance"Custom
src/packaging/custom.tsappendCustomProperty function
src/packaging/custom.ts:120function appendCustomProperty(props: CustomProperties, name: string, value: XmlNode, opts?: { fmtid?: string; pid?: number }): CustomPropertyParameters
| Name | Type | Description |
|---|---|---|
props | CustomProperties | |
name | string | |
value | XmlNode | |
opts? | { fmtid?: string; pid?: number } |
Returns
CustomProperty
customPropsFromBytes function
src/packaging/custom.ts:154function customPropsFromBytes(bytes: string | Uint8Array<ArrayBufferLike>): CustomPropertiesParameters
| Name | Type | Description |
|---|---|---|
bytes | string | Uint8Array<ArrayBufferLike> |
Returns
CustomProperties
customPropsToBytes function
src/packaging/custom.ts:140function customPropsToBytes(p: CustomProperties): Uint8ArrayParameters
| Name | Type | Description |
|---|---|---|
p | CustomProperties |
Returns
Uint8Array
findCustomPropertyByName function
src/packaging/custom.ts:133function findCustomPropertyByName(props: CustomProperties, name: string): CustomProperty | undefinedParameters
| Name | Type | Description |
|---|---|---|
props | CustomProperties | |
name | string |
Returns
CustomProperty | undefined
getCustomPropertyValue function
src/packaging/custom.ts:247Read the typed value of a custom property by name. Tries each decoder in turn
— string, int, double, bool, filetime — and returns the first hit. Returns
undefined for unknown names or unsupported types.
function getCustomPropertyValue(wb: Workbook, name: string): string | number | boolean | undefinedParameters
| Name | Type | Description |
|---|---|---|
wb | Workbook | |
name | string |
Returns
string | number | boolean | undefined
listCustomProperties function
src/packaging/custom.ts:281Every custom property, as a read-only view of the live array, not a copy. Empty array when the workbook carries none.
function listCustomProperties(wb: Workbook): readonly CustomProperty[]Parameters
| Name | Type | Description |
|---|---|---|
wb | Workbook |
Returns
readonly CustomProperty[]
makeAsciiStringValue function
src/packaging/custom.ts:44function makeAsciiStringValue(s: string): XmlNodeParameters
| Name | Type | Description |
|---|---|---|
s | string |
Returns
XmlNode
makeBoolValue function
src/packaging/custom.ts:55function makeBoolValue(b: boolean): XmlNodeParameters
| Name | Type | Description |
|---|---|---|
b | boolean |
Returns
XmlNode
makeCustomProperties function
src/packaging/custom.ts:30function makeCustomProperties(): CustomPropertiesReturns
CustomProperties
makeDateValue function
src/packaging/custom.ts:61function makeDateValue(iso: string): XmlNodeParameters
| Name | Type | Description |
|---|---|---|
iso | string |
Returns
XmlNode
makeDoubleValue function
src/packaging/custom.ts:51function makeDoubleValue(n: number): XmlNodeParameters
| Name | Type | Description |
|---|---|---|
n | number |
Returns
XmlNode
makeFiletimeValue function
src/packaging/custom.ts:58function makeFiletimeValue(iso: string): XmlNodeParameters
| Name | Type | Description |
|---|---|---|
iso | string |
Returns
XmlNode
makeIntValue function
src/packaging/custom.ts:47function makeIntValue(n: number): XmlNodeParameters
| Name | Type | Description |
|---|---|---|
n | number |
Returns
XmlNode
makeStringValue function
src/packaging/custom.ts:41function makeStringValue(s: string): XmlNodeParameters
| Name | Type | Description |
|---|---|---|
s | string |
Returns
XmlNode
readBoolValue function
src/packaging/custom.ts:97function readBoolValue(v: XmlNode): boolean | undefinedParameters
| Name | Type | Description |
|---|---|---|
v | XmlNode |
Returns
boolean | undefined
readDoubleValue function
src/packaging/custom.ts:89function readDoubleValue(v: XmlNode): number | undefinedParameters
| Name | Type | Description |
|---|---|---|
v | XmlNode |
Returns
number | undefined
readFiletimeValue function
src/packaging/custom.ts:104function readFiletimeValue(v: XmlNode): string | undefinedParameters
| Name | Type | Description |
|---|---|---|
v | XmlNode |
Returns
string | undefined
readIntValue function
src/packaging/custom.ts:72function readIntValue(v: XmlNode): number | undefinedParameters
| Name | Type | Description |
|---|---|---|
v | XmlNode |
Returns
number | undefined
readStringValue function
src/packaging/custom.ts:67function readStringValue(v: XmlNode): string | undefinedParameters
| Name | Type | Description |
|---|---|---|
v | XmlNode |
Returns
string | undefined
removeCustomProperty function
src/packaging/custom.ts:271Remove a custom property by name. Returns true when one was removed,
false when the name wasn't found.
function removeCustomProperty(wb: Workbook, name: string): booleanParameters
| Name | Type | Description |
|---|---|---|
wb | Workbook | |
name | string |
Returns
boolean
setCustomBoolProperty function
src/packaging/custom.ts:226Set (or replace) a custom boolean property.
function setCustomBoolProperty(wb: Workbook, name: string, value: boolean): CustomPropertyParameters
| Name | Type | Description |
|---|---|---|
wb | Workbook | |
name | string | |
value | boolean |
Returns
CustomProperty
setCustomDateProperty function
src/packaging/custom.ts:233Set (or replace) a custom date property. Accepts a Date (converted to ISO
via toISOString()) or a pre-formatted W3C-DTF string.
function setCustomDateProperty(wb: Workbook, name: string, value: string | Date): CustomPropertyParameters
| Name | Type | Description |
|---|---|---|
wb | Workbook | |
name | string | |
value | string | Date |
Returns
CustomProperty
setCustomNumberProperty function
src/packaging/custom.ts:216Set (or replace) a custom numeric property. Integers (within Int32 range) are
stored as vt:i4; non-integer / out-of-range numbers as vt:r8 doubles.
function setCustomNumberProperty(wb: Workbook, name: string, value: number): CustomPropertyParameters
| Name | Type | Description |
|---|---|---|
wb | Workbook | |
name | string | |
value | number |
Returns
CustomProperty
setCustomStringProperty function
src/packaging/custom.ts:209Set (or replace) a custom string property.
function setCustomStringProperty(wb: Workbook, name: string, value: string): CustomPropertyParameters
| Name | Type | Description |
|---|---|---|
wb | Workbook | |
name | string | |
value | string |
Returns
CustomProperty
Core
src/packaging/core.tscorePropsFromBytes function
src/packaging/core.ts:103function corePropsFromBytes(bytes: string | Uint8Array<ArrayBufferLike>): CorePropertiesParameters
| Name | Type | Description |
|---|---|---|
bytes | string | Uint8Array<ArrayBufferLike> |
Returns
CoreProperties
corePropsToBytes function
src/packaging/core.ts:99function corePropsToBytes(p: CoreProperties): Uint8ArrayParameters
| Name | Type | Description |
|---|---|---|
p | CoreProperties |
Returns
Uint8Array
makeCoreProperties function
src/packaging/core.ts:95function makeCoreProperties(): CorePropertiesReturns
CoreProperties
setWorkbookCategory function
src/packaging/core.ts:147Set the document category (e.g. "Reports", "Drafts").
function setWorkbookCategory(wb: Workbook, category: string): voidParameters
| Name | Type | Description |
|---|---|---|
wb | Workbook | |
category | string |
Returns
void
setWorkbookCreator function
src/packaging/core.ts:117Set the document author (Excel "File → Properties → Author").
function setWorkbookCreator(wb: Workbook, creator: string): voidParameters
| Name | Type | Description |
|---|---|---|
wb | Workbook | |
creator | string |
Returns
void
setWorkbookDescription function
src/packaging/core.ts:132Set the document description / abstract.
function setWorkbookDescription(wb: Workbook, description: string): voidParameters
| Name | Type | Description |
|---|---|---|
wb | Workbook | |
description | string |
Returns
void
setWorkbookKeywords function
src/packaging/core.ts:137Set comma- or semicolon-separated keywords.
function setWorkbookKeywords(wb: Workbook, keywords: string): voidParameters
| Name | Type | Description |
|---|---|---|
wb | Workbook | |
keywords | string |
Returns
void
setWorkbookLastModifiedBy function
src/packaging/core.ts:142Set the "last modified by" name (defaults to creator if absent).
function setWorkbookLastModifiedBy(wb: Workbook, name: string): voidParameters
| Name | Type | Description |
|---|---|---|
wb | Workbook | |
name | string |
Returns
void
setWorkbookSubject function
src/packaging/core.ts:127Set the document subject.
function setWorkbookSubject(wb: Workbook, subject: string): voidParameters
| Name | Type | Description |
|---|---|---|
wb | Workbook | |
subject | string |
Returns
void
setWorkbookTitle function
src/packaging/core.ts:122Set the document title.
function setWorkbookTitle(wb: Workbook, title: string): voidParameters
| Name | Type | Description |
|---|---|---|
wb | Workbook | |
title | string |
Returns
void
Extended
src/packaging/extended.tsextendedPropsFromBytes function
src/packaging/extended.ts:120function extendedPropsFromBytes(bytes: string | Uint8Array<ArrayBufferLike>): ExtendedPropertiesParameters
| Name | Type | Description |
|---|---|---|
bytes | string | Uint8Array<ArrayBufferLike> |
Returns
ExtendedProperties
extendedPropsToBytes function
src/packaging/extended.ts:116function extendedPropsToBytes(p: ExtendedProperties): Uint8ArrayParameters
| Name | Type | Description |
|---|---|---|
p | ExtendedProperties |
Returns
Uint8Array
makeExtendedProperties function
src/packaging/extended.ts:112function makeExtendedProperties(): ExtendedPropertiesReturns
ExtendedProperties
setWorkbookApplication function
src/packaging/extended.ts:144Set the application name (e.g. "Microsoft Excel").
function setWorkbookApplication(wb: Workbook, application: string): voidParameters
| Name | Type | Description |
|---|---|---|
wb | Workbook | |
application | string |
Returns
void
setWorkbookAppVersion function
src/packaging/extended.ts:149Set the application version (typically "16.0300" for Excel 365).
function setWorkbookAppVersion(wb: Workbook, version: string): voidParameters
| Name | Type | Description |
|---|---|---|
wb | Workbook | |
version | string |
Returns
void
setWorkbookCompany function
src/packaging/extended.ts:134Set the company name on docProps/app.xml.
function setWorkbookCompany(wb: Workbook, company: string): voidParameters
| Name | Type | Description |
|---|---|---|
wb | Workbook | |
company | string |
Returns
void
setWorkbookHyperlinkBase function
src/packaging/extended.ts:154Set the hyperlink base URL — Excel uses this as a prefix for relative &F codes.
function setWorkbookHyperlinkBase(wb: Workbook, base: string): voidParameters
| Name | Type | Description |
|---|---|---|
wb | Workbook | |
base | string |
Returns
void
setWorkbookManager function
src/packaging/extended.ts:139Set the manager / supervisor name on docProps/app.xml.
function setWorkbookManager(wb: Workbook, manager: string): voidParameters
| Name | Type | Description |
|---|---|---|
wb | Workbook | |
manager | string |
Returns
void
Manifest
src/packaging/manifest.tsaddDefault function
src/packaging/manifest.ts:74Register a default content type for an extension. Idempotent.
function addDefault(m: Manifest, ext: string, contentType: string): voidParameters
| Name | Type | Description |
|---|---|---|
m | Manifest | |
ext | string | |
contentType | string |
Returns
void
addOverride function
src/packaging/manifest.ts:87Register an Override for a specific part. Idempotent.
function addOverride(m: Manifest, partName: string, contentType: string): voidParameters
| Name | Type | Description |
|---|---|---|
m | Manifest | |
partName | string | |
contentType | string |
Returns
void
findOverride function
src/packaging/manifest.ts:97function findOverride(m: Manifest, partName: string): OverrideEntry | undefinedParameters
| Name | Type | Description |
|---|---|---|
m | Manifest | |
partName | string |
Returns
OverrideEntry | undefined
findOverrideByContentType function
src/packaging/manifest.ts:103Find the first Override matching a content type.
function findOverrideByContentType(m: Manifest, contentType: string): OverrideEntry | undefinedParameters
| Name | Type | Description |
|---|---|---|
m | Manifest | |
contentType | string |
Returns
OverrideEntry | undefined
makeManifest function
src/packaging/manifest.ts:69function makeManifest(): ManifestReturns
Manifest
manifestFromBytes function
src/packaging/manifest.ts:112function manifestFromBytes(bytes: string | Uint8Array<ArrayBufferLike>): ManifestParameters
| Name | Type | Description |
|---|---|---|
bytes | string | Uint8Array<ArrayBufferLike> |
Returns
Manifest
manifestToBytes function
src/packaging/manifest.ts:108function manifestToBytes(m: Manifest): Uint8ArrayParameters
| Name | Type | Description |
|---|---|---|
m | Manifest |
Returns
Uint8Array
Relationships
src/packaging/relationships.tsappendRel function
src/packaging/relationships.ts:86Append a relationship and return the resulting object. Auto-assigns the next
free rId{N} Id.
function appendRel(rels: Relationships, type: string, target: string, targetMode?: "External"): RelationshipParameters
| Name | Type | Description |
|---|---|---|
rels | Relationships | |
type | string | |
target | string | |
targetMode? | "External" |
Returns
Relationship
findAllByType function
src/packaging/relationships.ts:114function findAllByType(rels: Relationships, type: string): Relationship[]Parameters
| Name | Type | Description |
|---|---|---|
rels | Relationships | |
type | string |
Returns
Relationship[]
findById function
src/packaging/relationships.ts:93function findById(rels: Relationships, id: string): Relationship | undefinedParameters
| Name | Type | Description |
|---|---|---|
rels | Relationships | |
id | string |
Returns
Relationship | undefined
findByType function
src/packaging/relationships.ts:109function findByType(rels: Relationships, type: string): Relationship | undefinedParameters
| Name | Type | Description |
|---|---|---|
rels | Relationships | |
type | string |
Returns
Relationship | undefined
makeRelationships function
src/packaging/relationships.ts:60function makeRelationships(): RelationshipsReturns
Relationships
relsFromBytes function
src/packaging/relationships.ts:124function relsFromBytes(bytes: string | Uint8Array<ArrayBufferLike>): RelationshipsParameters
| Name | Type | Description |
|---|---|---|
bytes | string | Uint8Array<ArrayBufferLike> |
Returns
Relationships
relsToBytes function
src/packaging/relationships.ts:120function relsToBytes(rels: Relationships): Uint8ArrayParameters
| Name | Type | Description |
|---|---|---|
rels | Relationships |
Returns
Uint8Array
Tree
src/xml/tree.tsappendChild function
src/xml/tree.ts:89Append child to parent. Mutates and returns parent for chaining during
construction. Avoid in hot paths — for cell writing the worksheet writer goes
through a templated emitter rather than building XmlNode trees per cell.
function appendChild(parent: XmlNode, child: XmlNode): XmlNodeParameters
| Name | Type | Description |
|---|---|---|
parent | XmlNode | |
child | XmlNode |
Returns
XmlNode
el function
src/xml/tree.ts:31Build an XmlNode from primitive bits. Attributes / children default to empty;
pass undefined for text to omit the text node.
The element's name is always supplied in Clark notation. Use the qname helper from ./namespaces to keep call sites readable.
function el(name: string, attrs?: Readonly<Record<string, string | number | boolean | null | undefined>>, children?: readonly XmlNode[], text?: string): XmlNodeParameters
| Name | Type | Description |
|---|---|---|
name | string | |
attrs? = {} | Readonly<Record<string, string | number | boolean | null | undefined>> | |
children? = [] | readonly XmlNode[] | |
text? | string |
Returns
XmlNode
elNs function
src/xml/tree.ts:61Convenience: element with a Clark-notation name composed from a namespace URI and local name.
function elNs(namespace: string | undefined, local: string, attrs?: Readonly<Record<string, string | number | boolean | null | undefined>>, children?: readonly XmlNode[], text?: string): XmlNodeParameters
| Name | Type | Description |
|---|---|---|
namespace | string | undefined | |
local | string | |
attrs? | Readonly<Record<string, string | number | boolean | null | undefined>> | |
children? | readonly XmlNode[] | |
text? | string |
Returns
XmlNode
findChild function
src/xml/tree.ts:72Locate the first child matching the supplied Clark-notation name.
function findChild(node: XmlNode, name: string): XmlNode | undefinedParameters
| Name | Type | Description |
|---|---|---|
node | XmlNode | |
name | string |
Returns
XmlNode | undefined
findChildren function
src/xml/tree.ts:78All children matching the supplied Clark-notation name, in document order.
function findChildren(node: XmlNode, name: string): XmlNode[]Parameters
| Name | Type | Description |
|---|---|---|
node | XmlNode | |
name | string |
Returns
XmlNode[]
Serialize
src/schema/serialize.tsfromTree function
src/schema/serialize.ts:202Materialise a value of T from an XmlNode per the supplied schema.
function fromTree(node: XmlNode, schema: Schema<T>): TParameters
| Name | Type | Description |
|---|---|---|
node | XmlNode | |
schema | Schema<T> |
Returns
T
toTree function
src/schema/serialize.ts:89Serialise a value of T into an XmlNode per the supplied schema.
function toTree(value: T, schema: Schema<T>): XmlNodeParameters
| Name | Type | Description |
|---|---|---|
value | T | |
schema | Schema<T> |
Returns
XmlNode
Core
src/schema/core.tsdefineSchema function
src/schema/core.ts:155Identity helper that pins inference to the supplied T. The runtime is just
s => s; the value matters only for the call-site type.
function defineSchema(s: Schema<T>): Schema<T>Parameters
| Name | Type | Description |
|---|---|---|
s | Schema<T> |
Returns
Schema<T>
Decompression guard
src/zip/decompression-guard.tsDEFAULT_DECOMPRESSION_LIMITS const
src/zip/decompression-guard.ts:53Default safeguards applied when the caller doesn't override them.
const DEFAULT_DECOMPRESSION_LIMITS: ResolvedDecompressionLimitsIterparse
src/xml/iterparse.tsiterParse function
src/xml/iterparse.ts:192Parse the input as a stream of SAX events. Element / attribute names are
returned in Clark notation ({ns}local).
function iterParse(input: SaxInput): AsyncIterableIterator<SaxEvent>Parameters
| Name | Type | Description |
|---|---|---|
input | SaxInput |
Returns
AsyncIterableIterator<SaxEvent>
Parser
src/xml/parser.tsparseXml function
src/xml/parser.ts:107Parse a UTF-8 XML payload into an XmlNode tree. Element and attribute names are returned in Clark notation. Throws OpenXmlSchemaError on DTD/entity declarations or on multi-root documents.
Shorthand for parseXmlDocument when the root's namespace prefixes
don't matter — which is everywhere except the handful of parts that carry an
mc:Ignorable.
function parseXml(input: string | Uint8Array<ArrayBufferLike>): XmlNodeParameters
| Name | Type | Description |
|---|---|---|
input | string | Uint8Array<ArrayBufferLike> |
Returns
XmlNode
Reader
src/zip/reader.tsopenZip function
src/zip/reader.ts:95Open a zip archive from any XlsxSource. The source is fully
materialised in memory, the central directory is parsed once, and each
entry is inflated on demand by openRandomAccessArchive: peak memory
stays at compressed-archive size, plus per-entry inflate scratch, plus a few
MB at most of small entries kept for re-reads, rather than holding every
uncompressed entry resident. The fflate unzipSync fallback is preserved
internally for some malformed ZIP32 archives the random-access reader
rejects, and it does hold every entry inflated.
Throws OpenXmlIoError when the bytes are not a readable zip, and when the source itself fails to produce them. See the error contract on OpenXmlIoError. An OLE compound file or a raw BIFF workbook throws OpenXmlUnsupportedFormatError instead, carrying the format it recognised.
function openZip(source: XlsxSource, opts?: OpenZipOptions): Promise<ZipArchive>Parameters
| Name | Type | Description |
|---|---|---|
source | XlsxSource | |
opts? = {} | OpenZipOptions |
Returns
Promise<ZipArchive>
Serializer
src/xml/serializer.tsserializeXml function
src/xml/serializer.ts:45Serialize an XmlNode tree into a UTF-8 byte payload. The
inverse of parseXml: parseXml(serializeXml(n)) yields a
tree structurally equivalent to n modulo attribute insertion order
(which both directions preserve on Node 18+ / V8).
function serializeXml(root: XmlNode, opts?: SerializeOptions): Uint8ArrayParameters
| Name | Type | Description |
|---|---|---|
root | XmlNode | |
opts? = {} | SerializeOptions |
Returns
Uint8Array
Stream writer
src/xml/stream-writer.tscreateXmlStreamWriter function
src/xml/stream-writer.ts:73function createXmlStreamWriter(opts?: XmlStreamWriterOptions): XmlStreamWriterParameters
| Name | Type | Description |
|---|---|---|
opts? = {} | XmlStreamWriterOptions |
Returns
XmlStreamWriter
Writer
src/zip/writer.tscreateZipWriter function
src/zip/writer.ts:173ZIP writer backed by fflate's streaming Zip class. Entries are pushed
through ZipDeflate / ZipPassThrough streams as they arrive, so peak
memory stays at the size of the in-flight entry plus the output buffer rather
than the full archive.
The sink contract is toBytes(), but that name is historical: the sink is
driven by a chunked write(chunk) API that fans bytes out as they arrive.
The buffered Node/browser sinks (toBuffer, toBlob, toArrayBuffer)
concatenate the chunks for a single-shot result; streaming sinks
(toFile, toWritable) forward each chunk to disk / the wrapped writable
without ever holding the full archive resident. Either kind plugs in here.
function createZipWriter(sink: XlsxSink, opts?: ZipWriterOptions): ZipWriterParameters
| Name | Type | Description |
|---|---|---|
sink | XlsxSink | |
opts? = {} | ZipWriterOptions |
Returns
ZipWriter