Hi Team,
I have a text file when it’s redacted by the GroupDocs Redaction Java SDK the output is saving as xlsx file instead of as text. This is an unexpected behaviour as the SDK guarantees that it’s saved in native format. Please find the resources below to reproduce.
Code
@Test
void txtSavedAsXlsx() {
try (Redactor redactor = new Redactor(getClass().getResourceAsStream("/bug_affected_file.txt"))) {
RedactorChangeLog result =
redactor.apply(new ExactPhraseRedaction("514-14-8905", new ReplacementOptions("#")));
if (result.getStatus() != RedactionStatus.Failed) {
try (FileOutputStream fileStream = new FileOutputStream("txt_saved_as_xlsx.txt")) {
RasterizationOptions options = new RasterizationOptions();
options.setEnabled(false);
redactor.save(fileStream, options);
}
}
} catch (Exception e) {
fail(e);
}
}
System Details
Java: 17
SDK: GroupDocs.Redaction Java
SDK Version: 21.12
File Affected
bug_affected_file.txt.zip (963 Bytes)
Expected
File should be a text file with redacted content.
Actual
File is an xlsx file with redacted content. Please rename txt_saved_as_xlsx.txt to txt_saved_as_xlsx.xlsx if we want to see the redacted data, but it’s not supposed to happen.