Consolidate TableWidth and TableCellMargins types; add Table indent (#954)

This commit is contained in:
Tom Hunkapiller
2021-05-23 21:17:20 +03:00
parent 528be93191
commit dd6d1bc039
18 changed files with 215 additions and 552 deletions

View File

@ -139,34 +139,3 @@ export class TDirection extends XmlComponent {
);
}
}
export enum WidthType {
/** Auto. */
AUTO = "auto",
/** Value is in twentieths of a point */
DXA = "dxa",
/** No (empty) value. */
NIL = "nil",
/** Value is in percentage. */
PERCENTAGE = "pct",
}
class TableCellWidthAttributes extends XmlAttributeComponent<{ readonly type: WidthType; readonly width: string | number }> {
protected readonly xmlKeys = { width: "w:w", type: "w:type" };
}
/**
* Table cell width element.
*/
export class TableCellWidth extends XmlComponent {
constructor(value: string | number, type: WidthType = WidthType.AUTO) {
super("w:tcW");
this.root.push(
new TableCellWidthAttributes({
width: value,
type: type,
}),
);
}
}