我們很高興宣佈 GroupDocs.Redaction for Node.js via Java 26.10 已於 2026年10月 發佈。這是該產品的首次公開 npm 發佈,提供與 GroupDocs.Redaction for Java 26.10 相同的功能。主要改進包括 Word 文件的 OOXML 合規性控制、對 Excel 範本與制表符分隔格式的擴充支援、PDF 頁面區域自訂遮蔽處理程式,以及修復圖像定位與 DrawBox 處理的問題。
本次發佈的新功能
- [Feature] 指定並保留 Word 處理文件的 OOXML 合規性 (REDACTIONNET-718)
- [Feature] 新增試算表範本格式 XLT / XLTX / XLTM 以及 TAB;改進 Cells 的儲存格式對映 (REDACTIONNET-802)
- [Fix] 為僅文字的試算表 CSV / TAB / TSV 跳過 DrawBox(彩色矩形)遮蔽 (REDACTIONNET-805)
- [Feature] PDF
PageAreaRedaction的自訂遮蔽處理程式 (ICustomRedactionHandler) (REDACTIONNET-594) - [Fix] 修正頁面區域圖像遮蔽的定位(嵌入圖像的頁面放置與實際尺寸) (REDACTIONNET-551)
公開 API 變更
公開 API 與 GroupDocs.Redaction for Java 26.10 相匹配,包含:
WordProcessingComplianceLevel(Ecma,Transitional,Strict)WordprocessingSaveOptions帶有getOoxmlCompliance/setOoxmlComplianceSaveOptions.getWordprocessingSaveOptions()ICustomRedactionHandler,CustomRedactionContext,CustomRedactionResultReplacementOptions.getCustomRedaction/setCustomRedactionFileType.getXLT(),getXLTX(),getXLTM(),getTAB()
新功能
-
OOXML 合規性 for Word Processing (REDACTIONNET-718)
您可以在儲存 Word 文件時指定 OOXML 合規性等級。若未設定,將保留原始文件的合規性。Strict 無法直接降級為 Ecma(需先使用 Transitional)。 -
試算表格式 XLT / XLTX / XLTM / TAB (REDACTIONNET-802)
FileType釋出 Excel 範本類型與.tab。試算表儲存路徑會正確對映這些格式(與現有的 ODS / OTS / XLSB 支援並存)。 -
跳過 CSV / TAB / TSV 的 DrawBox (REDACTIONNET-805)
彩色矩形(DrawBox)取代不適用於僅文字的試算表格式。這類遮蔽會以明確的狀態被跳過,而不會嘗試圖像樣式的取代。 -
PDF PageArea 的自訂遮蔽 (REDACTIONNET-594)
ReplacementOptions接受ICustomRedactionHandler。每次匹配時,處理程式會收到CustomRedactionContext並回傳CustomRedactionResult(是否套用 + 取代文字)。目前僅支援 PDFPageAreaRedaction。 -
圖像區域定位 (REDACTIONNET-551)
具備頁面放置與實際像素尺寸資訊的嵌入圖像,會使用頁面座標進行遮蔽,使PageAreaFilter/ImageAreaRedaction與可見圖像區域對齊,即使位圖尺寸與頁面形狀不同。
程式碼範例
const redaction = require('@groupdocs/groupdocs.redaction');
const java = require('java');
const optionsText = new redaction.ReplacementOptions('[replaced]');
const handler = java.newProxy('com.groupdocs.redaction.redactions.ICustomRedactionHandler', {
redact: function (context) {
const result = new redaction.CustomRedactionResult();
const text = context.getText();
if (text && text.indexOf('Lorem') >= 0) {
result.setApply(true);
result.setText(text.replace('Lorem', '[redacted-custom]'));
}
return result;
}
});
optionsText.setCustomRedaction(handler);
const redactor = new redaction.Redactor('sample.pdf');
try {
redactor.apply(new redaction.PageAreaRedaction(
java.import('java.util.regex.Pattern').compile('.*'),
optionsText));
redactor.save(new redaction.SaveOptions(false, 'Custom_Redaction_Result'));
} finally {
redactor.close();
}
如何取得更新
npm
透過 npm 安裝套件:
npm install @groupdocs/groupdocs.redaction@26.10.0
套件連結:GroupDocs.Redaction for Node.js via Java 26.10.0
直接下載
從 GroupDocs.Redaction for Node.js via Java 26.10 Release Notes 頁面下載最新發佈版本。