How to Get the Font Size/Color/Name in Each Text Frame in Each Slide in C#?

Hi, Support:

Would you please provide me a full demo to achieve this purpose by Aspose.Slides.dll for based on Net C#?
Thanks!

@ducaisoft,
Thank you for posting the question.

The following code example shows you how to get font properties set to paragraphs in each text frames by default:

using var presentation = new Presentation("sample.pptx");

foreach (var slide in presentation.Slides)
{
    foreach (var shape in slide.Shapes)
    {
        if (shape is IAutoShape autoShape)
        {
            foreach (var paragraph in autoShape.TextFrame.Paragraphs)
            {
                var defaultPortionFormat = paragraph.ParagraphFormat.DefaultPortionFormat.GetEffective();

                var defaultFontHeight = defaultPortionFormat.FontHeight;
                var defaultFontName = defaultPortionFormat.LatinFont.FontName;

                if (defaultPortionFormat.FillFormat.FillType == FillType.Solid)
                {
                    var defaultFontColor = defaultPortionFormat.FillFormat.SolidFillColor;
                }
            }
        }
    }
}

You can also get actual font properties from text portions in the paragraphs like this:

foreach (var textPortion in paragraph.Portions)
{
    var portionFormat = textPortion.PortionFormat.GetEffective();

    var fontHeight = portionFormat.FontHeight;
    var fontName = portionFormat.LatinFont.FontName;

    if (portionFormat.FillFormat.FillType == FillType.Solid)
    {
        var portionColor = portionFormat.FillFormat.SolidFillColor;
    }
}

More examples: