Introduction
Tables in WordprocessingML are defined via the <tbl >
element, which is analogous to the HTML <table>
tag. The table element specifies the location of a table present in the document.
A <tbl >
element has two elements that define its properties: <tblPr>
, which defines the set of table-wide properties (such as style and width), and <tblGrid>
, which defines the grid layout of the table. A <tbl >
element can also contain an arbitrary non-zero number of rows, where each row is specified with a <tr>
element. Each <tr>
element can contain an arbitrary non-zero number of cells, where each cell is specified with a <tc>
element.
Consider an empty one-cell table (i.e.,; a table with one row, one column) and 1 point borders on all sides:
This table is represented by the following WordprocessingML:
<w:tbl> <w:tblPr> <w:tblW w:w="5000" w:type="pct"/> <w:tblBorders> <w:top w:val="single" w:sz="4" w:space="0" w:color="auto"/> <w:left w:val="single" w:sz="4 w:space="0" w:color="auto"/> <w:bottom w:val="single" w:sz="4" w:space="0" w:color="auto"/> <w:right w:val="single" w:sz="4" w:space="0" w:color="auto"/> </w:tblBorders> </w:tblPr> <w:tblGrid> <w:gridCol w:w="10296"/> </w:tblGrid> <w:tr> <w:tc> <w:tcPr> <w:tcW w:w="0" w:type="auto"/> </w:tcPr> <w:p/> </w:tc> </w:tr> </w:tbl>
This table specifies table-wide properties of 100% of page width (<tblW>
's @type
attribute specifies how the width value in the @w
attribute shall be interpreted—pct
specifies a measurement of fiftieths of a percent) and the set of table borders (<tblBorders>
), the table grid which defines a set of shared vertical edges within the table (discussed later), and a single row.