Free Support Forum -

API Returning value for "width" as zero for the AutoShape

Hi Team

Aspose Version: 20.1
Language: C#


m_Presentation = new Presentation(pptpath);

Debug Expression:

((Aspose.Slides.Shape)(new System.Linq.SystemCore_EnumerableDebugView<Aspose.Slides.IShape>(((Aspose.Slides.BaseSlide)(new System.Linq.SystemCore_EnumerableDebugView<Aspose.Slides.ISlide>(m_Presentation.Slides).Items[0])).Shapes).Items[0])).Width


Auto shape used in PPTX, Aspose library is returning proper value for height but not for width.
The width is coming as 0.
Attached file has 1 slide with 1 shape used in it (73.0 KB)

Can you share your thoughts on this?

~ Praveen

Thank you for your query. I investigated this case and found that IShape.Width property returns correct value. Please look at the value displayed in PowerPoint: shape_width.png (10.5 KB). You should find out how this shape has been created.

Hi Andrey,

Thanks for looking into it, and sharing your thoughts,

I was looking at this particular width property in the attached sample file. When I change this value (as shown in the below file, I see the width of the shape increase whereas when I change what you are referring to, I see that shape rotates on a particular axis.

Width Sample.png (12.9 KB)

How does Aspose differentiate between the width you were referring to and the one in the attachment (Width Sample.png)?

~ Praveen


Yes, I noticed this strange behavior in PowerPoint as well. If that shape was created using Aspose.Slides and its behavior is incorrect, please share the code example reproducing the error.

The width displayed in your screenshot is the line width. You can get its value as below:

var width = presentation.Slides[0].Shapes[0].LineFormat.GetEffective().Width;

More details: Line
API Reference: ILineFormat Interface