table
table
¶
Enumerations related to tables in WordprocessingML files.
WD_CELL_VERTICAL_ALIGNMENT
¶
Bases: BaseXmlEnum
Alias: WD_ALIGN_VERTICAL
Specifies the vertical alignment of text in one or more cells of a table.
Example:
from docx.enum.table import WD_ALIGN_VERTICAL
table = document.add_table(3, 3)
table.cell(0, 0).vertical_alignment = WD_ALIGN_VERTICAL.BOTTOM
MS API name: WdCellVerticalAlignment
https://msdn.microsoft.com/en-us/library/office/ff193345.aspx
TOP
class-attribute
instance-attribute
¶
Text is aligned to the top border of the cell.
CENTER
class-attribute
instance-attribute
¶
Text is aligned to the center of the cell.
BOTTOM
class-attribute
instance-attribute
¶
Text is aligned to the bottom border of the cell.
BOTH
class-attribute
instance-attribute
¶
BOTH = (
101,
"both",
"This is an option in the OpenXml spec, but not in Word itself. It's not clear what Word behavior this setting produces. If you find out please let us know and we'll update this documentation. Otherwise, probably best to avoid this option.",
)
This is an option in the OpenXml spec, but not in Word itself.
It's not clear what Word behavior this setting produces. If you find out please let us know and we'll update this documentation. Otherwise, probably best to avoid this option.
WD_ROW_HEIGHT_RULE
¶
Bases: BaseXmlEnum
Alias: WD_ROW_HEIGHT
Specifies the rule for determining the height of a table row
Example:
from docx.enum.table import WD_ROW_HEIGHT_RULE
table = document.add_table(3, 3)
table.rows[0].height_rule = WD_ROW_HEIGHT_RULE.EXACTLY
MS API name: WdRowHeightRule
https://msdn.microsoft.com/en-us/library/office/ff193620.aspx
WD_LINE_STYLE
¶
Bases: BaseXmlEnum
Specifies the line style of a table or cell border.
Example:
from docx.enum.table import WD_LINE_STYLE
from docx.shared import Pt
table = document.add_table(3, 3)
table.borders["top"].line = WD_LINE_STYLE.SINGLE
table.borders["top"].size = Pt(1)
Only the structural line styles are members here. The ST_Border schema type also
admits some 170 decorative "page border art" values such as "apples" and
"zigZagStitch"; those are meaningful only on a page border, and Word does not
offer or write them for a table or cell border.
MS API name: WdLineStyle
https://learn.microsoft.com/en-us/office/vba/api/word.wdlinestyle
SINGLE
class-attribute
instance-attribute
¶
A single solid line.
DASH_SMALL_GAP
class-attribute
instance-attribute
¶
A dashed line with small gaps.
DASH_LARGE_GAP
class-attribute
instance-attribute
¶
A dashed line with large gaps.
DASH_DOT
class-attribute
instance-attribute
¶
A line of alternating dashes and dots.
DASH_DOT_DOT
class-attribute
instance-attribute
¶
A line of dashes each followed by two dots.
DOUBLE
class-attribute
instance-attribute
¶
Two parallel solid lines.
TRIPLE
class-attribute
instance-attribute
¶
Three parallel solid lines.
THIN_THICK_SMALL_GAP
class-attribute
instance-attribute
¶
THIN_THICK_SMALL_GAP = (
9,
"thinThickSmallGap",
"A thin line and a thick line separated by a small gap.",
)
A thin line and a thick line separated by a small gap.
THICK_THIN_SMALL_GAP
class-attribute
instance-attribute
¶
THICK_THIN_SMALL_GAP = (
10,
"thickThinSmallGap",
"A thick line and a thin line separated by a small gap.",
)
A thick line and a thin line separated by a small gap.
THIN_THICK_THIN_SMALL_GAP
class-attribute
instance-attribute
¶
THIN_THICK_THIN_SMALL_GAP = (
11,
"thinThickThinSmallGap",
"A thin, a thick and a thin line separated by small gaps.",
)
A thin, a thick and a thin line separated by small gaps.
THIN_THICK_MED_GAP
class-attribute
instance-attribute
¶
THIN_THICK_MED_GAP = (
12,
"thinThickMediumGap",
"A thin line and a thick line separated by a medium gap.",
)
A thin line and a thick line separated by a medium gap.
THICK_THIN_MED_GAP
class-attribute
instance-attribute
¶
THICK_THIN_MED_GAP = (
13,
"thickThinMediumGap",
"A thick line and a thin line separated by a medium gap.",
)
A thick line and a thin line separated by a medium gap.
THIN_THICK_THIN_MED_GAP
class-attribute
instance-attribute
¶
THIN_THICK_THIN_MED_GAP = (
14,
"thinThickThinMediumGap",
"A thin, a thick and a thin line separated by medium gaps.",
)
A thin, a thick and a thin line separated by medium gaps.
THIN_THICK_LARGE_GAP
class-attribute
instance-attribute
¶
THIN_THICK_LARGE_GAP = (
15,
"thinThickLargeGap",
"A thin line and a thick line separated by a large gap.",
)
A thin line and a thick line separated by a large gap.
THICK_THIN_LARGE_GAP
class-attribute
instance-attribute
¶
THICK_THIN_LARGE_GAP = (
16,
"thickThinLargeGap",
"A thick line and a thin line separated by a large gap.",
)
A thick line and a thin line separated by a large gap.
THIN_THICK_THIN_LARGE_GAP
class-attribute
instance-attribute
¶
THIN_THICK_THIN_LARGE_GAP = (
17,
"thinThickThinLargeGap",
"A thin, a thick and a thin line separated by large gaps.",
)
A thin, a thick and a thin line separated by large gaps.
SINGLE_WAVY
class-attribute
instance-attribute
¶
A single wavy line.
DOUBLE_WAVY
class-attribute
instance-attribute
¶
Two parallel wavy lines.
DASH_DOT_STROKED
class-attribute
instance-attribute
¶
A line of slanting dashes and dots.
EMBOSS_3D
class-attribute
instance-attribute
¶
A line that appears embossed.
ENGRAVE_3D
class-attribute
instance-attribute
¶
A line that appears engraved.
OUTSET
class-attribute
instance-attribute
¶
A line that makes the enclosed area appear raised.
INSET
class-attribute
instance-attribute
¶
A line that makes the enclosed area appear sunken.
THICK
class-attribute
instance-attribute
¶
THICK = (
100,
"thick",
"A single thick solid line. This is an OpenXml value with no `WdLineStyle` counterpart; Word renders it as a heavier `SINGLE`.",
)
A single thick solid line.
This is an OpenXml value with no WdLineStyle counterpart; Word renders it as a
heavier SINGLE.
NIL
class-attribute
instance-attribute
¶
NIL = (
101,
"nil",
"No border, and no space reserved for one. Distinct from `NONE` only in that `NONE` is the value Word writes when a border is explicitly turned off, whereas `nil` also appears as the default in a table style.",
)
No border, and no space reserved for one.
Distinct from NONE only in that NONE is the value Word writes when a border is
explicitly turned off, whereas nil also appears as the default in a table style.
WD_TABLE_ALIGNMENT
¶
Bases: BaseXmlEnum
Specifies table justification type.
Example:
from docx.enum.table import WD_TABLE_ALIGNMENT
table = document.add_table(3, 3)
table.alignment = WD_TABLE_ALIGNMENT.CENTER
MS API name: WdRowAlignment
http://office.microsoft.com/en-us/word-help/HV080607259.aspx
WD_TABLE_DIRECTION
¶
Bases: BaseEnum
Specifies the direction in which an application orders cells in the specified table or row.
Example:
from docx.enum.table import WD_TABLE_DIRECTION
table = document.add_table(3, 3)
table.direction = WD_TABLE_DIRECTION.RTL
MS API name: WdTableDirection
http://msdn.microsoft.com/en-us/library/ff835141.aspx