文本编辑是从数字文档中删除机密或不需要的文本或信息的过程,同时保留文档的其余部分或包含它的段落。 编辑帮助用户和组织通过隐藏或永久删除敏感信息来保护它们。 使用 GroupDocs.Redaction Java API 用户现在可以编辑、隐藏或删除文字处理文档、工作表、演示文稿、PDF 和光栅图像文件中的敏感文本。 API 为编辑文档中的私人信息提供了广泛的选项和方法。 它支持使用精确匹配或正则表达式进行搜索和编辑,使用文本(豁免代码)或图形(彩色矩形)编辑等等。 那么为什么不尝试一下,通过下载 API 并探索其基本和高级功能来自动化您的文档编辑过程。
GroupDocs.Redaction 允许轻松地从您的文档中编辑敏感或私人性质的数据。 最流行的编辑案例是从文档中删除文本。
以下代码可用于通过精确短语将文本编辑应用于文档的特定部分。 它允许用户用个人(或任何豁免代码)替换个人确切短语"Michal Clark"
//Supported file formats: https://docs.groupdocs.com/redaction/java/supported-document-formats/ | |
final Redactor redactor = new Redactor("sample.pdf"); | |
try | |
{ | |
redactor.apply(new ExactPhraseRedaction("John Doe", new ReplacementOptions("[personal]"))); | |
redactor.save(); | |
} | |
finally { redactor.close(); } |
以下示例使用户能够执行精确的区分大小写的编辑,以删除或隐藏文档中的特定文本块。 默认情况下,搜索精确相位不区分大小写。
// Supported file formats: https://docs.groupdocs.com/redaction/java/supported-document-formats/ | |
final Redactor redactor = new Redactor("sample.pdf"); | |
try | |
{ | |
redactor.apply(new ExactPhraseRedaction("John Doe", true /*isCaseSensitive*/, new ReplacementOptions("[personal]"))); | |
redactor.save(); | |
} | |
finally { redactor.close(); } |
除了删除编辑文本或在其中放置字符串之外,还可以在编辑文本上放置颜色框。 在这种情况下,匹配的文本将被删除,并且一个彩色矩形将放置在已编辑的文本上。
// Supported file formats: https://docs.groupdocs.com/redaction/java/supported-document-formats/ | |
final Redactor redactor = new Redactor("sample.pdf"); | |
try | |
{ | |
redactor.apply(new ExactPhraseRedaction("John Doe", new ReplacementOptions(java.awt.Color.RED))); | |
redactor.save(); | |
} | |
finally { redactor.close(); | |
} |
所有主要平台和操作系统都支持 Java API 的 GroupDocs.Redaction。 如需完整的系统要求指南,请访问 系统要求 在执行以下代码之前,请确保您的系统上已安装以下先决条件 :
(Comma Seperated Values)
(Microsoft Word Binary Format)
(Microsoft Word 2007 Marco File)
(Office 2007+ Word Document)
(Microsoft Word Template Files)
(Microsoft Word 2007+ Template File)
(Portable Document Format)
(Microsoft PowerPoint Template Files)
(Microsoft PowerPoint Template File)
(PowerPoint Slide Show)
(Macro-enabled Slide Show)
(PowerPoint Slide Show)
(Microsoft PowerPoint 97-2003)
(Macro-enabled Presentation File)
(Open XML presentation Format)
(Rich Text Format)
(Microsoft Excel Spreadsheet (Legacy))
(Macro-enabled Spreadsheet)
(Open XML Workbook)
(Excel 97 - 2003 Template)
(Excel Macro-Enabled Template)
(Excel Template)