We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Distinguish between OLE Object, Charts, Shapes in a Slide Using Aspose.Slides for Python

How to distinguish or identify whether a object is OLE Object or Chart or Shape?

Lets suppose I have slide consist of OLE Object, Chart and Shape. So, how will I get to know the type of object using Aspose.Slides for Python via .NET?

Thank you for posting the question.

To check the type of an object placed on a PowerPoint presentation slide, you can use the isinstance function like this:

if isinstance(shape, OleObjectFrame):

Thanks for your reply Andrey. The solution Works.
However, I am looking for a more generalized way of doing it. I mean you just give a object as input and get the object type as output. Also, it should work for every object that PowerPoint supports, not only for ole object or chart but for all the other objects like shapes, groups etc.
Let me know if you have anything for the above.

Thank you for the additional information. I will get back to you a bit later.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

  Issue ID(s): SLIDESPYNET-75

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.

Thanks for creating the ticket.
What’s the estimated timeline to get a answer for my query?

I’ve requested plans for the issue from our developers. We will let you know soon.

Could you please provide several use cases that you are interested in?

Actually, I’m working on a PPT automation project where I deal with different object like chart, ole_object, different shapes and many more. As we have different methods for different objects for example, ‘chart_data’ can only be accessed from chart object.
Therefore, in order to use these methods with their corresponding compatible objects, I need to know which type of object is it.
Although you shared me a workaround earlier, that doesn’t really fit with my requirements cause I’m dealing thousands of different objects and passing each object through a if statement increase the time complexity and also I need to write the if statement for all type of objects which I believe isn’t a good way of writing the snippet.
As a result, I require a function which takes in a object and spits out the type of object.
Just for your reference, Python-PPTX has a method named “shape_type” which takes in an object and spits you the type of object like “TEXT_BOX (17)” for text boxes, “CHART (3)” for charts, “AUTO_SHAPE (1)” for different shapes, “EMBEDDED_OLE_OBJECT (7)” for ole objects.
I hope I make my use cases clear for you. Thanks for trying to help me out.

Thank you for the information. I’ve forwarded it to our development team.