Skip to main content

Enumeration Types

Enumeration classes used throughout python-pptx for specifying various properties and settings.

Action Enumerations

PP_ACTION_TYPE

Specifies the type of a mouse action (click or hover). Alias: PP_ACTION Import:
from pptx.enum.action import PP_ACTION
Values:
PP_ACTION.NONE
0
No action is performed.
PP_ACTION.NEXT_SLIDE
1
Moves to the next slide.
PP_ACTION.PREVIOUS_SLIDE
2
Moves to the previous slide.
PP_ACTION.FIRST_SLIDE
3
Returns to the first slide.
PP_ACTION.LAST_SLIDE
4
Moves to the last slide.
PP_ACTION.LAST_SLIDE_VIEWED
5
Moves to the last slide viewed.
PP_ACTION.END_SHOW
6
Slide show ends.
Hyperlink to a URL.
PP_ACTION.RUN_MACRO
8
Runs a macro.
PP_ACTION.RUN_PROGRAM
9
Runs a program.
PP_ACTION.NAMED_SLIDE_SHOW
10
Runs the slideshow.
PP_ACTION.OLE_VERB
11
OLE Verb action.
PP_ACTION.PLAY
12
Begins the slideshow.
PP_ACTION.NAMED_SLIDE
101
Moves to slide specified by slide number.
PP_ACTION.OPEN_FILE
102
Opens the specified file.
Example:
from pptx.enum.action import PP_ACTION

assert shape.click_action.action == PP_ACTION.HYPERLINK

Shape Enumerations

MSO_SHAPE_TYPE

Specifies the type of a shape. Alias: MSO Import:
from pptx.enum.shapes import MSO_SHAPE_TYPE
Common Values:
MSO_SHAPE_TYPE.AUTO_SHAPE
1
AutoShape
MSO_SHAPE_TYPE.CHART
3
Chart (pie chart, bar chart, etc.)
MSO_SHAPE_TYPE.GROUP
6
Group shape
MSO_SHAPE_TYPE.LINE
9
Line
MSO_SHAPE_TYPE.PICTURE
13
Picture
MSO_SHAPE_TYPE.PLACEHOLDER
14
Placeholder
MSO_SHAPE_TYPE.TABLE
19
Table
MSO_SHAPE_TYPE.TEXT_BOX
17
Text box

PP_PLACEHOLDER_TYPE

Specifies one of the 18 distinct types of placeholder. Alias: PP_PLACEHOLDER Import:
from pptx.enum.shapes import PP_PLACEHOLDER
Values:
PP_PLACEHOLDER.TITLE
1
Title placeholder
PP_PLACEHOLDER.BODY
2
Body text placeholder
PP_PLACEHOLDER.CENTER_TITLE
3
Center title placeholder
PP_PLACEHOLDER.SUBTITLE
4
Subtitle placeholder
PP_PLACEHOLDER.CHART
8
Chart placeholder
PP_PLACEHOLDER.TABLE
12
Table placeholder
PP_PLACEHOLDER.PICTURE
18
Picture placeholder
PP_PLACEHOLDER.DATE
16
Date placeholder
Footer placeholder
PP_PLACEHOLDER.SLIDE_NUMBER
13
Slide number placeholder
Example:
from pptx.enum.shapes import PP_PLACEHOLDER

placeholder = slide.placeholders[0]
assert placeholder.placeholder_format.type == PP_PLACEHOLDER.TITLE

MSO_AUTO_SHAPE_TYPE

Specifies a type of AutoShape. Alias: MSO_SHAPE Import:
from pptx.enum.shapes import MSO_SHAPE
from pptx.util import Inches

slide.shapes.add_shape(
    MSO_SHAPE.ROUNDED_RECTANGLE, Inches(1), Inches(1), Inches(2), Inches(1)
)
Common Values:
  • MSO_SHAPE.RECTANGLE - Rectangle
  • MSO_SHAPE.ROUNDED_RECTANGLE - Rounded rectangle
  • MSO_SHAPE.OVAL - Oval/Ellipse
  • MSO_SHAPE.DIAMOND - Diamond
  • MSO_SHAPE.RIGHT_ARROW - Block arrow pointing right
  • MSO_SHAPE.DOWN_ARROW - Block arrow pointing down

