<col>
Summary
The <col>
element defines a column in a table.
It is an optional element akin to the HTML's <col>
or docbook <colspec>
elements.
It can be used to specify some properties such as width, horizontal alignment or role to a column, or a range of columns, so that all cells belonging to that column inherit these properties.
A column can also be defined as a header
column, meaning that all the cells in the column are considered to be header cells.
Usage context
Element category | table |
---|---|
PSML level | portable |
Permitted content | none |
Permitted parent | <table> |
HTML equivalent | <col> or <colspan> |
OpenXML equivalent | <w:gridCol> in <w:tblGrid> |
Attributes
This element includes the following attributes:
Name | Type | Required | Description |
---|---|---|---|
align | alignment | no | Horizontal alignment of cell within that column |
part | table-part | no | The part of the table the column belongs to |
role | role | no | Custom value that can be used for formatting |
span | xs:positiveInteger | no | The number of columns this definition extends to. Deprecated. |
width | length | no | Width of column in pixels or percent |
@align
The horizontal alignment of text within cells belonging to that column.
@part
The part of the table the column belongs to.
For example, if a <col>
element includes a @part
attribute set toheader
, all cells in that column are considered to be header cells.
@role
A role for the table which can be used for formatting.
@span
The number of columns this definition extends to.
Using @span
is deprecated as it can cause errors when editing tables via the user interface. Instead, define all columns separately to apply the same formatting.
@width
The width of column in pixels or percent (pixels if no px or % suffix).
Examples
See table examples.
Schema
XML Schema
<xs:element name="col"> <xs:complexType> <xs:attribute name="width"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:pattern value="[0-9\.]+(px|%)?"/> </xs:restriction> </xs:simpleType> </xs:attribute> <xs:attribute name="span" type="xs:positiveInteger"/> <xs:attribute name="align"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="left" /> <xs:enumeration value="center" /> <xs:enumeration value="right" /> <xs:enumeration value="justify" /> </xs:restriction> </xs:simpleType> </xs:attribute> <xs:attribute name="role" type="role"/> </xs:complexType> </xs:element>
Relax Schema
element col { attribute width { text { pattern: "[0-9\.]+(px|%)?" } }?, attribute span { xs:positiveInteger }?, attribute align { "center" | "justify" | "left" | "right" }?, attribute role { role }?, empty }
Compatibility
This element was introduced in PSML Beta 7 and is only supported from PageSeeder 5.6.