Class TableElement
Represents the base class for all table elements in the content model.
Implements
Inherited Members
Namespace: IronWord.Models.Abstract
Assembly: IronWord.dll
Syntax
public abstract class TableElement : ParentElement
Sharing fill, border, and content-extraction behavior across the parts of a Word table in C# is the role of TableElement. It is the base the table-structure nodes descend from, so a table, its rows, and its cells all expose the same appearance and extraction members. A developer meets it through one of those concrete nodes rather than on its own.
The types that extend it are Table, TableCell, and TableRow, obtained when you build a table or read one from a document. BackgroundColor sets the fill behind the element as a Color, and Borders carries a TableBorders describing the lines around it, so styling a whole table or a single cell uses the same two properties. ExtractImages and ExtractShapes return the ImageContent and ShapeContent nodes nested inside the element, which is how you pull embedded graphics out of a table region. Because the type is abstract, it is never constructed directly.
using IronWord.Models;
TableCell cell = new TableCell();
cell.BackgroundColor = Color.LightGray;The add table how-to builds and styles tables, and the extract images how-to pulls graphics out of a document.
Constructors
TableElement()
Declaration
protected TableElement()
Properties
BackgroundColor
Gets or sets the background color of the table element.
Declaration
public Color BackgroundColor { get; set; }
Property Value
| Type | Description |
|---|---|
| Color |
Borders
Gets or sets the border styles for the table element.
Declaration
public TableBorders Borders { get; set; }
Property Value
| Type | Description |
|---|---|
| TableBorders |
Methods
ExtractImages()
Extract all images from this container.
Declaration
public List<ImageContent> ExtractImages()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.List<ImageContent> |
ExtractShapes()
Extract all shapes from this container.
Declaration
public List<ShapeContent> ExtractShapes()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.List<ShapeContent> |