Free Support Forum - aspose.com

FileFormatUtil.detectFileFormat(fileName);

Aspose.Words has com.aspose.words.FileFormatUtil.


What does Aspose.Slides have as a equivalent. Basically I want to do something along the lines of this.

final FileFormatInfo info = FileFormatUtil.detectFileFormat(fileName);

switch (info.getLoadFormat()) {

case LoadFormat.Ppt;

// do something

break;

case LoadFormat.Unknown;

break;

default:

}


I can use FileFormatUtils to map between a file and LoadFormat, but can't find any way of doing that for Aspose.Slides.

Hi John,


Thank you for posting.

I have observed your comments and like to request you to please try using following sample code on your end to serve the purpose.

FileInfo fi = new FileInfo(“D:\Test.ppt”);
switch (fi.Extension.ToLower())
{
case “.ppt”:
{
break;
}
case “.pptx”:
{
break;
}
default:{
break;}
}

I hope this will be helpful. Please share if I may help you further in this regard.

Best Regards,

What language is that? as FileInfo doesn’t exist within the Aspose.Slides Java components? Or is it a new class and if so which release do I need.


If I have to simply check the file extension I’ll do that end.

I just wondered as you have com.aspose.[cells|pdf|slides|words|].LoadFormat I just wonder within slides can I use that and have the file type detected like with Aspose.Words.

Hi John,


I have observed your comments and like to request you to please try using following sample code on your end to serve the purpose.

PresentationInfo pi = com.aspose.slides.PresentationInfo;
switch (pi.getLoadFormat())
{
case LoadFormat.Pptx:
{
break;
}
case LoadFormat.Unknown:
{
break;
}
}

I hope this will be helpful. Please share if I may help you further in this regard.

Best Regards,

Hi John,


I have updated my response as per your requirements. I request you to please visit this page for your kind reference.

I hope this will be helpful. Please share if I may help you further in this regard.

Best Regards,

PresentationInfo looks useful but how do I construct/obtain an instance?


Looking at the doc and class, it might be useful if it links to other pages so I can work out how to use it.

I’ve been hunting for about 45 mins without success.

Hi John,


I have observed your comments and like to share with you that you may create an instance of PresentationInfo as in the code below,

IPresentationInfo info;
info = PresentationFactory.getInstance().getPresentationInfo(“D:\Test.pptx”);


switch (info.getLoadFormat())
{
case LoadFormat.Pptx:
{
break;
}
case LoadFormat.Unknown:
{
break;
}
}

Please share your kind feedback if this code works as per your requirements or not. I hope this will be helpful.

Best Regards,

Cheers, that is exactly what I was after.


Might be useful to have a link to PresentationFactory in the previously linked page regarding PresentationInfo.

Also might be useful to cross reference IPresentationInfo and FileFormatUtil mention they perform similar functionality.

Hi John,


We are glad to know your problem is resolved and things have started working on your end. You may visit this page for your kind reference as this is from Aspose.Slides for Java API references where every Class/Interface has a separate page for its description/explanation. That is why there is no link between pages.

Best Regards,

I understand every Class/Interface is listed, but… if your at the PresentationInfo (http://docs.aspose.com:8082/docs/display/slidesjava/com.aspose.slides.PresentationInfo+class) page how do you know you need to visit the PresentationFactory (http://www.aspose.com/docs/display/slidesjava/com.aspose.slides.PresentationFactory+class) page to work out how you obtain an instance of the PresentationInfo class.


In the first reply you simply mentioned the PresentationInfo class page. How was I to guess that I needed to use the PresentationFactory class to obtain an instance of PresentationInfo.

I’m trying to give feedback from using your product and documentation to the simple issues i’m facing regarding navigation and usage of basic features as well as non standardised components between products.


Hi John,


Thank you for your valuable feedback.

I have observed your comments and I will raise this with our team and then we will decide how we can make it easier to navigate between different classes by cross links.

Best Regards,