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

Free Support Forum - aspose.com

Handling shapes

Have a PPTX template created with Microsoft Powerpoint and want to add shapes to this template. Seems like copying a shape in MS PP does not create a recognizable shape in Aspose. So I wonder which way is the right way of createing shapes in MS PP?

Hi Bo Ander,


Please visit this documentation link for your kind reference. The copying of slides in PPTX is currently not supported. What you can do is to have many required shapes in your template slide and you clone that slide in your presentation. Then you should delete the shapes that you don’t want on the particular slide and leaving the ones unharmed that you want to keep. You may repeat this step for every slide in your presentation. The second approach is to create shapes individually on each slide. I hope I have made my point clear and understandable to you. Please share, if I may help you further in this regard.

Many Thanks,

Ok, you misunderstood me a bit: I’m trying to add shapes to the template with Microsoft Powerpoint but it seems like Aspose does not recognize them as shapes. Only if I select a predefined layout then Aspose recognize the shapes but not when I have a slida and copy the shape to a new shape in MS powerpoint (e.g. in my template). I possibly misunderstand the “shape definition”?

Hi Bo Ander,


I would suggest you to please share the template with shapes that Aspose.Slides is unable to recognize. Please also share the code snippet that you are trying to use. If there is issue, I will try to help you out further.

Many Thanks,

First slide created by copying the shape (copied shape does not work, not found in the loop below) and the second slide is a defautl PPT layout which works
Code extract:
Public Function runPowerPointReport(ByRef PPTReport As PresentationEx…

Dim shp As ShapeEx
Dim shpIndex As Integer = 0
Dim sldShpCount As Integer = 0
Try
For Each sld As SlideEx In PPTReport.Slides
sldShpCount = sld.Shapes.Count
For shpIndex = 0 To sldShpCount - 1
shp = sld.Shapes(shpIndex)
If shp.Placeholder IsNot Nothing Then
tstr = CType(shp, AutoShapeEx).TextFrame.Text


Hi Bo Ander,


I have modified the code snippet shared by you. Actually, the missing shape that you are unable is although an AutoShapeEx instance but not a placeholder. Please use the following code snippet.

Public Sub FindShapes()
Dim path As String = “C:\Users\Mudassir\Downloads”
Dim pres As PresentationEx = New PresentationEx(path + “ShapeQuestion.pptx”)
Dim shp As ShapeEx
Dim tstr As String

For Each slide As SlideEx In pres.Slides
Dim shpIndex As Integer = 0
Dim sldShpCount As Integer = 0
sldShpCount = slide.Shapes.Count
Console.WriteLine("Shape Count: " + sldShpCount.ToString())
For shpIndex = 0 To sldShpCount - 1
shp = slide.Shapes(shpIndex)
Dim ashp As AutoShapeEx = CType(shp, AutoShapeEx)
tstr = ashp.TextFrame.Text
Console.WriteLine("Shape : " + shpIndex.ToString() + " : " + tstr)

Next
Next
End Sub

Many Thanks,