我們很高興宣布 GroupDocs.Redaction for Java 25.12 版本已於 2025 年 12 月 推出。此點發行解決了一個影響在修訂後處理 PowerPoint 模板巨集啟用 (POTM) 檔案的問題。
此版本的新功能
| 問題 ID | 摘要 | 類別 |
|---|---|---|
| REDACTIONJAVA-246 | 修訂後無法開啟 POTM 檔案 | 修復 |
修復細節
當簡報從串流載入、進行修訂,然後再儲存時,輸出會不正確地轉換為 PPTX 格式,無論原始檔案類型為何。此修復確保修訂後的檔案保留原始 POTM 格式。
程式碼範例(已修正行為)
import com.groupdocs.redaction.Redactor;
import com.groupdocs.redaction.redactions.ExactPhraseRedaction;
import com.groupdocs.redaction.redactions.ReplacementOptions;
import com.groupdocs.redaction.options.RasterizationOptions;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
public class RedactPotm {
public static void main(String[] args) throws Exception {
// Define input and output file paths
Path inputPath = Paths.get("source.potm");
Path outputPath = Paths.get("redacted.potm");
// Open input stream, create redactor, and prepare output stream
// All resources are automatically closed when exiting the try block
try (final InputStream inputStream = Files.newInputStream(inputPath);
final Redactor redactor = new Redactor(inputStream);
final OutputStream outputStream = Files.newOutputStream(outputPath)) {
// Configure redaction: define text to redact and replacement string
String textToRedact = "TEXT";
String redactWith = "****";
// Create replacement options and exact phrase redaction
ReplacementOptions textReplacement = new ReplacementOptions(redactWith);
ExactPhraseRedaction textRedaction = new ExactPhraseRedaction(textToRedact, textReplacement);
// Apply the redaction to the document
redactor.apply(textRedaction);
// Configure rasterization options (disable rasterization for presentations)
RasterizationOptions rasterizationOptions = new RasterizationOptions();
rasterizationOptions.setEnabled(false);
// Save the redacted presentation
// Fixed: Now preserves the original POTM format instead of converting to PPTX
redactor.save(outputStream, rasterizationOptions);
}
}
}
此範例展示了已修正的工作流程:從串流載入 POTM 檔案、套用簡單文字修訂,並將結果儲存回 POTM,不會產生不必要的格式轉換。
如何取得更新
在 pom.xml 檔案中更新相依性版本:
<dependencies>
<dependency>
<groupId>com.groupdocs</groupId>
<artifactId>groupdocs-redaction</artifactId>
<version>25.12</version>
</dependency>
</dependencies>
或直接從我們的 Maven 儲存庫下載套件:
https://releases.groupdocs.com/java/repo/com/groupdocs/groupdocs-redaction/25.12/
其他資源
反饋
我們重視您的意見!如果您有任何問題、遇到問題或有建議,請造訪我們的 Free Support Forum。我們的團隊隨時為您提供協助。