In order to reject specific changes during redaction process or to keep a full log of changes in the document, you need to set Redactor.RedactionCallback property, to a class implementing IRedactionCallback interface. The interface contains only one method, AcceptRedaction, which receives detailed information about proposed redaction and returns Boolean value, accepted or not.
Below, we create a callback class, dumping changes to system console:
publicclassRedactionDumpimplementsIRedactionCallback{publicRedactionDump(){}publicbooleanacceptRedaction(RedactionDescriptiondescription){System.out.print(description.getRedactionType()+" redaction, "+description.getActionType()+" action, item "+description.getOriginalText()+". ");if(description.getReplacement()!=null){System.out.print("Text "+description.getReplacement().getOriginalText()+" is replaced with "+description.getReplacement().getReplacement()+". ");}System.out.println();returntrue;}}
The instance of this class is to be passed to a constructor of the Redactor class:
// Assign an instance of callback before using Redactor
finalRedactorredactor=newRedactor("\\Sample.docx",newLoadOptions(),newRedactorSettings(newRedactionDump()));try{redactor.apply(newExactPhraseRedaction("John Doe",newReplacementOptions("[personal]")));redactor.save();}finally{redactor.close();}
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.