Hi.
We are using aspose.slides component to generate presentations from code. We want to use autofit options of a TextFrame. According to product’s documentation we can achive this by setting value of the TextFrame.TextFrameFormat.AutofitType property.
But it seems that it’s not enough. Result presentation contains correct value of the Autofit property but font size/shape size are not adjusted. If user changes shape size automatically font size will be recalculated to fit the shape.
Is there any way to adjust font size/shape size according to value of the autofit property when we building presentation? Or maybe it’s possible to force PowerPoint application to recalculate shape/text sizes when it opens our presentation?
Here’s code sample:
var presentation = new Presentation("./source.pptx");<span style="color:blue;">var</span> targetShape = (<span style="color:#2b91af;">IAutoShape</span>)presentation.Slides[0].Shapes.First(x => x.AlternativeText == <span style="color:#a31515;">"target"</span>); <span style="color:blue;">var</span> textFrame = targetShape.TextFrame ?? targetShape.AddTextFrame(<span style="color:#a31515;">""</span>); textFrame.TextFrameFormat.AutofitType = <span style="color:#2b91af;">TextAutofitType</span>.Normal; textFrame.Text = <span style="color:#a31515;">"Very very long text"</span>; presentation.Save(<span style="color:#a31515;">"./result.pptx"</span>, <span style="color:#2b91af;">SaveFormat</span>.Pptx); <span style="color:blue;">var</span> process = <span style="color:#2b91af;">Process</span>.Start(<span style="color:#2b91af;">Path</span>.GetFullPath(<span style="color:#a31515;">"./result.pptx"</span>));</pre><pre style="font-family: Consolas; font-size: 13px; background: white;">Also I've attached template and result files.</pre><pre style="font-family: Consolas; font-size: 13px; background: white;">Thanks in advance!</pre></div>