Files
docx-js/src/file/table/table-cell/table-cell-properties.ts

66 lines
1.6 KiB
TypeScript
Raw Normal View History

2018-10-23 23:44:50 +01:00
import { XmlComponent } from "file/xml-components";
2019-03-18 23:50:21 +00:00
import { ITableCellMargainOptions, TableCellMargain } from "./cell-margain/table-cell-margains";
2018-10-23 23:44:50 +01:00
import {
GridSpan,
2018-11-01 02:22:32 +00:00
ITableCellShadingAttributesProperties,
2018-10-23 23:44:50 +01:00
TableCellBorders,
TableCellShading,
TableCellWidth,
VAlign,
VerticalAlign,
VMerge,
VMergeType,
WidthType,
} from "./table-cell-components";
export class TableCellProperties extends XmlComponent {
private readonly cellBorder: TableCellBorders;
constructor() {
super("w:tcPr");
this.cellBorder = new TableCellBorders();
this.root.push(this.cellBorder);
}
public get Borders(): TableCellBorders {
return this.cellBorder;
}
public addGridSpan(cellSpan: number): TableCellProperties {
this.root.push(new GridSpan(cellSpan));
return this;
}
public addVerticalMerge(type: VMergeType): TableCellProperties {
this.root.push(new VMerge(type));
return this;
}
public setVerticalAlign(type: VerticalAlign): TableCellProperties {
this.root.push(new VAlign(type));
return this;
}
public setWidth(width: string | number, type: WidthType = WidthType.AUTO): TableCellProperties {
2018-10-23 23:44:50 +01:00
this.root.push(new TableCellWidth(width, type));
return this;
}
2018-11-01 02:22:32 +00:00
public setShading(attrs: ITableCellShadingAttributesProperties): TableCellProperties {
2018-10-23 23:44:50 +01:00
this.root.push(new TableCellShading(attrs));
return this;
}
2019-03-18 23:50:21 +00:00
public addMargains(options: ITableCellMargainOptions): TableCellProperties {
this.root.push(new TableCellMargain(options));
return this;
}
2018-10-23 23:44:50 +01:00
}