ExactPhraseRedaction
Leave feedback
On this page
Represents a text redaction that replaces exact phrase in the document’s text, case insensitive by default.
public class ExactPhraseRedaction : TextRedaction
| Name | Description |
|---|---|
| ExactPhraseRedaction(string, ReplacementOptions) | Initializes a new instance of ExactPhraseRedaction class in case insensitive mode. |
| ExactPhraseRedaction(string, bool, ReplacementOptions) | Initializes a new instance of ExactPhraseRedaction class. |
| Name | Description |
|---|---|
| ActionOptions { get; } | Gets the ReplacementOptions instance, specifying type of text replacement. |
| override Description { get; } | Returns a string, describing the redaction and its parameters. |
| IsCaseSensitive { get; } | Gets a value indicating whether the search is case-sensitive or not. |
| IsRightToLeft { get; set; } | Gets or sets a value indicating if this text is right-to-Left or not, false by default. |
| OcrConnector { get; set; } | Gets or sets the IOcrConnector implementation, required to extract text from graphic content. |
| SearchPhrase { get; } | Gets the string to search and replace. |
| Name | Description |
|---|---|
| override ApplyTo(DocumentFormatInstance) | Applies the redaction to a given format instance. |
Learn more
- More details about applying redactions: Redaction basics
- More details about document text redactions: Text redactions
The following example demonstrates performing case-sensitive phrase search and replacement.
using (Redactor redactor = new Redactor(@"C:\sample.pdf"))
{
// By default, isCaseSensitive = false;
doc.Apply(new ExactPhraseRedaction("John Doe", true /*isCaseSensitive*/, new ReplacementOptions("[personal]")));
doc.Save();
}
The following example demonstrates replacing phrase (case insensitive) with solid red rectangle.
using (Redactor redactor = new Redactor(@"C:\sample.pdf"))
{
// By default, isCaseSensitive = false;
doc.Apply(new ExactPhraseRedaction("John Doe", new ReplacementOptions(System.Drawing.Color.Red)));
doc.Save();
}
- class TextRedaction
- namespace GroupDocs.Redaction.Redactions
- assembly GroupDocs.Redaction
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.