Skip to end of metadata
Go to start of metadata
Contents Summary

The code in below examples uses some methods defined in the Common Utilities.

Tabular Document Redaction 

GroupDocs.Redaction API allows working with a tabular document. If you have a document with one or more tables, organized into worksheets (one table per worksheet) - such as Microsoft Excel documents - you can use a specific type of textual redactions, CellColumnRedaction. It allows you to set a scope of the redaction to a specific worksheet and/or column. The options are:

  • Optionally set worksheet name or its numeric index (if both are missing, redaction affects all worksheets)
  • Optionally set column (all columns are used if the column filter is not set)

If no filters are set, redactions affects the entire document. All indices are zero-based. For example, you can use filters, to redact the second column with emails on a worksheet "Customers", leaving untouched all other emails in the document.

The Recipe

  • Load Document using Redactor.Load(@"C:\sample.pdf")

  • Initialize CellFilter using new CellFilter() ColumnIndex = 1, WorkSheetName = "Customers"}

  • Initialize Regex using new Regex("^\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$")

  • Get RedactionSummary using Document.RedactWith(new CellColumnRedaction(filter, expression, new ReplacementOptions("[customer email]")))

  • Save document using Document.Save(new SaveOptions() { AddSuffix = true })

The Code

  • No labels