Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/docxml/mod.ts>DocumentXml

TypeScript (component) library for building and parsing a DOCX file
Latest
class DocumentXml
extends XmlFileWithContentTypes
import { DocumentXml } from "https://deno.land/x/docxml@5.15.3/mod.ts";

Constructors

new
DocumentXml(location: string, relationships?)

Properties

readonly
children: Promise<DocumentChild[]>

The components normalized from #root, which is potentially arrayed, promised, array promised etc.

readonly
comments: CommentsXml

The API representing "comments.xml" and all the comments associated with this document.

readonly
footers: { add: (location: string, root: HeaderFooterRoot) => unknown; map: <Out>(cb: (footer: FooterXml) => Out) => unknown; }
readonly
headers: { add: (location: string, root: HeaderFooterRoot) => unknown; map: <Out>(cb: (header: HeaderXml) => Out) => unknown; }
readonly
numbering: NumberingXml

The API representing "numbering.xml" and all the numbering styles/schemes

readonly
relationships: RelationshipsXml
readonly
settings: SettingsXml

The API representing "settings.xml" and all the settings associated with this document.

readonly
styles: StylesXml

The API representing "styles.xml" and all the text/paragraph/table styles associated with this document.

Methods

protected
toNode(): Promise<Document>

Get all XmlFile instances related to this one, including self. This helps the system serialize itself back to DOCX fullly. Probably not useful for consumers of the library.

set(root: DocumentRoot): void

Set the contents of the document

Static Methods

fromArchive(
archive: Archive,
contentTypes: ContentTypesXml,
location: string,
): Promise<DocumentXml>

Instantiate this class by looking at the DOCX XML for it.