Font Size in TextFrames

Hi There;


I’m using Aspose to generate some slides in PPTX format; however there’s a small issue i’m trying to resolve.

When you create the slides in Powerpoint, the font size automatically scales down so that many bullet points can still fit in the shape. From memory, this was still working through Aspose when you put the text in via the Text property on the textframe.

However, as we’re adding formatted text, we’re adding paragraphs and portions programattically. I realise that the font size is set specifically on these, put is there some way, after I’ve finished adding the text, to determine what the font size should be so it all should fit? Is there some method I can call to achieve this?

Thanks in advance for the help;
Regards,

Simon

Hi Simon,

Thanks for your interest in Aspose.Slides.

I regret to inform you that there is no method or property available in Aspose.Slides.Pptx in order to suggest what font size should be used to fit all text inside a particular shape. The TextFrame class in case of PPT has a method FitTextToShape() that actually fit your text in the text frame. As a possible workaround in case of PPTX, please follow this link.

Thanks and Regards,

Hi There;


Thanks for the quick reply.

Okay, so there’s a solution in PPT; just not in PPTX then, unless I use the System.Drawing namespace to render the textframe for myself? That seems a bit drastic.

This seems to be a bit of a limitation, as the PPTX model doesn’t have a FitTextToShape() or support a FitShapeToText property, and there seems to be no other way to determine overflow (if there was I could manipulate the font sizes myself).

Is this a limitation, or is it something you’re looking at implementing?

Regards,
Simon

Hi Simon,

Regretfully, the functionality currently unavailable in Aspose.Slides. Once, some information regarding this feature will become available, the functionality will be implemented. An issue with ID 15613 has already been created in our issue tracking system to resolve the issue. This thread has also been linked with same issue, so that you may be automatically notified, once the issue is resolved.

Thanks and Regards,

What happened to fitTextToShape() in PPTX, and why?

Dear Ken,

We regret to inform you that FitTextToShape and FitShapeToText properties are currently unavailable in Aspose.Slides for .NET. An issue with ID 15613 has already been created to look in to the provision of providing these features for PPTX. This thread has already been linked with the issue so that you may be automatically notified, once the issue is resolved.

We are sorry for your inconvenience,

The issues you have found earlier (filed as 15613) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

When using TextAutofitTypeEx.Shape it only resizes the HEIGHT of rectangle to fit the text, not the Width. This is really poor. Is there a work around?

//idRect points to a Rectangle with width = 300, height = 300.

AutoShapeEx shape = (AutoShapeEx) slideEx.Shapes[idRect];

shape.FillFormat.FillType = FillTypeEx.NoFill;

shape.LineFormat.Width = 0;

//BUG in aspose : it only changes shape height, not width

shape.TextFrame.AutofitType = TextAutofitTypeEx.Shape;

shape.AddTextFrame(label);

//At this point shape has width = 300 and height = ~50

Hi,


I have tried to understand the issue shared by you. In order to further investigate the issue, please share the source presentation along with generated output. Please also share the complete code snippet for our further investigation.

Many Thanks,