Find a Shape in PowerPoint Slide using Python
Contents
[
Hide
]
Aspose.Slides - Finding a Shape in a Slide
To Convert Presentation to HTML using Aspose.Slides Java for Python. Here you can see example code.
Python Code
def main(self):
\# Create an instance of Presentation class
pres=self.Presentation
pres = pres(self.dataDir + 'Aspose.pptx')
\# Get the first slide
slide = pres.getSlides().get_Item(0)
shape = self.find_shape(slide)
print "Shape: "
print shape
def find_shape(self,alttext):
#Iterating through all shapes inside the slide
i = 0
pres=self.Presentation()
slide = pres.getSlides().get_Item(0)
while (i < slide.getShapes().size()):
# If the alternative text of the slide matches with the required one then return the shape
if (slide.getShapes().get_Item(i).getAlternativeText() == alttext):
return slide.getShapes().get_Item(i)
i+=1
return None
Download Running Code
Download Finding a Shape in a Slide (Aspose.Slides) from any of the below mentioned social coding sites: