diff --git a/src/file/table/table-cell.ts b/src/file/table/table-cell.ts index 5e64cc04b6..954786aa12 100644 --- a/src/file/table/table-cell.ts +++ b/src/file/table/table-cell.ts @@ -205,3 +205,27 @@ export class TableCellWidth extends XmlComponent { ); } } + +interface ITableCellShadingAttributesProperties { + fill?: string; + color?: string; + val?: string; +} + +class TableCellShadingAttributes extends XmlAttributeComponent { + protected xmlKeys = { + fill: "w:fill", + color: "w:color", + val: "w:val", + }; +} + +/** + * Table cell shading element. + */ +export class TableCellShading extends XmlComponent { + constructor(attrs: object) { + super("w:shd"); + this.root.push(new TableCellShadingAttributes(attrs)); + } +} diff --git a/src/file/table/table.ts b/src/file/table/table.ts index 2d19086baa..3837e9f79b 100644 --- a/src/file/table/table.ts +++ b/src/file/table/table.ts @@ -1,4 +1,4 @@ -import { GridSpan, TableCellBorders, TableCellWidth, VAlign, VerticalAlign, VMerge, VMergeType, WidthType } from "file/table/table-cell"; +import { GridSpan, TableCellBorders, TableCellWidth, TableCellShading, VAlign, VerticalAlign, VMerge, VMergeType, WidthType } from "file/table/table-cell"; import { IXmlableObject, XmlComponent } from "file/xml-components"; import { Paragraph } from "../paragraph"; import { TableGrid } from "./grid"; @@ -159,4 +159,10 @@ export class TableCellProperties extends XmlComponent { return this; } + + public setShading(attrs: object): TableCellProperties { + this.root.push(new TableCellShading(attrs)); + + return this; + } }