API reference
Low-level (XML / ZIP / schema / packaging)
XML reader / writer, OPC packaging, schema, ZIP. Reach in only when wiring custom parts.
Namespaces
src/xml/namespaces.ts# parseQName function
src/xml/namespaces.ts:172Inverse 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:162Build 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:153const ACTIVEX_TYPE: "application/vnd.ms-office.activeX+xml"# ARC_APP const
src/xml/namespaces.ts:121const ARC_APP: "docProps/app.xml"# ARC_CONTENT_TYPES const
src/xml/namespaces.ts:117const ARC_CONTENT_TYPES: "[Content_Types].xml"# ARC_CORE const
src/xml/namespaces.ts:120const ARC_CORE: "docProps/core.xml"# ARC_CUSTOM const
src/xml/namespaces.ts:122const ARC_CUSTOM: "docProps/custom.xml"# ARC_CUSTOM_UI const
src/xml/namespaces.ts:127const ARC_CUSTOM_UI: "customUI/customUI.xml"# ARC_ROOT_RELS const
src/xml/namespaces.ts:118const ARC_ROOT_RELS: "_rels/.rels"# ARC_SHARED_STRINGS const
src/xml/namespaces.ts:126const ARC_SHARED_STRINGS: "xl/sharedStrings.xml"# ARC_STYLE const
src/xml/namespaces.ts:124const ARC_STYLE: "xl/styles.xml"# ARC_THEME const
src/xml/namespaces.ts:125const ARC_THEME: "xl/theme/theme1.xml"# ARC_WORKBOOK const
src/xml/namespaces.ts:123const ARC_WORKBOOK: "xl/workbook.xml"# ARC_WORKBOOK_RELS const
src/xml/namespaces.ts:119const ARC_WORKBOOK_RELS: "xl/_rels/workbook.xml.rels"# C14_NS const
src/xml/namespaces.ts:54const C14_NS: "http://schemas.microsoft.com/office/drawing/2010/chart"# C15_NS const
src/xml/namespaces.ts:55const C15_NS: "http://schemas.microsoft.com/office/drawing/2012/chart"# C16_NS const
src/xml/namespaces.ts:56const 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:147const CHART_TYPE: "application/vnd.openxmlformats-officedocument.drawingml.chart+xml"# CHARTSHAPE_TYPE const
src/xml/namespaces.ts:149const CHARTSHAPE_TYPE: "application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml"# CHARTSHEET_TYPE const
src/xml/namespaces.ts:145const CHARTSHEET_TYPE: string# COMMENTS_NS const
src/xml/namespaces.ts:22const COMMENTS_NS: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments"# COMMENTS_TYPE const
src/xml/namespaces.ts:143const COMMENTS_TYPE: string# CONTYPES_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:151const CPROPS_TYPE: "application/vnd.openxmlformats-officedocument.custom-properties+xml"# CTRLPROPS_TYPE const
src/xml/namespaces.ts:154const CTRLPROPS_TYPE: "application/vnd.ms-excel.controlproperties+xml"# CUSTOMUI_NS const
src/xml/namespaces.ts:49const 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:57const 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:68const 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:146const 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:141const EXTERNAL_LINK_TYPE: string# IMAGE_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:50const MARKUP_COMPAT_NS: "http://schemas.openxmlformats.org/markup-compatibility/2006"# PACKAGE_CHARTS const
src/xml/namespaces.ts:110const PACKAGE_CHARTS: "xl/charts"# PACKAGE_CHARTSHEETS const
src/xml/namespaces.ts:108const PACKAGE_CHARTSHEETS: "xl/chartsheets"# PACKAGE_CHARTSHEETS_RELS const
src/xml/namespaces.ts:115const PACKAGE_CHARTSHEETS_RELS: "xl/chartsheets/_rels"# PACKAGE_DRAWINGS const
src/xml/namespaces.ts:109const PACKAGE_DRAWINGS: "xl/drawings"# PACKAGE_IMAGES const
src/xml/namespaces.ts:111const PACKAGE_IMAGES: "xl/media"# PACKAGE_PIVOT_CACHE const
src/xml/namespaces.ts:113const PACKAGE_PIVOT_CACHE: "xl/pivotCache"# PACKAGE_PIVOT_TABLE const
src/xml/namespaces.ts:112const PACKAGE_PIVOT_TABLE: "xl/pivotTables"# PACKAGE_PROPS const
src/xml/namespaces.ts:103const PACKAGE_PROPS: "docProps"# PACKAGE_RELS const
src/xml/namespaces.ts:105const PACKAGE_RELS: "_rels"# PACKAGE_THEME const
src/xml/namespaces.ts:106const PACKAGE_THEME: "xl/theme"# PACKAGE_WORKSHEET_RELS const
src/xml/namespaces.ts:114const PACKAGE_WORKSHEET_RELS: "xl/worksheets/_rels"# PACKAGE_WORKSHEETS const
src/xml/namespaces.ts:107const PACKAGE_WORKSHEETS: "xl/worksheets"# PACKAGE_XL const
src/xml/namespaces.ts:104const 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:140const SHARED_STRINGS_TYPE: string# SHEET_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:144const STYLES_TYPE: string# THEME_TYPE const
src/xml/namespaces.ts:150const THEME_TYPE: "application/vnd.openxmlformats-officedocument.theme+xml"# THREADED_COMMENTS_NS const
src/xml/namespaces.ts:58const THREADED_COMMENTS_NS: "http://schemas.microsoft.com/office/spreadsheetml/2018/threadedcomments"# VBA_TYPE const
src/xml/namespaces.ts:152const 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:142const WORKSHEET_TYPE: string# X14_NS const
src/xml/namespaces.ts:51const X14_NS: "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"# X15_NS const
src/xml/namespaces.ts:52const X15_NS: "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"# X16_NS const
src/xml/namespaces.ts:53const X16_NS: "http://schemas.microsoft.com/office/spreadsheetml/2014/revision"# XLSM_TYPE const
src/xml/namespaces.ts:138const XLSM_TYPE: string# XLSX_TYPE const
src/xml/namespaces.ts:136const XLSX_TYPE: string# XLTM_TYPE const
src/xml/namespaces.ts:139const XLTM_TYPE: string# XLTX_TYPE const
src/xml/namespaces.ts:137const XLTX_TYPE: string# XML_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.ts# appendCustomProperty function
src/packaging/custom.ts:122function 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:156function customPropsFromBytes(bytes: string | Uint8Array<ArrayBufferLike>): CustomPropertiesParameters
| Name | Type | Description |
|---|---|---|
bytes | string | Uint8Array<ArrayBufferLike> |
Returns
CustomProperties
# customPropsToBytes function
src/packaging/custom.ts:142function customPropsToBytes(p: CustomProperties): Uint8ArrayParameters
| Name | Type | Description |
|---|---|---|
p | CustomProperties |
Returns
Uint8Array
# findCustomPropertyByName function
src/packaging/custom.ts:135function findCustomPropertyByName(props: CustomProperties, name: string): CustomProperty | undefinedParameters
| Name | Type | Description |
|---|---|---|
props | CustomProperties | |
name | string |
Returns
CustomProperty | undefined
# getCustomPropertyValue function
src/packaging/custom.ts:249Read 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:283Read-only snapshot of every custom property.
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:99function readBoolValue(v: XmlNode): boolean | undefinedParameters
| Name | Type | Description |
|---|---|---|
v | XmlNode |
Returns
boolean | undefined
# readDoubleValue function
src/packaging/custom.ts:91function readDoubleValue(v: XmlNode): number | undefinedParameters
| Name | Type | Description |
|---|---|---|
v | XmlNode |
Returns
number | undefined
# readFiletimeValue function
src/packaging/custom.ts:106function readFiletimeValue(v: XmlNode): string | undefinedParameters
| Name | Type | Description |
|---|---|---|
v | XmlNode |
Returns
string | undefined
# readIntValue function
src/packaging/custom.ts:74function readIntValue(v: XmlNode): number | undefinedParameters
| Name | Type | Description |
|---|---|---|
v | XmlNode |
Returns
number | undefined
# readStringValue function
src/packaging/custom.ts:69function readStringValue(v: XmlNode): string | undefinedParameters
| Name | Type | Description |
|---|---|---|
v | XmlNode |
Returns
string | undefined
# removeCustomProperty function
src/packaging/custom.ts:273Remove 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:228Set (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:235Set (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:218Set (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:211Set (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.ts# corePropsFromBytes function
src/packaging/core.ts:99function corePropsFromBytes(bytes: string | Uint8Array<ArrayBufferLike>): CorePropertiesParameters
| Name | Type | Description |
|---|---|---|
bytes | string | Uint8Array<ArrayBufferLike> |
Returns
CoreProperties
# corePropsToBytes function
src/packaging/core.ts:95function corePropsToBytes(p: CoreProperties): Uint8ArrayParameters
| Name | Type | Description |
|---|---|---|
p | CoreProperties |
Returns
Uint8Array
# makeCoreProperties function
src/packaging/core.ts:91function makeCoreProperties(): CorePropertiesReturns
CoreProperties
# setWorkbookCategory function
src/packaging/core.ts:143Set 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:113Set 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:128Set 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:133Set 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:138Set 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:123Set 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:118Set the document title.
function setWorkbookTitle(wb: Workbook, title: string): voidParameters
| Name | Type | Description |
|---|---|---|
wb | Workbook | |
title | string |
Returns
void
Extended
src/packaging/extended.ts# extendedPropsFromBytes 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.ts# addDefault 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.ts# appendRel 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.ts# appendChild 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.ts# fromTree function
src/schema/serialize.ts:203Materialise 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:90Serialise 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.ts# defineSchema function
src/schema/core.ts:154Identity 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.ts# DEFAULT_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.ts# iterParse function
src/xml/iterparse.ts:83Parse 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.ts# parseXml function
src/xml/parser.ts:72Parse 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.
function parseXml(input: string | Uint8Array<ArrayBufferLike>): XmlNodeParameters
| Name | Type | Description |
|---|---|---|
input | string | Uint8Array<ArrayBufferLike> |
Returns
XmlNode
Reader
src/zip/reader.ts# openZip function
src/zip/reader.ts:69Open 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 rather than holding every uncompressed entry resident. The fflate `unzipSync` fallback is preserved internally for ZIP64 / non-standard archives the random-access reader rejects.
function openZip(source: XlsxSource, opts?: OpenZipOptions): Promise<ZipArchive>Parameters
| Name | Type | Description |
|---|---|---|
source | XlsxSource | |
opts? = {} | OpenZipOptions |
Returns
Promise<ZipArchive>
Serializer
src/xml/serializer.ts# serializeXml function
src/xml/serializer.ts:37Serialize 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.ts# createXmlStreamWriter function
src/xml/stream-writer.ts:73function createXmlStreamWriter(opts?: XmlStreamWriterOptions): XmlStreamWriterParameters
| Name | Type | Description |
|---|---|---|
opts? = {} | XmlStreamWriterOptions |
Returns
XmlStreamWriter
Writer
src/zip/writer.ts# createZipWriter function
src/zip/writer.ts:93ZIP 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): ZipWriterParameters
| Name | Type | Description |
|---|---|---|
sink | XlsxSink |
Returns
ZipWriter