TableCellBorders Class

Defines the TableCellBorders Class.When the object is serialized out as xml, its qualified name is w:tcBorders.

Inheritance Hierarchy

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

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

Syntax

'Declaration
<ChildElementInfoAttribute(GetType(TopLeftToBottomRightCellBorder))> _
<ChildElementInfoAttribute(GetType(RightBorder))> _
<ChildElementInfoAttribute(GetType(TopRightToBottomLeftCellBorder))> _
<ChildElementInfoAttribute(GetType(TopBorder))> _
<ChildElementInfoAttribute(GetType(LeftBorder))> _
<ChildElementInfoAttribute(GetType(StartBorder), FileFormatVersions.Office2010)> _
<ChildElementInfoAttribute(GetType(BottomBorder))> _
<ChildElementInfoAttribute(GetType(EndBorder), FileFormatVersions.Office2010)> _
<ChildElementInfoAttribute(GetType(InsideHorizontalBorder))> _
<ChildElementInfoAttribute(GetType(InsideVerticalBorder))> _
Public Class TableCellBorders _
    Inherits OpenXmlCompositeElement
'Usage
Dim instance As TableCellBorders
[ChildElementInfoAttribute(typeof(TopLeftToBottomRightCellBorder))]
[ChildElementInfoAttribute(typeof(RightBorder))]
[ChildElementInfoAttribute(typeof(TopRightToBottomLeftCellBorder))]
[ChildElementInfoAttribute(typeof(TopBorder))]
[ChildElementInfoAttribute(typeof(LeftBorder))]
[ChildElementInfoAttribute(typeof(StartBorder), FileFormatVersions.Office2010)]
[ChildElementInfoAttribute(typeof(BottomBorder))]
[ChildElementInfoAttribute(typeof(EndBorder), FileFormatVersions.Office2010)]
[ChildElementInfoAttribute(typeof(InsideHorizontalBorder))]
[ChildElementInfoAttribute(typeof(InsideVerticalBorder))]
public class TableCellBorders : OpenXmlCompositeElement

Remarks

The following table lists the possible child types:

  • TopBorder <w:top>

  • LeftBorder <w:left>

  • StartBorder <w:start>

  • BottomBorder <w:bottom>

  • RightBorder <w:right>

  • EndBorder <w:end>

  • InsideHorizontalBorder <w:insideH>

  • InsideVerticalBorder <w:insideV>

  • TopLeftToBottomRightCellBorder <w:tl2br>

  • TopRightToBottomLeftCellBorder <w:tr2bl>

[ISO/IEC 29500-1 1st Edition]

17.4.67 tcBorders (Table Cell Borders)

This element specifies the set of borders for the edges of the current table cell, using the eight border types defined by its child elements.

If the cell spacing for any row is non-zero as specified using the tblCellSpacing element (§17.4.45; §17.4.44; §17.4.46), then there is never a border conflict (as the non-zero cell spacing is applied above and beyond each individual cell border's width) and all table, table-level exception, and table cell borders shall be displayed.

If the cell spacing is zero, then there can be a conflict between two adjacent cell borders [Example: Between the left border of all cells in the second column and the right border of all cells in the first column of the table. end example], which shall be resolved as follows:

If either conflicting table cell border is nil or none (no border), then the opposing border shall be displayed.

If a cell border conflicts with a table border, the cell border always wins.

Each border shall then be assigned a weight using the following formula, and the border value using this calculation shall be displayed over the alternative border:

The border number shall be determined by this list:

single

1

thick

2

double

3

dotted

4

dashed

5

dotDash

6

dotDotDash

7

triple

8

thinThickSmallGap

9

thickThinSmallGap

10

thinThickThinSmallGap

11

thinThickMediumGap

12

thickThinMediumGap

13

thinThickThinMediumGap

14

thinThickLargeGap

15

thickThinLargeGap

16

thinThickThinLargeGap

17

wave

18

doubleWave

19

dashSmallGap

20

dashDotStroked

21

threeDEmboss

22

threeDEngrave

23

outset

24

inset

25

If the borders have an equal weight, than the higher of the two on this precedence list shall win:

single

thick

double

dotted

dashed

dotDash

dotDotDash

triple

thinThickSmallGap

thickThinSmallGap

thinThickThinSmallGap

thinThickMediumGap

thickThinMediumGap

thinThickThinMediumGap

thinThickLargeGap

thickThinLargeGap

thinThickThinLargeGap

wave

doubleWave

dashSmallGap

dashDotStroked

threeDEmboss

threeDEngrave

outset

inset

If the borders have an identical style, than each border color shall be assigned a brightness value as follows:The color with the smaller brightness value shall win.

If the borders have an identical brightness value above, than each border color shall be assigned a new brightness value as follows:The color with the smaller brightness value shall win.

If the borders have an identical brightness value above, than each border color shall be assigned a brightness value as follows:The color with the smaller brightness value shall win.

If the borders have an identical brightness value above, then they are functionally identical, and the first border in reading order should be displayed.

[Example: Consider the following two cell table (with exaggerated table cell spacing for clarity):

If we collapse the cell spacing, there are conflicting borders at all edges. For each cell/table border conflict, rule #2 says that the cell border must win. For the conflict in the center between two cell borders, rule #3 gives us a larger border weight for the right cell's border, resulting in the following table:

end example]

If this element is omitted, then this table shall have the borders specified by the associated table style. If no borders are specified in the style hierarchy, then this table shall not have any table borders.

[Example: Consider a table whose first cell specifies cell-level borders consisting of a think double red line, as follows:

These cell borders are specified using the following WordprocessingML:

<w:tcPr>
<w:tcBorders>
<w:top w:val="double" w:sz="24" w:space="0" w:color="FF0000"/>
<w:left w:val="double" w:sz="24" w:space="0" w:color="FF0000"/>
<w:bottom w:val="double" w:sz="24" w:space="0" w:color="FF0000"/>
<w:right w:val="double" w:sz="24" w:space="0" w:color="FF0000"/>
</w:tcBorders>
</w:tcPr>

The tcBorders element specifies the set of borders applied to the first cell as a 3 point double border. end example]

Parent Elements

tcPr (§17.7.6.8); tcPr (§17.7.6.9); tcPr (§17.4.70); tcPr (§17.4.71)

Child Elements

Subclause

bottom (Table Cell Bottom Border)

§17.4.3

end (Table Cell Trailing Edge Border)

§17.4.12

insideH (Table Cell Inside Horizontal Edges Border)

§17.4.24

insideV (Table Cell Inside Vertical Edges Border)

§17.4.26

start (Table Cell Leading Edge Border)

§17.4.34

tl2br (Table Cell Top Left to Bottom Right Diagonal Border)

§17.4.74

top (Table Cell Top Border)

§17.4.75

tr2bl (Table Cell Top Right to Bottom Left Diagonal Border)

§17.4.80

[Note: The W3C XML Schema definition of this element’s content model (CT_TcBorders) 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

TableCellBorders Members

DocumentFormat.OpenXml.Wordprocessing Namespace