shape
shape
¶
Enumerations related to DrawingML shapes in WordprocessingML files.
WD_INLINE_SHAPE_TYPE
¶
Bases: Enum
Corresponds to WdInlineShapeType enumeration.
http://msdn.microsoft.com/en-us/library/office/ff192587.aspx.
WD_WRAP_TYPE
¶
Bases: BaseXmlEnum
Specifies how text wraps around a floating (anchored) shape.
Example:
from docx.enum.shape import WD_WRAP_TYPE
shape = paragraph.add_float_picture("logo.png")
shape.wrap_type = WD_WRAP_TYPE.SQUARE
MS API name: WdWrapType
https://learn.microsoft.com/en-us/office/vba/api/word.wdwraptype
NONE
class-attribute
instance-attribute
¶
NONE = (
3,
"wrapNone",
"Text does not wrap. The shape floats over the text, or behind it when `behind_text` is set, which is how a watermark is placed.",
)
Text does not wrap; the shape floats over or behind it.
SQUARE
class-attribute
instance-attribute
¶
Text wraps around the shape's bounding rectangle.
TIGHT
class-attribute
instance-attribute
¶
TIGHT = (
1,
"wrapTight",
"Text wraps around the shape's outline rather than its bounding rectangle, following the wrap polygon Word derives from the image.",
)
Text wraps around the shape's outline rather than its bounding rectangle.
THROUGH
class-attribute
instance-attribute
¶
THROUGH = (
2,
"wrapThrough",
"As TIGHT, but text also flows into any open region within the outline.",
)
As TIGHT, but text also flows into open regions within the outline.
TOP_BOTTOM
class-attribute
instance-attribute
¶
TOP_BOTTOM = (
4,
"wrapTopAndBottom",
"Text stops above the shape and resumes below it, leaving the sides clear.",
)
Text stops above the shape and resumes below it.
WD_ANCHOR_RELATIVE_FROM_H
¶
Bases: BaseXmlEnum
What the horizontal position of a floating shape is measured from.
MS API name: WdRelativeHorizontalPosition
MARGIN
class-attribute
instance-attribute
¶
Relative to the text margin.
PAGE
class-attribute
instance-attribute
¶
Relative to the edge of the page.
COLUMN
class-attribute
instance-attribute
¶
Relative to the text column.
CHARACTER
class-attribute
instance-attribute
¶
Relative to the character the anchor sits at.
LEFT_MARGIN
class-attribute
instance-attribute
¶
Relative to the left margin.
RIGHT_MARGIN
class-attribute
instance-attribute
¶
Relative to the right margin.
INSIDE_MARGIN
class-attribute
instance-attribute
¶
INSIDE_MARGIN = (
6,
"insideMargin",
"Relative to the inside margin — the left margin on an odd page and the right margin on an even one, in a document laid out for double-sided printing.",
)
Relative to the inside margin of a double-sided layout.
OUTSIDE_MARGIN
class-attribute
instance-attribute
¶
Relative to the outside margin of a double-sided layout.
WD_ANCHOR_RELATIVE_FROM_V
¶
Bases: BaseXmlEnum
What the vertical position of a floating shape is measured from.
MS API name: WdRelativeVerticalPosition
MARGIN
class-attribute
instance-attribute
¶
Relative to the text margin.
PAGE
class-attribute
instance-attribute
¶
Relative to the edge of the page.
PARAGRAPH
class-attribute
instance-attribute
¶
Relative to the paragraph the anchor sits in.
LINE
class-attribute
instance-attribute
¶
Relative to the line the anchor sits on.
TOP_MARGIN
class-attribute
instance-attribute
¶
Relative to the top margin.
BOTTOM_MARGIN
class-attribute
instance-attribute
¶
Relative to the bottom margin.
INSIDE_MARGIN
class-attribute
instance-attribute
¶
Relative to the inside margin of a double-sided layout.
OUTSIDE_MARGIN
class-attribute
instance-attribute
¶
Relative to the outside margin of a double-sided layout.
WD_ANCHOR_ALIGN_H
¶
Bases: BaseXmlEnum
Horizontal alignment of a floating shape within what it is positioned against.
An alternative to an absolute offset: LEFT against
WD_ANCHOR_RELATIVE_FROM_H.PAGE puts the shape at the left edge of the page
whatever the page size turns out to be.
LEFT
class-attribute
instance-attribute
¶
Aligned to the left edge.
RIGHT
class-attribute
instance-attribute
¶
Aligned to the right edge.
INSIDE
class-attribute
instance-attribute
¶
Aligned to the inside edge of a double-sided layout.
OUTSIDE
class-attribute
instance-attribute
¶
Aligned to the outside edge of a double-sided layout.
WD_ANCHOR_ALIGN_V
¶
Bases: BaseXmlEnum
Vertical alignment of a floating shape within what it is positioned against.
TOP
class-attribute
instance-attribute
¶
Aligned to the top edge.
BOTTOM
class-attribute
instance-attribute
¶
Aligned to the bottom edge.
INSIDE
class-attribute
instance-attribute
¶
Aligned to the inside edge of a double-sided layout.
OUTSIDE
class-attribute
instance-attribute
¶
Aligned to the outside edge of a double-sided layout.