暗号化された Office Open XML のファイル形式の検出 - OOXML ファイル

Contents
[ ]

Aspose.Cells は、暗号化されたファイル形式を検出する方法を提供しますMicrosoft オープン XMLファイル。ファイルの種類を識別するには、FileFormatUtil.detectFileFormat メソッドを以下のコード例に示します。

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
//Source directory
String dataDir = AsposeCellsExamples.Utils.getSharedDataDir(DetectFileFormatOfEncryptedFiles.class) + "TechnicalArticles/";
String filename = dataDir + "encryptedBook1.out.tmp";
FileFormatInfo fileFormatInfo = FileFormatUtil.detectFileFormat(filename,"1234"); // The password is 1234
if(fileFormatInfo.getFileFormatType() == FileFormatType.EXCEL_97_TO_2003) {
System.out.println("File Format: EXCEL_97_TO_2003");
} else if(fileFormatInfo.getFileFormatType() == FileFormatType.PPTX) {
System.out.println("File Format: PPTX");
} else if(fileFormatInfo.getFileFormatType() == FileFormatType.DOCX) {
System.out.println("File Format: DOCX");
}