Skip to main content
Module

x/docxml/mod.ts>default

An experimental Deno tool to transform XML to DOCX with a little XPath- and component based configuration
Go to Latest
class default
import { default } from "https://deno.land/x/docxml@2.4.2/mod.ts";

The top-level configuration API for creating a new transformation of your XML input to a valid OOXML .docx file. Its properties and methods provide convenient access to registering transformation rules (Api.match) or more fine-grained control of the contents of the DOCX.

Uses Docx to describe the product DOCX file.

Constructors

new
default()

Type Parameters

PropsGeneric extends { [key: string]: unknown; }

Properties

private
readonly
renderer: GenericRenderer<RuleResult, ReturnType<publicApiForBundle> & PropsGeneric>

The XML renderer instance containing translation rules, going from your XML to this library's OOXML components.

readonly
document

A short-cut to the relationship that represents visible document content.

readonly
docx: Docx

A reference to the Docx instance representing the result DOCX file.

readonly
JSX

The JSX pragma.

readonly
styles

A short-cut to the relationship that represents visible document styles. Through this relationships new styles can be added.

Methods

match(xPathTest: string, transformer: Parameters<this.renderer.add>[1])

Add an XML translation rule, applied to an element that matches the given XPath test.

If an element matches multiple rules, the rule with the most specific XPath test wins.

transform(xml: string, props: PropsGeneric)

Set the XML-to-DOCX transformation in motion for the given XML string, and whichever added context you want to pass into the translation rule callbacks.

Static Properties

readonly
deprecated
JSX

The JSX pragma.