DeleteAnnotationRedaction

DeleteAnnotationRedaction class

Represents a text redaction that deletes annotations if text is matching given regular expression (optionally deletes all annotations).

public class DeleteAnnotationRedaction : Redaction

Constructors

Name Description
DeleteAnnotationRedaction() Initializes a new instance of DeleteAnnotationRedaction class, with settings to delete all annotations (matching everything).
DeleteAnnotationRedaction(Regex) Initializes a new instance of DeleteAnnotationRedaction class, deleting annotations matching given expression.
DeleteAnnotationRedaction(string) Initializes a new instance of DeleteAnnotationRedaction class, deleting annotations matching given expression.

Properties

Name Description
override Description { get; } Returns a string, describing the redaction and its parameters.
Expression { get; } Gets the regular expression to match.

Methods

Name Description
override ApplyTo(DocumentFormatInstance) Applies the redaction to a given format instance.

Remarks

Learn more

Examples

The following example demonstrates how to remove all annotations containing words “use”, “show” or “describe” from document (and leave others).

using (Redactor redactor = new Redactor(@"D:\test.docx"))
{
   redactor.Apply(new DeleteAnnotationRedaction("(?im:(use|show|describe))"));
   redactor.Save()
}

See Also