The following example demonstrates applying a list of redactions to the document.
using(Redactorredactor=newRedactor(@"D:\\test.docx")){varredactionList=newRedaction[]{newExactPhraseRedaction(LookupStrings.ClientName,newReplacementOptions("[client]")),newExactPhraseRedaction(LookupStrings.ClientAddress,newReplacementOptions(System.Drawing.Color.Red)),newRegexRedaction(LookupStrings.SSNRegexPattern,newReplacementOptions("[ssn]")),newRegexRedaction(LookupStrings.BankCardRegexPattern,newReplacementOptions(System.Drawing.Color.Blue)),// ... other redactionsnewDeleteAnnotationRedaction("(?im:(use|show|describe))"),newEraseMetadataRedaction(MetadataFilter.Author),newMetadataSearchRedaction(LookupStrings.CompanyName,"--company--")};RedactorChangeLogresult=redactor.Apply(redactionList);// false, if at least one redaction failedif(result.Status!=RedactionStatus.Failed){redactor.Save();};}
The following example demonstrates how to apply a redaction policy to all files within a given inbound folder, and save to one of outbound folders - for successfully updated files and for failed ones.