docx
Version:
Easily generate .docx files with JS/TS with a nice declarative API. Works for Node and on the Browser.
27 lines (23 loc) • 654 B
text/typescript
// http://officeopenxml.com/drwPicFloating-position.php
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
class SimplePosAttributes extends XmlAttributeComponent<{
readonly x: number;
readonly y: number;
}> {
protected readonly xmlKeys = {
x: "x",
y: "y",
};
}
export class SimplePos extends XmlComponent {
constructor() {
super("wp:simplePos");
// NOTE: It's not fully supported in Microsoft Word, but this element is needed anyway
this.root.push(
new SimplePosAttributes({
x: 0,
y: 0,
}),
);
}
}