We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Save Presentation in the original format and without knowing SaveFormat

Hi Support,


I would like to save a file in its original format. Before it was possible to use: presentation.Write(path) or presentation.Write(stream) to save in the original format. Theses methods have been removed and are not accessible in the latest version 14.3.0.

I read the article : Saving a presentation but it is assumed that the type is known.
To save a presentation I saw that the following methods are available :
- public void Save ( String fname, SaveFormat format )
- public void Save ( Stream stream, SaveFormat format )

How could I save the file without knowing SaveFormat ? Is there another way to save a document in its original format and without knowing the file format ?

Thank you.
Lea.

Hi Lea,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Yes, the option to save the presentation file using the Write method to its source format has been removed in the latest version of Aspose.Slides for .NET. However, you can use Presentation.SourceFormat to check the source format of your presentation before saving it. Please refer to the below code for reference:

//Instantiate Presentation class that represents PPTX file

Presentation pres = new Presentation("c:\\data\\test.pptx");

//Your Code Here

switch (pres.SourceFormat)

{

case SourceFormat.Ppt:

//Write PPTX to Disk

pres.Save("c:\\data\\output.ppt", Aspose.Slides.Export.SaveFormat.Ppt);

break;

case SourceFormat.Pptx:

//Write PPTX to Disk

pres.Save("c:\\data\\output.pptx", Aspose.Slides.Export.SaveFormat.Pptx);

break;

}

Thanks & Regards,

Hi Owais,


Thank you for your answer.

I have seen the SourceFormat property, but for a pptm file the value is of SourceFormat is Pptx and It exists a SaveFormat Aspose.Slides.Export.SaveFormat.Pptm. I think that if I save a pptm file as a pptx I will probably lose data, such as macros.

Is there any other solution available ?

Thank you.
Lea.

Hi Lea,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

<o:p> </o:p>

I am afraid currently the Presentation.SourceFormat doesn’t contain
a value for PPTM file. I have created an issue in our issue tracking system
with issue id: SLIDESNET-35403. Our development team will further look into it.
<o:p></o:p>

<o:p> </o:p>

Thank You & Best Regards, <o:p></o:p>

Hi Owais,


Thank you.

Is it possible to have the old presentation.Write(stream) back? Or something similar to save the file in the original format? Adding Pptm to Presentation.SourceFormat would not be enough as I work with all kind of presentation.

Thank you for your help.

Lea.

Hi Lea,

Well, as we have made significant structural changes in our new unified API, it may not be possible for us to bring back the Presentation.Write method. However, I have requested the development team to further check if they can support all the input formats for Presentation.SourceFormat. We will update you once we have any feedback from development side.

Thanks & Regards,