Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GroupDocsGists/e2f9d2330c011444a8a1bc32f2a31646 to your computer and use it in GitHub Desktop.
Save GroupDocsGists/e2f9d2330c011444a8a1bc32f2a31646 to your computer and use it in GitHub Desktop.
// For complete examples and data files, please go to https://github.com/groupdocs-watermark/GroupDocs.Watermark-for-.NET
using (WordsDocument doc = Document.Load<WordsDocument>(Utilities.MapSourceFilePath(FilePath)))
{
foreach (WordsSection section in doc.Sections)
{
for (var i = section.Shapes.Count - 1; i >= 0; i--)
{
foreach (var fragment in section.Shapes[i].FormattedTextFragments)
{
if (fragment.ForegroundColor == Color.Red && fragment.Font.FamilyName == "Arial")
{
section.Shapes.RemoveAt(i);
break;
}
}
}
}
doc.Save();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment