public class CellColumnRedaction extends TextRedaction
Represents a text redaction that replaces text in a spreadsheet documents (CSV, Excel, etc.).
Learn more
The following example demonstrates removing user emails from a second column on "Customers" worksheet of a spreadsheet document.
try (Redactor redactor = new Redactor("D:\\Sales in September.xslx"))
{
CellFilter filter = new CellFilter();
filter.setColumnIndex(1); // zero-based 2nd column
filter.setWorkSheetName("Customers");
Pattern expression = Pattern.compile("^\\w+([-+.']\\w+)*@\\w+([-.]\\w+)\*\.\\w+([-.]\\w+)*$");
RedactorChangeLog changeLog = redactor.apply(new CellColumnRedaction(filter, expression, new ReplacementOptions("[customer email]")));
if (result.Status != RedactionStatus.Failed)
{
SaveOptions opt = new SaveOptions();
opt.setAddSuffix(true);
doc.save(opt);
};
}
| Constructor and Description |
|---|
CellColumnRedaction(CellFilter filter,
Pattern regEx,
ReplacementOptions options)
Initializes a new instance of CellColumnRedaction class.
|
| Modifier and Type | Method and Description |
|---|---|
RedactorLogEntry |
applyTo(DocumentFormatInstance formatInstance)
Applies the redaction to a given format instance.
|
String |
getDescription()
Returns a string, describing the redaction and its parameters.
|
CellFilter |
getFilter()
Gets the column and worksheet filter.
|
Pattern |
getPattern()
Gets the regular expression to match.
|
getActionOptions, getOcrConnector, processAsTextual, setOcrConnectorpublic CellColumnRedaction(CellFilter filter, Pattern regEx, ReplacementOptions options)
Initializes a new instance of CellColumnRedaction class.
filter - Column and worksheet filterregEx - Regular expression to search and replaceoptions - Replacement optionspublic RedactorLogEntry applyTo(DocumentFormatInstance formatInstance)
Applies the redaction to a given format instance.
public String getDescription()
Returns a string, describing the redaction and its parameters.
getDescription in class Redactionpublic final CellFilter getFilter()
Gets the column and worksheet filter.
public final Pattern getPattern()
Gets the regular expression to match.
Copyright © 2025. All rights reserved.