fix set table cell width
This commit is contained in:
@ -6,7 +6,7 @@ import { IXmlableObject, XmlComponent } from "file/xml-components";
|
|||||||
import { ITableShadingAttributesProperties } from "../shading";
|
import { ITableShadingAttributesProperties } from "../shading";
|
||||||
import { Table } from "../table";
|
import { Table } from "../table";
|
||||||
import { ITableCellMarginOptions } from "./cell-margin/table-cell-margins";
|
import { ITableCellMarginOptions } from "./cell-margin/table-cell-margins";
|
||||||
import { VerticalAlign, VerticalMergeType } from "./table-cell-components";
|
import { VerticalAlign, VerticalMergeType, WidthType } from "./table-cell-components";
|
||||||
import { TableCellProperties } from "./table-cell-properties";
|
import { TableCellProperties } from "./table-cell-properties";
|
||||||
|
|
||||||
export interface ITableCellOptions {
|
export interface ITableCellOptions {
|
||||||
@ -14,6 +14,10 @@ export interface ITableCellOptions {
|
|||||||
readonly margins?: ITableCellMarginOptions;
|
readonly margins?: ITableCellMarginOptions;
|
||||||
readonly verticalAlign?: VerticalAlign;
|
readonly verticalAlign?: VerticalAlign;
|
||||||
readonly verticalMerge?: VerticalMergeType;
|
readonly verticalMerge?: VerticalMergeType;
|
||||||
|
readonly width?: {
|
||||||
|
readonly size: number | string;
|
||||||
|
readonly type?: WidthType;
|
||||||
|
};
|
||||||
readonly columnSpan?: number;
|
readonly columnSpan?: number;
|
||||||
readonly rowSpan?: number;
|
readonly rowSpan?: number;
|
||||||
readonly borders?: {
|
readonly borders?: {
|
||||||
@ -78,6 +82,10 @@ export class TableCell extends XmlComponent {
|
|||||||
this.properties.addVerticalMerge(VerticalMergeType.RESTART);
|
this.properties.addVerticalMerge(VerticalMergeType.RESTART);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (options.width) {
|
||||||
|
this.properties.setWidth(options.width.size, options.width.type);
|
||||||
|
}
|
||||||
|
|
||||||
if (options.borders) {
|
if (options.borders) {
|
||||||
if (options.borders.top) {
|
if (options.borders.top) {
|
||||||
this.properties.Borders.addTopBorder(options.borders.top.style, options.borders.top.size, options.borders.top.color);
|
this.properties.Borders.addTopBorder(options.borders.top.style, options.borders.top.size, options.borders.top.color);
|
||||||
|
Reference in New Issue
Block a user