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

Free Support Forum - aspose.com

Setting Width Property on Aspose.Slides.IShape Is Not Taking New Value

Hi, I am trying to resize shapes in my PowerPoint files, but sometimes it does not resize properly. I am using the documentation found here: https://docs.aspose.com/slides/net/re-sizing-shapes-on-slide/

In my example attached, you can see the outputs. You can see the second shape in the file 000000016 that the size does not get set. Instead of going down, it goes up in value.
For file 000000041 it works properly.

Please advise
PPTScale2.zip (419.2 KB)

Thank you for contacting support.

This occurs because the second shape has the “Resize shape to fit text” option. You should try resetting this option for the shapes and then resize them. The code example below shows you how to do this:

if (shape is IAutoShape autoShape)
    autoShape.TextFrame.TextFrameFormat.AutofitType = TextAutofitType.None;

Documents: Manage Autofit Settings
API Reference: ITextFrameFormat.AutofitType Property | TextAutofitType Enumeration

Thank you for this information. This is what I needed.

We are glad to know that the issue is resolved on your end. Thank you for using Aspose.Slides.