Skip to main content

Wordprocessing Tables

Related Open Office/ODF Discussion

Properties

Table-wide properties are specified in <tblPr>. Each property is a child element of <tblPr>, and they affect all rows and cells in the table, though they can be overridden by table-level exception, row-level, and cell-level properties.

<w:tblPr>

<w:tblW w:w="0" w:type="auto"/>

<w:jc w:val="end"/>

</w:tblPr>

Reference: ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference § 17.4.60.

The most commonly used properties are shown below:

Elements/Properties:​

ElementDescription
jcSee Table Alignment. Reference: ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference § 17.4.29.
shdSee Table Shading. Reference: ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference § 17.4.32.
tblBordersSee Table Borders. Reference: ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference § 17.4.39.
tblCaptionSee Table Captions. Reference: ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference § 17.4.41.
tblCellMarSee Table Cell Margins. Reference: ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference § 17.4.43.
tblCellSpacingSee Table Cell Spacing. Reference: ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference § 17.4.46.
tblIndSee Table Indent. Reference: ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference § 17.4.51.
tblLayoutSee Table Layout. Reference: ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference § 17.4.53.
tblLookSee Table Conditional Formatting. Reference: ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference § 17.4.56.
tblOverlapSee Floating Tables - Overlapping Tables. Reference: ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference § 17.4.57.
tblpPrSee Floating Tables. Reference: ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference § 17.4.58.
tblStyleSpecifies the style ID of the table style if a table style is to be used to format the table. See Defining a Style - Table Styles. Table styles are applied after document default styles, so they override the defaults, but all other style types are applied after the table styles, so they override the table style. In the sample below, a table style is referenced, but there is also direct formatting applied for the table justification. <w:tblPr> <w:tblStyle w:val="TestTableStyle"/> <w:jc w:val="center"/> </w:tblPr> Reference: ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference § 17.4.63.
tblStyleColBandSizeThis element is applicable to a <tblPr> within a table style. Tables styles can have conditional formatting which enables columns and/or rows to be "banded" by applying different formatting to alternating columns or rows. Typically every other column is formatted the same. So, for example, odd columns may have gray shading and even columns may have green shading. This element can be used to group columns so that alternating groups of columns are formatted the same way rather than every other column. For example, by setting the value of the val attribute to 3, the first three columns will be formatted the same, and the second group of three will be formatted the same, and each group of three thereafter will alternate their formatting. See Table Styles - Conditional Formatting. <w:style w:type="table" w:styleId="myTableStyle"> <w:tblPr> <w:tblStyleColBandSize w:val="3"/> <w:tblStyleRowBandSize w:val="2"/> </w:tblPr> </w:style> Reference: ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference § 17.7.6.5.
tblStyleRowBandSizeThis element is applicable to a <tblPr> within a table style. Tables styles can have conditional formatting which enables columns and/or rows to be "banded" by applying different formatting to alternating columns or rows. Typically every other row is formatted the same. So, for example, odd rows may have gray shading and even rows may have green shading. This element can be used to group rows so that alternating groups of rows are formatted the same way rather than every other row. For example, by setting the value of the val attribute to 3, the first three rows will be formatted the same, and the second group of three will be formatted the same, and each group of three thereafter will alternate their formatting. See Table Styles - Conditional Formatting. <w:style w:type="table" w:styleId="myTableStyle"> <w:tblPr> <w:tblStyleColBandSize w:val="3"/> <w:tblStyleRowBandSize w:val="2"/> </w:tblPr> </w:style> Reference: ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference § 17.7.6.7.
tblWSee Table Width. Reference: ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference § 17.4.64.

Related Open Document Format (ODF) Property:

Table row properties are specified in the <style:table-properties> element.

<style:style style:name="Table1" style:family="table">

<style:table-properties style:width="4.7in" table:align="right" fo:background-color="#e6e6e6" style:shadow="none" fo:keep-with-next="always"/>

</style:style>

Reference: Open Document Format for Office Applications Version 1.2 (May, 2011) § 17.15.

The <style:table-properties> element can have the following attributes:

AttributesDescription
fo:background-colorSpecifies a color for the background of the table.
fo:break-afterSpecifies a break after the table. Possible values are auto, column, and page.
fo:break-beforeSpecifies a break before the table. Possible values are auto, column, and page.
fo:keep-with-nextSpecifies when the row should be kept with the table. Possible values are auto and always.
fo:margin, fo:margin-bottom, fo:margin-left, fo:margin-right, and fo:margin-topSpecify a margins for the table. Possible values are a non-negative number or a percent.
style:may-break-between pagesSpecifies that page break may occur inside the table. Possible values are true and false.
style:page-numberSpecifies the page number that should be used for a new page when the table style specifies a master page. Possible values are auto and a positive number.
style:rel-widthSpecifies the width of the table relative to the width of the area that the table is in. Possible value is a percent.
style:widthSpecifies the fixed width of the table.
style:shadowSpecifies a shadow effect for the table.
style:writing-modeSpecifies how the content should be written. Possible values are lr-tb, rl-tb, tb-rl, tb-lr, lr, rl, tb, and page.
table:alignSpecifies the horizontal alignment. Possible values are center, left, margins, and right.
table:border-modelSpecifies the border model. Possible values are collapsing (when adjacent cells have different borders, the wider border appears) and separating (borders appear within the cell)
table:displaySpecifies whether the table should be displayed. Possible values are true and false.

Note that <style:table-properties> can also contain a <style:background-image> element.