TableCell Class

Table Cell.When the object is serialized out as xml, its qualified name is a:tc.

Inheritance Hierarchy

System.Object
  DocumentFormat.OpenXml.OpenXmlElement
    DocumentFormat.OpenXml.OpenXmlCompositeElement
      DocumentFormat.OpenXml.Drawing.TableCell

Namespace:  DocumentFormat.OpenXml.Drawing
Assembly:  DocumentFormat.OpenXml (in DocumentFormat.OpenXml.dll)

Syntax

'Declaration
<ChildElementInfoAttribute(GetType(ExtensionList))> _
<ChildElementInfoAttribute(GetType(TextBody))> _
<ChildElementInfoAttribute(GetType(TableCellProperties))> _
Public Class TableCell _
    Inherits OpenXmlCompositeElement
'Usage
Dim instance As TableCell
[ChildElementInfoAttribute(typeof(ExtensionList))]
[ChildElementInfoAttribute(typeof(TextBody))]
[ChildElementInfoAttribute(typeof(TableCellProperties))]
public class TableCell : OpenXmlCompositeElement

Remarks

The following table lists the possible child types:

  • TextBody <a:txBody>

  • TableCellProperties <a:tcPr>

  • ExtensionList <a:extLst>

[ISO/IEC 29500-1 1st Edition]

21.1.3.16 tc (Table Cell)

This element defines a cell within the table. The table cell holds a text body that actually contains the data held within the cell along with the properties of the table cell which hold formatting options associated with the cell.

[Example: Consider the following example of a tc within DrawingML:

<a:tc>
<a:txBody>
<a:bodyPr/>
<a:lstStyle/>
<a:p>
<a:pPr marL="0" algn="ctr" rtl="0"/>
      <a:r>
<a:rPr lang="en-US" dirty="0" smtClean="0"/>
<a:t>data</a:t>
</a:r>
      <a:endParaRPr lang="en-US" dirty="0"/>
</a:p>
</a:txBody>
<a:tcPr/>
</a:tc>

In this example, we see a single cell in a table being defined with the default cell properties and a text body which contains the word "data". The text "data" is the only text in the cell. end example]

Parent Elements

tr (§21.1.3.18)

Child Elements

Subclause

extLst (Extension List)

§20.1.2.2.15

tcPr (Table Cell Properties)

§21.1.3.17

txBody (Shape Text Body)

§20.1.2.2.40

Attributes

Description

gridSpan (Grid Span)

Specifies the number of columns that a merged cell spans. This is used in combination with the hMerge attribute on other cells in order to specify the beginning cell of a horizontal merge.

[Example: Consider the following example:

        
<a:tc gridSpan="3">
…
/a:tc>
<a:tc hMerge="1">
…
/a:tc>
<a:tc hMerge="1">
…
/a:tc>

      

In this example, we can define what looks like a single cell in the table as a group of three cells merged together. The merged cell spans three columns of the table. end example]

The possible values for this attribute are defined by the W3C XML Schema int datatype.

hMerge (Horizontal Merge)

When this attribute is set to 1 or true , then this table cell is to be merged with the previous horizontal table cell when the table is created.

[Example: Consider the following example:

        
<a:tc hMerge="1">
…
</a:tc>

      

In this example, we see the hMerge attribute set to on which signifies that this cell is to be merged with the previous horizontal cell in the table. end example]

The possible values for this attribute are defined by the W3C XML Schema boolean datatype.

id (Table Cell Identifier)

Specifies a unique identifier for the current table cell. This identifier shall be unique within the table, and is used to identify this table cell as a header cell for other cells within the table, using the headers child element.

If this element is omitted, this table cell has no unique identifier.

[Example: Consider a table cell defined as follows:

        
<a:tc id="januarytwentynine">
…
</a:tc>

      

The value in the id specifies a unique identifer oif januarytwentynine. Other cells in the table are then able to reference this cell as a row or column header by referencing this ID. end example]

The possible values for this attribute are defined by the W3C XML Schema string datatype.

rowSpan (Row Span)

Specifies the number of rows that a merged cell spans. This is used in combination with the vMerge attribute on other cells in order to specify the beginning cell of a horizontal merge.

[Example: Consider the following example:

        
<a:tc rowSpan="3">
…
/a:tc>
<a:tc vMerge="1">
…
/a:tc>
<a:tc vMerge="1">
…
/a:tc>

      

In this example, we can define what looks like a single cell in the table as a group of three cells merged together. The merged cell spans three rows of the table. end example]

The possible values for this attribute are defined by the W3C XML Schema int datatype.

vMerge (Vertical Merge)

When this attribute is set to 1 or true , then this table cell is to be merged with the previous vertical table cell when the table is created.

[Example: Consider the following example:

        
<a:tc vMerge="1">
…
/a:tc>

      

In this example, we see the vMerge attribute set to on which signifies that this cell is to be merged with the previous vertical cell in the table. end example]

The possible values for this attribute are defined by the W3C XML Schema boolean datatype.

[Note: The W3C XML Schema definition of this element’s content model (CT_TableCell) is located in §A.4.1. end note]

© ISO/IEC29500: 2008.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

TableCell Members

DocumentFormat.OpenXml.Drawing Namespace