DeleteAnnotationRedaction
Leave feedback
On this page
Inheritance: java.lang.Object, com.groupdocs.redaction.Redaction
public class DeleteAnnotationRedaction extends Redaction
Represents a text redaction that deletes annotations if text is matching given regular expression (optionally deletes all annotations).
Learn more
- More details about applying redactions: Redaction basics
- More details about document annotation redactions: Annotation redactions
The following example demonstrates how to remove all annotations containing words “use”, “show” or “describe” from document (and leave others).
try (Redactor redactor = new Redactor("D:\\test.docx"))
{
redactor.apply(new DeleteAnnotationRedaction("(?im:(use|show|describe))"));
redactor.save()
}
| Constructor | Description |
|---|---|
| DeleteAnnotationRedaction() | Initializes a new instance of DeleteAnnotationRedaction class, with settings to delete all annotations (matching everything). |
| DeleteAnnotationRedaction(String pattern) | Initializes a new instance of DeleteAnnotationRedaction class, deleting annotations matching given expression. |
| DeleteAnnotationRedaction(Pattern regex) | Initializes a new instance of DeleteAnnotationRedaction class, deleting annotations matching given expression. |
| Method | Description |
|---|---|
| getExpression() | Gets the regular expression to match. |
| getDescription() | Returns a string, describing the redaction and its parameters. |
| applyTo(DocumentFormatInstance formatInstance) | Applies the redaction to a given format instance. |
public DeleteAnnotationRedaction()
Initializes a new instance of DeleteAnnotationRedaction class, with settings to delete all annotations (matching everything).
public DeleteAnnotationRedaction(String pattern)
Initializes a new instance of DeleteAnnotationRedaction class, deleting annotations matching given expression.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| pattern | java.lang.String | Regular expression |
public DeleteAnnotationRedaction(Pattern regex)
Initializes a new instance of DeleteAnnotationRedaction class, deleting annotations matching given expression.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| regex | java.util.regex.Pattern | Regular expression |
public final Pattern getExpression()
Gets the regular expression to match.
Returns: java.util.regex.Pattern - The regular expression to match.
public String getDescription()
Returns a string, describing the redaction and its parameters.
Returns: java.lang.String - Text, containing redaction name and parameters.
public RedactorLogEntry applyTo(DocumentFormatInstance formatInstance)
Applies the redaction to a given format instance.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| formatInstance | DocumentFormatInstance | An instance of a document to apply redaction |
Returns: RedactorLogEntry - Status of the redaction: success/failure and error message if any
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.