[Table of Contents] [docx version]
WordprocessingML Reference Material - Table of Contents
shd (Table Cell Shading)
This element specifies the shading which shall be applied to the extents of the current table cell. Similarly to paragraph shading, this shading shall be applied to the contents of the cell up to the cell borders, regardless of the presence of text.
This shading consists of three components:
• Background Color
• (optional) Pattern
• (optional) Pattern Color
The resulting shading is applied by setting the background color behind the paragraph, then applying the pattern color using the mask supplied by the pattern over that background.
If this element is omitted, then the cell shading shall be determined by the table-level or table-level exception cell shading settings (§2.4.34;§2.4.35) for the current table.
[Example: Consider a table in which the first cell in the first row has cell-level red shading, as follows:
R1C1 |
R1C2 |
R2C1 |
R2C2 |
This cell shading would be specified using the following WordprocessingML:
<w:tc>
<w:tcPr>
<w:shd w:val="clear" w:color="auto" w:fill="FF0000" />
</w:tcPr>
</w:tc>
The shd element specifies cell shading with a clear pattern using a background color of FF0000 (red). end example]
Parent Elements |
tcPr (§2.7.5.8); tcPr (§2.4.66); tcPr (§2.7.5.9); tcPr (§2.4.67) |
Attributes |
Description |
color (Shading Pattern Color) |
Specifies the color used for any foreground pattern specified for this shading using the val attribute.
This color may either be presented as a hex value (in RRGGBB format), or auto to allow a consumer to automatically determine the foreground shading color as appropriate.
If the shading style (the val attribute) specifies the use of no shading format or is omitted, then this property has no effect. Also, if the shading specifies the use of a theme color via the themeColor attribute, then this value is superseded by the theme color value.
If this attribute is omitted, then its value shall be assumed to be auto.
[Example: Consider a shading of type pct20 with a foreground color value of auto, as follows:
<w:shd w:val="pct20"... w:color="auto"/>
The foreground color for this shading pattern therefore may be automatically be modified by a consumer as appropriate, for example, in order to ensure that the shading color can be distinguished against the page's background color. end example]
The possible values for this attribute are defined by the ST_HexColor simple type (§2.18.43). |
fill (Shading Background Color) |
Specifies the color used for the background for this shading.
This color may either be presented as a hex value (in RRGGBB format), or auto to allow a consumer to automatically determine the background shading color as appropriate.
If this attribute is omitted, then its value shall be assumed to be auto.
[Example: Consider a shading using a background color of hex value C3D69B, using the following WordprocessingML:
<w:shd w:fill="C3D69B" />
The background color for this shading therefore will be a color with a hex value of C3D69B. end example]
If the shading specifies the use of a theme color via the themeFill attribute, then this value is superseded by the theme color value.
The possible values for this attribute are defined by the ST_HexColor simple type (§2.18.43). |
themeColor (Shading Pattern Theme Color) |
Specifies a theme color which should be applied to any foreground pattern specified for this shading using the val attribute.
The specified theme color is a reference to one of the predefined theme colors, located in the document's themes part, which allows for color information to be set centrally in the document.
If this element is omitted, then no theme color is applied, and the color attribute shall be used to determine the shading pattern color.
[Example: Consider a paragraph which shall have a background consisting of a theme color accent3 with a theme color accent6 overlaid using a 20% fill pattern. This requirement is specified using the following WordprocessingML:
<w:pPr> <w:shd w:val="pct20" w:themeColor="accent6" w:themeFill="accent3" /> </w:pPr>
The resulting paragraph will use the foreground pattern color accent6 in the region specified by the pct20 pattern mask. end example]
The possible values for this attribute are defined by the ST_ThemeColor simple type (§2.18.104). |
themeFill (Shading Background Theme Color) |
Specifies a theme color which should be applied to the background for this shading.
The specified theme color is a reference to one of the predefined theme colors, located in the document's themes part, which allows for color information to be set centrally in the document.
If this element is omitted, then no theme color is applied, and the color attribute shall be used to determine the shading background color.
[Example: Consider a paragraph which shall have a background consisting of a theme color accent3 with a theme color accent6 overlaid using a 20% fill pattern. This requirement is specified using the following WordprocessingML:
<w:shd w:val="pct20" w:themeColor="accent6" w:themeFill="accent3" />
The resulting shading will use the background color specified by the accent3 theme color. end example]
The possible values for this attribute are defined by the ST_ThemeColor simple type (§2.18.104). |
themeFillShade (Shading Background Theme Color Shade) |
Specifies the shade value applied to the supplied theme color (if any) for this shading color.
If the themeFillShade is supplied, then it is applied to the RGB value of the themeFill color (from the theme part) to determine the final color applied to this border.
The themeFillShade value is stored as a hex encoding of the shade value (from 0 to 255) applied to the current border.
[Example: Consider a shade of 40% applied to a background shading color in a document. This shade is calculated as follows:
The resulting themeFillShade value in the file format would be 66. end example]
Given an RGB color defined as three hex values in RRGGBB format, the shade is applied as follows: • Convert the color to the HSL color format (values from 0 to 1) • Modify the luminance factor as follows:
• Convert the resultant HSL color to RGB
[Example: Consider a document with a background using the accent2 theme color, whose RGB value (in RRGGBB hex format) is C0504D.
The equivalent HSL color value would be.
Applying the shade formula with a shade percentage of 75% to the luminance, we get:
Taking the resulting HSL color value of and converting back to RGB, we get 943634.
This transformed value can be seen in the resulting shading's fill attribute:
<w:shd w:fill="943634" w:themeFill="accent2"
end example]
The possible values for this attribute are defined by the ST_UcharHexNumber simple type (§2.18.106). |
themeFillTint (Shading Background Theme Color Tint) |
Specifies the tint value applied to the supplied theme color (if any) for this shading instance.
If the themeFillTint is supplied, then it is applied to the RGB value of the themeFill color (from the theme part) to determine the final color applied to this border.
The themeFillTint value is stored as a hex encoding of the tint value (from 0 to 255) applied to the current border.
[Example: Consider a tint of 60% applied to a border in a document. This tint is calculated as follows:
The resulting themeFillTint value in the file format would be 99. end example]
Given an RGB color defined as three hex values in RRGGBB format, the shade is applied as follows: • Convert the color to the HSL color format (values from 0 to 1) • Modify the luminance factor as follows:
• Convert the resultant HSL color to RGB
[Example: Consider a document with a background using the accent2 theme color, whose RGB value (in RRGGBB hex format) is 4F81BD.
The equivalent HSL color value would be.
Applying the tint formula with a tint percentage of 60% to the luminance, we get:
Taking the resulting HSL color value of and converting back to RGB, we get 95B3D7.
This transformed value can be seen in the resulting shading's fill attribute:
<w:top w:val="single" w:sz="4" w:space="24"
end example]
The possible values for this attribute are defined by the ST_UcharHexNumber simple type (§2.18.106). |
themeShade (Shading Pattern Theme Color Shade) |
Specifies the shade value applied to the supplied theme color (if any) for this shading color.
If the themeShade is supplied, then it is applied to the RGB value of the themeColor color (from the theme part) to determine the final color applied to this border.
The themeShade value is stored as a hex encoding of the shade value (from 0 to 255) applied to the current border.
[Example: Consider a shade of 40% applied to a background shading color in a document. This shade is calculated as follows:
Te resulting themeShade value in the file format would be 66. end example]
Given an RGB color defined as three hex values in RRGGBB format, the shade is applied as follows: • Convert the color to the HSL color format (values from 0 to 1) • Modify the luminance factor as follows:
• Convert the resultant HSL color to RGB
[Example: Consider a document with a background using the accent2 theme color, whose RGB value (in RRGGBB hex format) is C0504D.
The equivalent HSL color value would be.
Applying the shade formula with a shade percentage of 75% to the luminance, we get:
Taking the resulting HSL color value of and converting back to RGB, we get 943634.
This transformed value can be seen in the resulting background's color attribute:
<w:shd w:color="943634" w:themeColor="accent2"
end example]
The possible values for this attribute are defined by the ST_UcharHexNumber simple type (§2.18.106). |
themeTint (Shading Pattern Theme Color Tint) |
Specifies the tint value applied to the supplied theme color (if any) for this shading instance.
If the themeTint is supplied, then it is applied to the RGB value of the themeColor color (from the theme part) to determine the final color applied to this border.
The themeTint value is stored as a hex encoding of the tint value (from 0 to 255) applied to the current border.
[Example: Consider a tint of 60% applied to a border in a document. This tint is calculated as follows:
The resulting themeTint value in the file format would be 99. end example]
Given an RGB color defined as three hex values in RRGGBB format, the shade is applied as follows: • Convert the color to the HSL color format (values from 0 to 1) • Modify the luminance factor as follows:
• Convert the resultant HSL color to RGB
[Example: Consider a document with a background using the accent2 theme color, whose RGB value (in RRGGBB hex format) is 4F81BD.
The equivalent HSL color value would be.
Applying the tint formula with a tint percentage of 60% to the luminance, we get:
Taking the resulting HSL color value of and converting back to RGB, we get 95B3D7.
This transformed value can be seen in the resulting shading's color attribute:
<w:shd w:color="95B3D7" w:themeColor="accent2"
end example]
The possible values for this attribute are defined by the ST_UcharHexNumber simple type (§2.18.106). |
val (Shading Pattern) |
Specifies the pattern which shall be used to lay the pattern color over the background color for this paragraph shading.
This pattern consists of a mask which is applied over the background shading color to get the locations where the pattern color should be shown. Each of these possible masks are shown in the simple type values referenced below.
[Example: Consider a shaded paragraph which uses a 10 percent foreground fill, resulting in the following WordprocessingML:
<w:shd w:val="pct10" .../>
This shading val is pct10, indicating that the border style is a 10 percent foreground fill mask. end example]
The possible values for this attribute are defined by the ST_Shd simple type (§2.18.85). |
The following XML Schema fragment defines the contents of this element:
<complexType name="CT_Shd">
<attribute name="val" type="ST_Shd" use="required"/>
<attribute name="color" type="ST_HexColor" use="optional"/>
<attribute name="themeColor" type="ST_ThemeColor" use="optional"/>
<attribute name="themeTint" type="ST_UcharHexNumber" use="optional"/>
<attribute name="themeShade" type="ST_UcharHexNumber" use="optional"/>
<attribute name="fill" type="ST_HexColor" use="optional"/>
<attribute name="themeFill" type="ST_ThemeColor" use="optional"/>
<attribute name="themeFillTint" type="ST_UcharHexNumber" use="optional"/>
<attribute name="themeFillShade" type="ST_UcharHexNumber" use="optional"/>
</complexType>