2019-03-18 23:50:21 +00:00
|
|
|
// http://officeopenxml.com/WPtableCellProperties-Margins.php
|
|
|
|
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
|
|
|
|
2019-04-18 13:55:18 +10:00
|
|
|
export interface ICellMarginProperties {
|
2019-03-18 23:50:21 +00:00
|
|
|
readonly type: string;
|
|
|
|
readonly width: number;
|
|
|
|
}
|
|
|
|
|
2019-04-18 13:55:18 +10:00
|
|
|
class CellMarginAttributes extends XmlAttributeComponent<ICellMarginProperties> {
|
2019-03-18 23:50:21 +00:00
|
|
|
protected readonly xmlKeys = { width: "w:w", type: "w:type" };
|
|
|
|
}
|
|
|
|
|
2019-04-18 13:55:18 +10:00
|
|
|
export class TopCellMargin extends XmlComponent {
|
2019-03-18 23:50:21 +00:00
|
|
|
constructor(value: number) {
|
|
|
|
super("w:top");
|
|
|
|
|
|
|
|
this.root.push(
|
2019-04-18 13:55:18 +10:00
|
|
|
new CellMarginAttributes({
|
2019-03-18 23:50:21 +00:00
|
|
|
width: value,
|
|
|
|
type: "dxa",
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-18 13:55:18 +10:00
|
|
|
export class BottomCellMargin extends XmlComponent {
|
2019-03-18 23:50:21 +00:00
|
|
|
constructor(value: number) {
|
|
|
|
super("w:bottom");
|
|
|
|
|
|
|
|
this.root.push(
|
2019-04-18 13:55:18 +10:00
|
|
|
new CellMarginAttributes({
|
2019-03-18 23:50:21 +00:00
|
|
|
width: value,
|
|
|
|
type: "dxa",
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-18 13:55:18 +10:00
|
|
|
export class LeftCellMargin extends XmlComponent {
|
2019-03-18 23:50:21 +00:00
|
|
|
constructor(value: number) {
|
|
|
|
super("w:start");
|
|
|
|
|
|
|
|
this.root.push(
|
2019-04-18 13:55:18 +10:00
|
|
|
new CellMarginAttributes({
|
2019-03-18 23:50:21 +00:00
|
|
|
width: value,
|
|
|
|
type: "dxa",
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-18 13:55:18 +10:00
|
|
|
export class RightCellMargin extends XmlComponent {
|
2019-03-18 23:50:21 +00:00
|
|
|
constructor(value: number) {
|
|
|
|
super("w:end");
|
|
|
|
|
|
|
|
this.root.push(
|
2019-04-18 13:55:18 +10:00
|
|
|
new CellMarginAttributes({
|
2019-03-18 23:50:21 +00:00
|
|
|
width: value,
|
|
|
|
type: "dxa",
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|