GroupDocsGists
10/19/2017 - 10:59 AM

RemoveTextShapesWithParticularTextFormattingExcel.vb

' For complete examples and data files, please go to https://github.com/groupdocs-watermark/GroupDocs.Watermark-for-.NET
Using doc As CellsDocument = Document.Load(Of CellsDocument)(Utilities.MapSourceFilePath(FilePath))
    For Each section As CellsWorksheet In doc.Worksheets
        For i As Object = section.Shapes.Count - 1 To 0 Step -1
            For Each fragment As Object In section.Shapes(i).FormattedTextFragments
                If fragment.ForegroundColor = Color.Red AndAlso fragment.Font.FamilyName = "Arial" Then
                    section.Shapes.RemoveAt(i)
                    Exit For
                End If
            Next
        Next
    Next
    doc.Save()