Alignment of tables
This commit is contained in:
@ -2,6 +2,7 @@ import { expect } from "chai";
|
||||
|
||||
import { Formatter } from "export/formatter";
|
||||
|
||||
import { AlignmentType } from "../../paragraph";
|
||||
import { ShadingType } from "../shading";
|
||||
import { WidthType } from "../table-cell";
|
||||
import { TableLayoutType } from "./table-layout";
|
||||
@ -92,4 +93,23 @@ describe("TableProperties", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("#setAlignment", () => {
|
||||
it("sets the shading of the table", () => {
|
||||
const tp = new TableProperties();
|
||||
tp.setAlignment(AlignmentType.CENTER);
|
||||
const tree = new Formatter().format(tp);
|
||||
expect(tree).to.deep.equal({
|
||||
"w:tblPr": [
|
||||
{
|
||||
"w:jc": {
|
||||
_attr: {
|
||||
"w:val": "center",
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { IgnoreIfEmptyXmlComponent } from "file/xml-components";
|
||||
|
||||
import { Alignment, AlignmentType } from "../../paragraph";
|
||||
import { ITableShadingAttributesProperties, TableShading } from "../shading";
|
||||
import { WidthType } from "../table-cell";
|
||||
import { ITableBordersOptions, TableBorders } from "./table-borders";
|
||||
@ -46,4 +47,8 @@ export class TableProperties extends IgnoreIfEmptyXmlComponent {
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public setAlignment(type: AlignmentType): void {
|
||||
this.root.push(new Alignment(type));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user