shape.Type
1 rectangle / 2 ellipse / 3 curve / 5 bitmap / 6 text / 7 group. After converting to curves a text object turns into 3 (or 7 if it was inside a container).
Signature
shape.Type
Notes
1 rectangle / 2 ellipse / 3 curve / 5 bitmap / 6 text / 7 group. After converting to curves a text object turns into 3 (or 7 if it was inside a container).
Python example (runnable)
Requires
pywin32. The example assumes app / doc / page / layer are already connected.
See Connection & InitPython
shape = app.ActiveSelectionRange(1)
t = shape.Type
names = {1: "Rectangle", 2: "Ellipse", 3: "Curve", 4: "Polygon",
5: "Bitmap", 6: "Text", 7: "Group", 8: "Selection"}
print("Type code: ", t, "→", names.get(t, "Other"))
if t == 6: # only text shapes expose .Text
print("Text: ", shape.Text.Contents)
About this section: Geometry & Transform
Geometry & Transform — position, size and rotation of shapes.
- This section has 17 entries; this is one of them.
- See the full section index: Geometry & Transform
Other entries in this section
- shape.Left / .Top / .Right / .BottomEdge coordinates. Top > Bottom because Y points up. Children inside a
- shape.PositionX / .PositionYBottom-left corner. Reading and writing these directly is one call che
- shape.SizeWidth / .SizeHeightWidth and height, read/write. When scaling, read the current size firs
- shape.CenterX / .CenterYCenter coordinates. More convenient than Left/Top when you're aligning
- shape.RotationAngleRotation in degrees, around RotationCenterX/Y.
- shape.SetPosition(x, y, anchor)The default anchor is bottom-left; the third argument picks a differen
- shape.SetSize(w, h, anchor)Scales; the default anchor is top-left. Proportional scaling is on you
- shape.Move(dx, dy)Relative offset. Cheaper than SetPosition because it doesn't read the