TableStyle Class

Table Style.When the object is serialized out as xml, its qualified name is a:tableStyle.

Inheritance Hierarchy

System.Object
  DocumentFormat.OpenXml.OpenXmlElement
    DocumentFormat.OpenXml.OpenXmlCompositeElement
      DocumentFormat.OpenXml.Drawing.TableStyleType
        DocumentFormat.OpenXml.Drawing.TableStyle

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

Syntax

'Declaration
Public Class TableStyle _
    Inherits TableStyleType
'Usage
Dim instance As TableStyle
public class TableStyle : TableStyleType

Remarks

The following table lists the possible child types:

  • TableBackground <a:tblBg>

  • WholeTable <a:wholeTbl>

  • Band1Horizontal <a:band1H>

  • Band2Horizontal <a:band2H>

  • Band1Vertical <a:band1V>

  • Band2Vertical <a:band2V>

  • LastColumn <a:lastCol>

  • FirstColumn <a:firstCol>

  • LastRow <a:lastRow>

  • SoutheastCell <a:seCell>

  • SouthwestCell <a:swCell>

  • FirstRow <a:firstRow>

  • NortheastCell <a:neCell>

  • NorthwestCell <a:nwCell>

  • ExtensionList <a:extLst>

[ISO/IEC 29500-1 1st Edition]

21.1.3.11 tableStyle (Table Style)

This element specifies a particular table style. Fourteen elements make up the styling information of a given table style. These fourteen elements work together to provide visual formatting options for on/off states of the following toggles:

  • First row on/off - Associated element: firstRow

  • Last row on/off - Associated element: lastRow

  • First column on/off - Associated element: firstCol

  • Last column on/off - Associated element: lastCol

  • Row banding on/off - Associated elements: band1H, band2H

  • Column banding on/off - Associated elements: band1V, band2V

The formatting associated with the wholeTbl element defines the table formatting when all options are off. When an option is turned on, the formatting for that particular option is applied to the table. The four cell specific formatting options are enabled when overlapping options are toggled on. For example, when the first row, and first column formatting options are enabled, any formatting within the northwest cell is also be applied since that is the overlapping table cell when both first column and first row formatting options are on.

[Example: Consider the following partial example of a tblStyle within DrawingML:

<a:tblStyle styleId="{5940675A-B579-460E-94D1-54222C63F5DA}"
styleName="No Style, Table Grid">
<a:wholeTbl>
<a:tcTxStyle>
<a:fontRef idx="minor">
<a:scrgbClr r="0" g="0" b="0"/>
</a:fontRef>
      <a:schemeClr val="tx1"/>
</a:tcTxStyle>
<a:tcStyle>
<a:tcBdr>
<a:left>
<a:ln w="12700" cmpd="sng">
<a:solidFill>
<a:schemeClr val="tx1"/>
</a:solidFill>
</a:ln>
</a:left>

…right, top, bottom, insideH, insideV border information is defined just as the 'left' tag…

      </a:tcBdr>
<a:fill>
<a:noFill/>
</a:fill>
</a:tcStyle>
</a:wholeTbl>
  <a:band1H>
<a:tcStyle>
<a:tcBdr/>
</a:tcStyle>
</a:band1H>

…band2H, band1V, band2V, firstCol, firstRow, lastCol, lastRow, neCell, nwCell, seCell, swCell tags are all defined just as the 'band1H' tag

</a:tblStyle>

In this example, one can get an idea for the definition of a table style in its entirety. The above defined table style creates a style with only 1pt line formatting applied to all of the cells in a table. Notice that the on/off toggle formatting (band1H, band2H, firstCol, etc) do not define any formatting and therefore have no effect to the table when toggled. end example]

Parent Elements

tblPr (§21.1.3.15)

Child Elements

Subclause

band1H (Band 1 Horizontal)

§20.1.4.2.1

band1V (Band 1 Vertical)

§20.1.4.2.2

band2H (Band 2 Horizontal)

§20.1.4.2.3

band2V (Band 2 Vertical)

§20.1.4.2.4

extLst (Extension List)

§20.1.2.2.15

firstCol (First Column)

§20.1.4.2.11

firstRow (First Row)

§20.1.4.2.12

lastCol (Last Column)

§20.1.4.2.16

lastRow (Last Row)

§20.1.4.2.17

neCell (Northeast Cell)

§20.1.4.2.20

nwCell (Northwest Cell)

§20.1.4.2.21

seCell (Southeast Cell)

§20.1.4.2.23

swCell (Southwest Cell)

§20.1.4.2.24

tblBg (Table Background)

§20.1.4.2.25

wholeTbl (Whole Table)

§20.1.4.2.34

Attributes

Description

styleId (Style ID)

Specifies a GUID identifying the table style in a unique manner.

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

styleName (Name)

Specifies the name of the table style which can show up in the user interface identifying the style to a user.

The possible values for this attribute are defined by the W3C XML Schema string datatype.

[Note: The W3C XML Schema definition of this element’s content model (CT_TableStyle) is located in §A.4.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

TableStyle Members

DocumentFormat.OpenXml.Drawing Namespace