Files
docx-js/src/file/drawing/text-wrap/wrap-square.ts

32 lines
912 B
TypeScript
Raw Normal View History

// http://officeopenxml.com/drwPicFloating-textWrap.php
2018-06-09 23:49:01 +01:00
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
import { ITextWrapping, WrapTextOption } from ".";
import { IDistance } from "../drawing";
2018-06-09 23:49:01 +01:00
interface IWrapSquareAttributes extends IDistance {
wrapText?: WrapTextOption;
}
class WrapSquareAttributes extends XmlAttributeComponent<IWrapSquareAttributes> {
protected xmlKeys = {
distT: "distT",
distB: "distB",
distL: "distL",
distR: "distR",
wrapText: "wrapText",
};
}
export class WrapSquare extends XmlComponent {
2018-06-09 23:49:01 +01:00
constructor(textWrapping: ITextWrapping) {
super("wp:wrapSquare");
this.root.push(
new WrapSquareAttributes({
wrapText: textWrapping.wrapTextOption || WrapTextOption.BOTH_SIDES,
...textWrapping.distanceFromText,
}),
);
}
}