Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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