I am using TextAutofitType.Shape to auto-expand the shape to fit the text inside. In most cases, it works as expected. However, it does not when using the font “Meiryo”. The text goes well outside the shape, both on the left and right. I am using version 21.8.
Here is a screenshot of what it looks like: 2021-11-23 09_35_38-aspose-output.pptx - PowerPoint.png
using (var presentation = new Presentation())
{
var slide = presentation.Slides[0];
var shape = slide.Shapes.AddAutoShape(ShapeType.Rectangle, 300, 50, 1, 1);
var portion = shape.TextFrame.Paragraphs[0].Portions[0];
var text = "this is my formatted text";
var fontName = "Meiryo";
var fontSize = 24;
shape.FillFormat.FillType = FillType.NoFill;
shape.TextFrame.TextFrameFormat.WrapText = NullableBool.False;
shape.TextFrame.TextFrameFormat.AutofitType = TextAutofitType.Shape;
portion.PortionFormat.LatinFont = new FontData(fontName);
portion.PortionFormat.FontHeight = fontSize;
portion.PortionFormat.FillFormat.FillType = FillType.Solid;
portion.PortionFormat.FontBold = NullableBool.True;
portion.Text = text;
var file = @"C:\temp\aspose-output.pptx";
presentation.Save(file, SaveFormat.Pptx);
System.Diagnostics.Process.Start(file);
}