暗号化されたOffice Open XMLファイルのファイル形式を検出する
Contents
[
Hide
]
Office Open XML (またはOOXML、Microsoft Open XML(MOX)としても知られる)は、Microsoftによって開発されたXMLベースのファイル形式で、スプレッドシート、チャート、プレゼンテーション、ワード処理などのオフィスドキュメントを表現するために使用されます。
Aspose.Cellsには、暗号化されたMicrosoft Open XMLファイルのファイル形式を検出する方法が提供されています。ファイルのタイプを特定するには、以下のコード例に示すようにFileFormatUtil.detectFileFormatメソッドを使用します。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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"); | |
} |