RedactorApply Method (Redaction)
Applies a set of redactions to the document.

Namespace: GroupDocs.Redaction
Assembly: GroupDocs.Redaction (in GroupDocs.Redaction.dll) Version: 21.3
Syntax
public RedactorChangeLog Apply(
	Redaction[] redactions
)

Parameters

redactions
Type: GroupDocs.RedactionRedaction
An array of redactions to apply

Return Value

Type: RedactorChangeLog
Success or failure and error message in this case
Examples

The following example demonstrates applying a list of redactions to the document.

C#
using (Redactor redactor = new Redactor(@"D:\\test.docx"))
{
   var redactionList = new Redaction[] 
   {
      new ExactPhraseRedaction(LookupStrings.ClientName, new ReplacementOptions("[client]")),
      new ExactPhraseRedaction(LookupStrings.ClientAddress, new ReplacementOptions(System.Drawing.Color.Red)),
      new RegexRedaction(LookupStrings.SSNRegexPattern, new ReplacementOptions("[ssn]")),
      new RegexRedaction(LookupStrings.BankCardRegexPattern, new ReplacementOptions(System.Drawing.Color.Blue)),
      // ... other redactions
      new DeleteAnnotationRedaction("(?im:(use|show|describe))"),
      new EraseMetadataRedaction(MetadataFilter.Author),
      new MetadataSearchRedaction(LookupStrings.CompanyName, "--company--") 
   }; 
   RedactorChangeLog result = redactor.Apply(redactionList);
   // false, if at least one redaction failed
   if (result.Status != RedactionStatus.Failed)
   {
      redactor.Save();
   };
}
See Also