Pptm presentation

Hi,

How can I distinguish between pptx to pptm presentation with out knowing the file’s suffix?

Thank you
Shai

Hi Shai,

Thank you for your interest in Aspose.Slides.

I have observed your comments but I am unable to understand it completely. Please let us know if you want to check the file type by using code, or you are inquiring about the difference between these two file types. You can check for the file type as in the code below and this link contains the information about pptm file type.

Presentation pres = new Presentation(path);
FileInfo fi = new FileInfo(path);

switch (fi.Extension.ToLower())
{
    case ".pptm":
        {
            Console.WriteLine("It's a pptm file");
            break;
        }

    case ".pptx":
        {
            Console.WriteLine("It's a pptx file");
            break;
        }
}

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

Best Regards,

Hi,
Thank you for your reply.
I need to open a power point file change it and save it.
my problem is that I cann’t rely on the file extension to know file format (the user can give me impersonated file).
So when I save the file :
Doc.Save(FileName, Aspose.Slides.Export.SaveFormat…
I don’t know if to save as pptx or pptm

Hi Shai,

I have observed the requirements shared by you and like to share that you can get the file format using Aspose.Slides without even loading the presentation. I suggest you to please try using the following sample code on your end to serve the purpose in this regard.

LoadFormat format = PresentationFactory.Instance.GetPresentationInfo(“test.pptm”).LoadFormat;

It will return “LoadFormat.Unknown” for invalid format.

Many Thanks,