how to identify different auto shapes(such as textbox, rectangle, oval etc)? I know type gives you the type as “AutoShape” for all of them but I want a function to distinguish all of them separately.
@a0pro0b,
Thank you for posting the question. I was unable to distinguish auto shapes in PowerPoint presentations using Aspose.Slides.
We have opened the following new ticket(s) in our internal issue tracking system and will consider the question according to the terms mentioned in Free Support Policies.
Issue ID(s): SLIDESPYNET-117
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
@a0pro0b,
Please try using the AutoShape.ShapeType
property.
Please also note that text boxes are Rectangle
objects in PowerPoint documents.
https://reference.aspose.com/slides/python-net/aspose.slides/shapetype/
Code example:
with slides.Presentation() as pres:
shape1 = pres.slides[0].shapes.add_auto_shape(slides.ShapeType.RECTANGLE, 100, 150, 150, 75)
shape2 = pres.slides[0].shapes.add_auto_shape(slides.ShapeType.TRIANGLE, 200, 150, 150, 75)
shape3 = pres.slides[0].shapes.add_auto_shape(slides.ShapeType.ELLIPSE, 300, 150, 150, 75)
for shape in pres.slides[0].shapes:
if shape.shape_type == slides.ShapeType.RECTANGLE:
print(f"Shape type for {shape.unique_id} is RECTANGLE")
if shape.shape_type == slides.ShapeType.TRIANGLE:
print(f"Shape type for {shape.unique_id} is TRIANGLE")
if shape.shape_type == slides.ShapeType.ELLIPSE:
print(f"Shape type for {shape.unique_id} is ELLIPSE")