Share via


TableCellWidth Class

Defines the TableCellWidth Class.When the object is serialized out as xml, its qualified name is w:tcW.

Inheritance Hierarchy

System.Object
  DocumentFormat.OpenXml.OpenXmlElement
    DocumentFormat.OpenXml.OpenXmlLeafElement
      DocumentFormat.OpenXml.Wordprocessing.TableWidthType
        DocumentFormat.OpenXml.Wordprocessing.TableCellWidth

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

Syntax

'Declaration
Public Class TableCellWidth _
    Inherits TableWidthType
'Usage
Dim instance As TableCellWidth
public class TableCellWidth : TableWidthType

Remarks

[ISO/IEC 29500-1 1st Edition]

17.4.72 tcW (Preferred Table Cell Width)

This element specifies the preferred width for this table cell. This preferred width is used as part of the table layout algorithm specified by the tblLayout element (§17.4.53; §17.4.54) - full description of the algorithm in the ST_TblLayout simple type (§17.18.87).

All widths in a table are considered preferred because:

  • The table shall satisfy the shared columns as specified by the tblGrid element (§17.4.49)

  • Two or more widths can have conflicting values for the width of the same grid column

  • The table layout algorithm (§17.18.87) can require a preference to be overridden

This value is specified in the units applied via its type attribute. Any width value of type pct for this element shall be calculated relative to the overall width of the table.

If this element is omitted, then the cell width shall be of type auto.

[Example: Consider a WordprocessingML table defined as follows:

<w:tbl>
<w:tr>
<w:tc>
<w:tcPr>
<w:tcW w:type="pct" w:w="33.3%"/>
</w:tcPr>
…
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:type="pct" w:w="33.3%"/>
</w:tcPr>
…
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:type="pct" w:w="33.3%"/>
</w:tcPr>
…
</w:tc>
</w:tr>
</w:tbl>

This table specifies that it has no preferred table width, but each cell must be exactly 33.3 percent of the overall table width. The resulting table would therefore be sized such that all columns are of the width of the maximum column, as follows:

Hello world

The text Hello world makes the middle cell larger, and the other two cells are increased in size to maintain the preferred widths of one-third of the overall table width. However, when the middle table cell requires a larger size to accommodate non-breaking text, that preference can be overridden as needed:

Hello worlddddddddddddddddddddddddddddddddddd

In this case, the middle cell's long non breaking string caused the table to reach the text margins on the page, and therefore to override the preferred widths on the empty cells. end example]  

Parent Elements

tcPr (§17.7.6.8); tcPr (§17.7.6.9); tcPr (§17.4.70); tcPr (§17.4.71)

This element’s content model is defined by the common table measurement definition in §17.4.88.

© 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

TableCellWidth Members

DocumentFormat.OpenXml.Wordprocessing Namespace