extend table and table cell support for cell merge, span, borders ... (#6)
* extend table and table cell support for cell merge, span, borders ... * added tests for table cell borders and table cell width, renamed some variables, added jsdoc
This commit is contained in:
@ -2,6 +2,7 @@ import { IXmlableObject, XmlComponent } from "file/xml-components";
|
||||
import { Paragraph } from "../paragraph";
|
||||
import { TableGrid } from "./grid";
|
||||
import { TableProperties, WidthTypes } from "./properties";
|
||||
import { TableCellBorders, GridSpan, VMerge, VMergeType, VerticalAlign, VAlign, TableCellWidth, WidthType } from "file/table/table-cell";
|
||||
|
||||
export class Table extends XmlComponent {
|
||||
private readonly properties: TableProperties;
|
||||
@ -123,7 +124,29 @@ export class TableCell extends XmlComponent {
|
||||
}
|
||||
|
||||
export class TableCellProperties extends XmlComponent {
|
||||
private cellBorder: TableCellBorders;
|
||||
constructor() {
|
||||
super("w:tcPr");
|
||||
this.cellBorder = new TableCellBorders();
|
||||
this.root.push(this.cellBorder);
|
||||
}
|
||||
|
||||
get borders() {
|
||||
return this.cellBorder;
|
||||
}
|
||||
addGridSpan(cellSpan: number) {
|
||||
this.root.push(new GridSpan(cellSpan));
|
||||
}
|
||||
|
||||
addVerticalMerge(type: VMergeType) {
|
||||
this.root.push(new VMerge(type));
|
||||
}
|
||||
|
||||
setVerticalAlign(vAlignType: VerticalAlign) {
|
||||
this.root.push(new VAlign(vAlignType));
|
||||
}
|
||||
|
||||
setWidth(width: string | number, type: WidthType) {
|
||||
this.root.push(new TableCellWidth(width, type));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user