Hello,
I am using Aspose cells java library. I get a file as input through email. It could be a word document “.docx” or it could be a password protected “.xlsx” file or a pdf file. I will not know previously which file is being sent. I need to correctly identify file type. When A password p protected xlsx file is sent it identfies it as word file.
thhis is code i am using:
com.aspose.words.FileFormatInfo fileInfo = null;
try {
fileInfo = FileFormatUtil.detectFileFormat(filePath);
logger.debug(" file formatInfo : "
+ FileFormatUtil.loadFormatToExtension(fileInfo.getLoadFormat()));
return FileFormatUtil.loadFormatToExtension(fileInfo.getLoadFormat());
} catch (Exception e) {
logger.error(“Error finding word filetype;” + e.getMessage());
}