Skip to content

Instantly share code, notes, and snippets.

@GroupDocsGists
Last active September 20, 2019 10:36
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/b5738528abcc02850b5e1b6d062f55ef to your computer and use it in GitHub Desktop.
Save GroupDocsGists/b5738528abcc02850b5e1b6d062f55ef to your computer and use it in GitHub Desktop.
using GroupDocs.Redaction;
using GroupDocs.Redaction.Redactions;
...
using (Document doc = Redactor.Load("sample.docx"))
{
doc.RedactWith(new ExactPhraseRedaction("John Doe", true /*isCaseSensitive*/, new ReplacementOptions("[censored]")));
doc.Save();
}
using GroupDocs.Redaction;
using GroupDocs.Redaction.Redactions;
...
using (Document doc = Redactor.Load("sample.docx"))
{
doc.RedactWith(new ExactPhraseRedaction("John Doe", new ReplacementOptions("[censored]")));
doc.Save();
}
using GroupDocs.Redaction;
using GroupDocs.Redaction.Redactions;
...
using (Document doc = Redactor.Load("sample.docx"))
{
// Regex to match a number having 2 digits, space, 2 digits, space, 6 digits
doc.RedactWith(new RegexRedaction(@"\\d{2}\\s*\\d{2}[^\\d]*\\d{6}", new ReplacementOptions("[censored]")));
doc.Save();
}
using GroupDocs.Redaction;
using GroupDocs.Redaction.Redactions;
...
using (Document doc = Redactor.Load("sample.docx"))
{
doc.RedactWith(new ExactPhraseRedaction("John Doe", true, new ReplacementOptions(System.Drawing.Color.Black)));
doc.Save();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment