Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/docxml/src/files/Styles.ts>Styles

TypeScript library for parsing and building a DOCXML file
Go to Latest
class Styles
extends XmlFile
import { Styles } from "https://deno.land/x/docxml@5.2.0/src/files/Styles.ts";

Constructors

new
Styles(location: string)

Properties

readonly
styles: AnyStyleDefinition[]

The list of custom styles. Does not include latent styles.

Methods

protected
toNode(): Document
add(properties: Omit<AnyStyleDefinition, "id"> & { id?: string; })

Add a custom style to the available style palette. If it does not have an identifier already, the system will propose an identifier based on the style name, or create a unique GUID. This method throws when the identifier is not unique.

addLatent(properties: LatentStyle)

Adds a latent style, which means that the Word processor should determine its actual properties

Add several custom styles to the available palette. Useful for cloning the style configuration of another DOCX.

deprecated
ensureStyle(id: string)

Ensure that a style with this identifier exists. If it doesn't already exist, an empty (paragraph) style is added just in time.

deprecated
get(id: string)

Gets the style data by its identifier.

hasStyle(id: string)

Checks wether a custom style or a latent style with this identifier already exists.

Static Methods

fromArchive(archive: Archive, location: string): Promise<Styles>

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