Free Support Forum - aspose.com

Detection of .pot files (622)

Hi,

I’m using PresentationFactory.getInstance().getPresentationInfo(“filePath”).getLoadFormat() to determine presentation format. It works fine for all formats except the .pot format. It always returns 1, which is LoadFormat.Ppt.

Is there any other method to determine presentation format? In other Aspose libraries (Words, Cells, Diagram) there is FileFormatUtil.detectFileFormat() method which returns the information about file format, but I couldn’t find this utility class in Aspose.Slides library.

Here are some .pot files I used for testing: pot.zip (2.8 MB)

And the code:

IPresentationFactory presentationFactory = PresentationFactory.getInstance();

System.out.println("POT:");

File dir = new File("pot_files");

for (File file : dir.listFiles()) {
    System.out.println(presentationFactory.getPresentationInfo(file.getAbsolutePath()).getLoadFormat());
}

I’m using Aspose.Slides for Java 18.3.

Thanks,
Zeljko

@Zeljko,

I have observed your requirements and like to share that a similar requirement has been shared in past as well. Actually, there is no difference between PPT and POT formats. It is possible to use SaveFormat.PPT. Just use a file name with .POT extension. Therefore, you get 1(PPT) from getLoadFormat() method on loading POT presentation. I also suggest you to please visit this API reference link for possible LoadFormat types as well. I hope the shared elaboration will be helpful.

Hi Mudassir,

In the Aspose.Words library there is a difference between .doc and .dot formats. And we’re able to distinguish between these two (LoadFormat API ref link). Is it safe to consider .ppt and .pot as the same format?

Thanks,
Zeljko

@Zeljko,

We have internally verified this on our end and can confirm that there is no difference between PPT and POT files. So, it is safe that you save the file name as abc.pot by using same format as that of PPT.