import { default } from "https://deno.land/x/docxml@5.15.3/mod.ts";
Represents the DOCX file as a whole, and collates other responsibilities together. Provides access to DOCX content types (ContentTypesXml), relationships (RelationshipsXml), the document itself (DocumentXml).
An instance of this class can access other classes that represent the various XML files in a
DOCX archive, such as ContentTypes.xml
, word/document.xml
, and _rels/.rels
.
Constructors
Properties
The utility function dealing with the XML for recording content types. Every DOCX file has exactly one of these.
The API representing "docProps/custom.xml"
A short-cut to the relationship that represents visible document content.
The utility function dealing with the top-level XML file for recording relationships. Other relationships may have their own relationship XMLs.
Methods
Add all the XML translatiom rules from another set of translation rules. Useful for cloning.
Clone some reusable configuration to a new instance of Docx:
- XML rendering rules
- Settings
- Default content types
- Custom styles
Does not clone other things, like:
- Not content
- Not content type overrides
- Not relationships (unless required for settings)
- Not anything else either
Create a ZIP archive, which is the handler for .docx
files as a ZIP archive.
Convenience method to create a DOCX archive from the current document and write it to your disk.
A convenience method to set a few settings for the document.
Set the document contents to the provided XML, transformed using the rules previously registered through Docx.withXmlRule.
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.
Static Methods
Instantiate this class by giving it a .docx
file if it is already loaded as a Archive instance.
Instantiate this class by giving it a .docx
file loaded as a byte array.
Instantiate this class by pointing at a .docx
file location.
Create a new DOCX with contents composed by this library's components. Needs a single JSX component
as root, for example <Section>
or <Paragragh>
.
Create an empty DOCX, and populate it with the minimum viable contents to appease MS Word.