How to Get the Text Width from a Text Box in a Presentation Using C++?

Hi, we are using aspose v 25.4 to detect shape width (textbox in this case). While in ppt we have a feature that can auto resize to shape to fit the text in case it overflows - we currently do not have this functionality. In that context, we wanted to ask if there is a way to find out the text width or the textspan inside the textbox. So that if (textSpanWidth > textBoxWidth) then overflow = textBoxWidth - textSpanWidth
and we can add that resultant overflow to the textbox width given by float textBoxWidth = shape->get_Width();

@pankajku,
Thank you for posting the question.

To get the width and height of a paragraph or text portion, you can use the GetRect method from the IParagraph and IPortion interfaces.

RectangleF paragraphRect = paragraph->GetRect();

RectangleF portionRect = portion->GetRect();

Paragraph|Aspose.Slides Documentation