Columns Class

Column Definitions.When the object is serialized out as xml, its qualified name is w:cols.

Inheritance Hierarchy

System.Object
  DocumentFormat.OpenXml.OpenXmlElement
    DocumentFormat.OpenXml.OpenXmlCompositeElement
      DocumentFormat.OpenXml.Wordprocessing.Columns

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

Syntax

'Declaration
<ChildElementInfoAttribute(GetType(Column))> _
Public Class Columns _
    Inherits OpenXmlCompositeElement
'Usage
Dim instance As Columns
[ChildElementInfoAttribute(typeof(Column))]
public class Columns : OpenXmlCompositeElement

Remarks

The following table lists the possible child types:

  • Column <w:col>

[ISO/IEC 29500-1 1st Edition]

17.6.4 cols (Column Definitions)

This element specifies the set of columns defined for this section in the document.

[Example: Consider a document in which a section defines two columns of 4.16" and 1.83", respectively, resulting in the following WordprocessingML:

<w:cols w:equalWidth="0">
<w:col w:w="2640" w:space="720"/>
<w:col w:w="6000"/>
</w:cols>

The cols element defines the set of columns defined for this section, which because equalWidth is 0, are defined by the number of col elements contained in the column definition. In this case, the first column is 2,640 twentieths of a point wide (as 2640/1440ths of an inch equals 1.83 inches) with one-half of an inch space after, and the second column is 6,000 twentieths of a point wide (4.16 inches). end example]

Based on the presence of the equalWidth attribute, a consumer shall render the columns using:

  • If equalWidth is true, then the columns are defined using the data stored as attributes of the cols element (defined below).

  • If equalWidth is false, then the columns are defined using the presence and data on each child col element (§17.6.3).

Parent Elements

sectPr (§17.6.17); sectPr (§17.6.18); sectPr (§17.6.19)

Child Elements

Subclause

col (Single Column Definition)

§17.6.3

Attributes

Description

equalWidth (Equal Column Widths)

Specifies whether all text columns in the current section are of equal width.

If this attribute is present and its value is set to true or 1, then all columns for this text section are of an equal width and are calculated as follows:

  • Take width of page (from margin to margin)

  • Divide by number of columns specified in num attribute

  • For each column, leave space after as defined in the space attribute

  • Remaining width of each column is the text column width.

If this attribute is present and its value is set to false or 0, then all columns for this text section are of different widths and are defined by each col element as follows:

  • Each col element defines a single column

  • Each w attribute defines the text column width

  • Each space attribute defines the space after the text column

[Example: Consider a section with column information defined as follows:

<w:cols w:num="3" w:space="1440"
w:equalWidth="1">
<w:col w:w="2880" w:space="2880" />
<w:col w:w="2880" w:space="1440" />
<w:col w:w="2880" />
</w:cols>

This set of columns has a equalWidth value set to 1, therefore the col elements are ignored, and there are three equally sized columns (num value of 3), each with one inch (space value of 1440 twentieths of a point) of space after. end example]

The possible values for this attribute are defined by the ST_OnOff simple type (§22.9.2.7).

num (Number of Equal Width Columns)

Specifies the number of text columns in the current section.

If all columns are not of equal width (the equalWidth attribute is not set), then this element is ignored, and the number of columns is defined by the number of col elements defined under the cols element.

[Example: Consider a section with column information defined as follows:

<w:cols w:num="3" w:space="1440"
w:equalWidth="1">
…
</w:cols>

This set of columns has a equalWidth value set to 1, therefore there are three equally sized columns, as the num attribute has a value of 3. end example]

The possible values for this attribute are defined by the ST_DecimalNumber simple type (§17.18.10).

sep (Draw Line Between Columns)

Specifies if a vertical line is drawn between each of the text columns in this section.

If set to true or 1, then a vertical line shall be drawn in the center of the spacing between each column in this section.

[Example: Consider a section with column information defined as follows:

<w:cols w:sep="1">
…
</w:cols>

This set of columns has a sep value set to 1, therefore there must be a vertical line separating each column in this section. end example]

The possible values for this attribute are defined by the ST_OnOff simple type (§22.9.2.7).

space (Spacing Between Equal Width Columns)

Specifies the spacing between text columns in the current section.

If all columns are not of equal width (the equalWidth attribute is not set), then this element is ignored, and the spacing after columns is defined by the space attribute on each of the col elements defined under the cols element.

[Example: Consider a section with column information defined as follows:

<w:cols w:num="3" w:space="1440"
w:equalWidth="1">
…
</w:cols>

This set of columns has a equalWidth value set to 1, therefore there are three equally sized columns, each with one inch (space value of 1440 twentieths of a point) of space after. end example]

The possible values for this attribute are defined by the ST_TwipsMeasure simple type (§22.9.2.14).

[Note: The W3C XML Schema definition of this element’s content model (CT_Columns) is located in §A.1. end note]

© 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

Columns Members

DocumentFormat.OpenXml.Wordprocessing Namespace