TableWidth Class

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

Inheritance Hierarchy

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

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

Syntax

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

Remarks

[ISO/IEC 29500-1 1st Edition]

17.4.64 tblW (Preferred Table Width)

This element specifies the preferred width for this table. 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 text extents of the page (page width excluding margins).

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:tblPr>
<w:tblW w:type="dxa" w:w="1440"/>
</w:tblPr>
…
</w:tbl>

This table specifies that it has a preferred table width of 1440 twentieths of a point (one inch). The resulting table would therefore be sized such that the table maintains that preferred width, as follows:

Hello world

The text Hello world makes the middle cell larger, and the other two cells are size to maintain the preferred widths of one inch for the overall table width:

Hello world this is a longer string.

However, when the middle table cell requires a larger width to accommodate non-breaking text, that preference can be overridden as needed:

Hello worldddddddddddddddddddddddddddddd

In this case, the middle cell's long non breaking string caused the table to be expanded to prevent breaking the string, and therefore to override the preferred width on the table. end example]

Parent Elements

tblPr (§17.4.60); tblPr (§17.4.59); tblPr (§17.7.6.4); tblPr (§17.7.6.3)

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

[ISO/IEC 29500-1 1st Edition]

17.4.65 tblW (Preferred Table Width Exception)

This element specifies the preferred width for the parent table row via a set of table-level property exceptions. This preferred width is used as part of the table layout algorithm specified by the tblLayout element (§17.4.53n; §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 text extents of the page (page width excluding margins).

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

[Example: Consider a row in a WordprocessingML table defined as follows:

<w:tr>
<w:tblPrEx>
<w:tblW w:type="fixed" w:w="1440"/>
</w:tblPrEx>
<w:trPr>
</w:trPr>
…
</w:tr>

This table-level property exception specifies that it has a preferred table width of 1440 twentieths of a point (one inch). The resulting table row would therefore be sized such that the table maintains that preferred width, as follows:

Hello world

The text Hello world makes the middle cell larger, and the other two cells are size to maintain the preferred widths of one inch for the overall table width:

Hello world this is a longer string.

However, when the middle table cell requires a larger width to accommodate non-breaking text, that preference can be overridden as needed:

Hello worldddddddddddddddddddddddddddddd

In this case, the middle cell's long non breaking string caused the table to be expanded to prevent breaking the string, and therefore to override the preferred width on the table row. end example]

Parent Elements

tblPrEx (§17.4.61); tblPrEx (§17.4.62)

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

TableWidth Members

DocumentFormat.OpenXml.Wordprocessing Namespace