GroupDocsGists
10/19/2017 - 10:59 AM

RemoveTextShapesWithParticularTextFormattingPowerPoint.cs

// For complete examples and data files, please go to https://github.com/groupdocs-watermark/GroupDocs.Watermark-for-.NET
using (SlidesDocument doc = Document.Load<SlidesDocument>(Utilities.MapSourceFilePath(FilePath)))
{
    foreach (SlidesSlide slide in doc.Slides)
    {
        for (var i = slide.Shapes.Count - 1; i >= 0; i--)
        {
            foreach (var fragment in slide.Shapes[i].FormattedTextFragments)
            {
                if (fragment.ForegroundColor == Color.Red && fragment.Font.FamilyName == "Arial")
                {
                    slide.Shapes.RemoveAt(i);
                    break;
                }
            }
        }
    }
    doc.Save();
}