Search Results for

    Show / Hide Table of Contents

    Class TableElement

    Represents the base class for all table elements in the content model.

    Inheritance
    System.Object
    ContentElement
    ParentElement
    TableElement
    Table
    TableCell
    TableRow
    Implements
    IronSoftware.Abstractions.Word.IWordDocumentObject
    IronSoftware.Abstractions.IDocumentObject
    System.ICloneable
    IronSoftware.Abstractions.IParent<IronSoftware.Abstractions.Word.IWordDocumentObjectCollection, IronSoftware.Abstractions.Word.IWordDocumentObject>
    Inherited Members
    ParentElement.AddChild(IWordDocumentObject[])
    ParentElement.InsertChildToIndex(Int32, IWordDocumentObject[])
    ParentElement.Remove()
    ParentElement.RemoveChildren(IWordDocumentObject[])
    ParentElement.RemoveAllChildren()
    ParentElement.ExtractElements<T>()
    ParentElement.GetChildByIndex<T>(Int32)
    ParentElement.Clone()
    ParentElement.CloneObject()
    ParentElement.LogObjectTree()
    ParentElement.Texts
    ParentElement.Tables
    ParentElement.Children
    ContentElement.Replace(IWordDocumentObject)
    ContentElement.GetIndex<T>()
    ContentElement.Parent
    ContentElement.Status
    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>

    Implements

    IronSoftware.Abstractions.Word.IWordDocumentObject
    IronSoftware.Abstractions.IDocumentObject
    System.ICloneable
    IronSoftware.Abstractions.IParent<, >

    Inherited members

    AddChild(IWordDocumentObject[])
    InsertChildToIndex(Int32, IWordDocumentObject[])
    Remove()
    RemoveChildren(IWordDocumentObject[])
    RemoveAllChildren()
    ExtractElements<T>()
    GetChildByIndex<T>(Int32)
    Clone()
    CloneObject()
    LogObjectTree()
    Texts
    Tables
    Children
    Replace(IWordDocumentObject)
    GetIndex<T>()
    Parent
    Status
    ☀
    ☾
    Downloads
    • Download with NuGet
    • Start for Free
    In This Article
    Back to top
    Install with NuGet