Text Enumerations

MSO_AUTO_SIZE

Determines the type of automatic sizing for text frames. Import:
from pptx.enum.text import MSO_AUTO_SIZE
Values:
MSO_AUTO_SIZE.NONE
0
No automatic sizing. Text can extend beyond shape bounds.
MSO_AUTO_SIZE.SHAPE_TO_FIT_TEXT
1
Shape height (and possibly width) adjusts to fit text.
MSO_AUTO_SIZE.TEXT_TO_FIT_SHAPE
2
Font size is reduced as necessary to fit text within shape.
Example:
shape.text_frame.auto_size = MSO_AUTO_SIZE.TEXT_TO_FIT_SHAPE

PP_PARAGRAPH_ALIGNMENT

Specifies horizontal alignment for paragraphs. Alias: PP_ALIGN Import:
from pptx.enum.text import PP_ALIGN
Values:
PP_ALIGN.LEFT
1
Left aligned
PP_ALIGN.CENTER
2
Center aligned
PP_ALIGN.RIGHT
3
Right aligned
PP_ALIGN.JUSTIFY
4
Justified (both left and right margins)
Example:
shape.text_frame.paragraphs[0].alignment = PP_ALIGN.CENTER

MSO_VERTICAL_ANCHOR

Specifies vertical alignment of text in a text frame. Alias: MSO_ANCHOR Values:
MSO_ANCHOR.TOP
1
Aligns text to top of text frame
MSO_ANCHOR.MIDDLE
3
Centers text vertically
MSO_ANCHOR.BOTTOM
4
Aligns text to bottom of text frame

Drawing/Fill Enumerations

MSO_FILL_TYPE

Specifies the fill type for a shape. Alias: MSO_FILL Import:
from pptx.enum.dml import MSO_FILL
Values:
MSO_FILL.SOLID
1
Shape is filled with a solid color
MSO_FILL.PATTERNED
2
Shape is filled with a pattern
MSO_FILL.GRADIENT
3
Shape is filled with a gradient
MSO_FILL.TEXTURED
4
Shape is filled with a texture
MSO_FILL.BACKGROUND
5
Shape is transparent, showing whatever is behind it
MSO_FILL.PICTURE
6
Shape is filled with a bitmap image
Example:
assert shape.fill.type == MSO_FILL.SOLID

MSO_THEME_COLOR_INDEX

Specifies an Office theme color. Alias: MSO_THEME_COLOR Import:
from pptx.enum.dml import MSO_THEME_COLOR
Values:
MSO_THEME_COLOR.ACCENT_1
5
Accent 1 theme color
MSO_THEME_COLOR.ACCENT_2
6
Accent 2 theme color
MSO_THEME_COLOR.DARK_1
1
Dark 1 theme color
MSO_THEME_COLOR.LIGHT_1
2
Light 1 theme color
Example:
shape.fill.solid()
shape.fill.fore_color.theme_color = MSO_THEME_COLOR.ACCENT_1

Chart Enumerations

XL_CHART_TYPE

Specifies the type of a chart. Import:
from pptx.enum.chart import XL_CHART_TYPE
Common Values:
XL_CHART_TYPE.BAR_CLUSTERED
57
Clustered bar chart
XL_CHART_TYPE.COLUMN_CLUSTERED
51
Clustered column chart
XL_CHART_TYPE.LINE
4
Line chart
XL_CHART_TYPE.PIE
5
Pie chart
XL_CHART_TYPE.AREA
1
Area chart
Example:
assert chart.chart_type == XL_CHART_TYPE.BAR_STACKED

XL_LEGEND_POSITION

Specifies the position of the legend on a chart. Import:
from pptx.enum.chart import XL_LEGEND_POSITION
Values:
XL_LEGEND_POSITION.BOTTOM
-4107
Below the chart
XL_LEGEND_POSITION.LEFT
-4131
Left of the chart
XL_LEGEND_POSITION.RIGHT
-4152
Right of the chart
XL_LEGEND_POSITION.TOP
-4160
Above the chart
Example:
chart.has_legend = True
chart.legend.position = XL_LEGEND_POSITION.BOTTOM

Build docs developers (and LLMs) love