Page tree
Skip to end of metadata
Go to start of metadata

Description

Represents a table cell in a table in the Word document.

C#
vb.net

Remarks

New table cells are created when you create a new Table. They cannot be created independent of a Table using the new keyword.

To retrieve and manipulate a table cell, use array index notation on a Table object. You can also use Element.GetElements(Element.Type.TableCell) to get all elements, of which you can check which ones are of type TableCell.

The following sample demonstrates getting a reference to a table cell at column 3 (4th column), row 2 (3rd row).

Examples

C#
vb.net

Properties

Name

Description

CellWidthUnits

Sets or returns a TableCell.WidthUnits object that represents the cell width units for this cell.

FirstMerged

Returns or sets a boolean that represents if this is the first cell in a group of horizontally merged cells. The first cell will contain all the content.

FirstVerticalMerged

Sets or returns whether the current cell is the first cell in a group of vertically merged cells. The first cell will contain all the content.

Merged

Sets or returns whether this cell has been merged with a preceding horizontal cell.

NoWrap

Returns or sets a boolean that represents if Word will prevent text from wrapping in this table cell.

PreferredWidth

Returns or sets an int that represents the preferred width of this cell. In order to set this property, the CellWidthUnits property must first be set. The width is returned in twips. One twip = (1/20 pt) or (1/1440 in).

Shading

Returns an Shading object which on which you can manipulate the shading (fill color and/or pattern) properties for this cell.

VertAlignment

Returns or sets a TableCell.VerticalAlignment object that represents the vertical alignment of the text in this cell.

VerticalMerged

Returns or sets a boolean that represents if this cell is merged with one or more cells vertically. The first cell will contain all the content.

Methods

Name

Description

ApplyFont(Font)

Applies Font properties to all text in this TableCell. The font properties will not be applied to text inside nested tables.

ApplyParagraphFormatting(ParagraphFormatting)

Applies ParagraphFormatting to all paragraphs in this TableCell. The ParagraphFormatting will not be applied to paragraphs inside nested tables.

GetBorder(Border.Location)

Returns a Border object that lets you manipulate the border this table cell at a particular location.

GetPadding(TableCell.Location)

Returns an int that represents this table cell margin at a particular location in twips. One twip = (1/20 pt) or (1/1440 in)

SetPadding(TableCell.Location, Int32)

Sets an int that represents this table cell margin at a particular location in twips. One twip = (1/20 pt) or (1/1440 in)

Nested Classes

Name

Description

Location

Locations within a table cell for which padding values can be set.

VerticalAlignment

Vertical alignments for a table cell.

WidthUnits

Units used for setting a table cell width.
  • No labels