UNPKG

docx

Version:

Easily generate .docx files with JS/TS with a nice declarative API. Works for Node and on the Browser.

28 lines (22 loc) 790 B
// http://officeopenxml.com/WPstyleGenProps.php import { decimalNumber } from "file/values"; import { XmlAttributeComponent, XmlComponent } from "file/xml-components"; class ComponentAttributes extends XmlAttributeComponent<{ readonly val: string | number; }> { protected readonly xmlKeys = { val: "w:val" }; } export class Name extends XmlComponent { constructor(value: string) { super("w:name"); this.root.push(new ComponentAttributes({ val: value })); } } export class UiPriority extends XmlComponent { constructor(value: number) { super("w:uiPriority"); this.root.push(new ComponentAttributes({ val: decimalNumber(value) })); } } export class TableProperties extends XmlComponent {} export class RsId extends XmlComponent {}