Add tests and margain

This commit is contained in:
Dolan
2019-03-18 23:50:21 +00:00
parent 639842332f
commit e67fd9cb2b
19 changed files with 611 additions and 107 deletions

View File

@ -0,0 +1,63 @@
// http://officeopenxml.com/WPtableCellProperties-Margins.php
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
export interface ICellMargainProperties {
readonly type: string;
readonly width: number;
}
class CellMargainAttributes extends XmlAttributeComponent<ICellMargainProperties> {
protected readonly xmlKeys = { width: "w:w", type: "w:type" };
}
export class TopCellMargain extends XmlComponent {
constructor(value: number) {
super("w:top");
this.root.push(
new CellMargainAttributes({
width: value,
type: "dxa",
}),
);
}
}
export class BottomCellMargain extends XmlComponent {
constructor(value: number) {
super("w:bottom");
this.root.push(
new CellMargainAttributes({
width: value,
type: "dxa",
}),
);
}
}
export class LeftCellMargain extends XmlComponent {
constructor(value: number) {
super("w:start");
this.root.push(
new CellMargainAttributes({
width: value,
type: "dxa",
}),
);
}
}
export class RightCellMargain extends XmlComponent {
constructor(value: number) {
super("w:end");
this.root.push(
new CellMargainAttributes({
width: value,
type: "dxa",
}),
);
}
}