Spire.Presentation is a professional PowerPoint® compatible library that enables developers to create, read, write, modify, convert and Print PowerPoint documents. Get free and professional technical support for Spire.Presentation for .NET, Java, Android, C++, Python.

Tue May 24, 2016 2:33 pm

Is there a similar feature to "SaveToStream", like the one available in spire.doc and spire.xls, in spire.presentation? I'm currently evaluating the libraries for a project, and having the ability to save a powerpoint presentation to a stream. As I'm still evaluating the product, I'm using the trial version. I don't know if this has any affect on what functionality is available.

The product version is Spire.Presentation 2.5.22.4040

Any help you can provide is appreciated.

dgh8
 
Posts: 12
Joined: Fri Mar 04, 2016 4:24 pm

Wed May 25, 2016 2:06 am

Hello,

Thanks for your inquiry.
Yes, Spire.Presentation supports to save PowerPoint file to stream. There is a program guide for you reference.

Sincerely,
Caroline
E-iceblue support team
User avatar

caroline.zhang
 
Posts: 291
Joined: Mon Mar 07, 2016 9:22 am

Wed May 25, 2016 8:33 am

Thank you for your reply Caroline, I had already seen the code sample below.

FileStream to_stream = new FileStream("To_stream.pptx", FileMode.Create);
presentation.SaveToFile(to_stream, FileFormat.Pptx2010);
to_stream.Close();

The problem for me is that this approach only works with FileStream, which means that a file has to be created on the file system. What I need is to be able to save the changes into MemoryStream.

In your Spire.Doc and Spire.XLS products you have the following approach, which just reads the item in any stream. Which works nicely for my purposes.
document.SaveToStream(wordFile, document.DetectedFormatType);

This was the basis for this question, is there any way to save a presentation into a stream that doesn't also require saving a copy to the file system at the same time?

Thank you for you help in advance.

dgh8
 
Posts: 12
Joined: Fri Mar 04, 2016 4:24 pm

Wed May 25, 2016 9:44 am

Hi,

Thank you for kind reply.
The method has no difference with SaveToStream() in Spire.Doc or Spire.Xls. It is not olny working with FileStream.
Code: Select all
presentation.SaveToFile(to_stream, FileFormat.Pptx2010);


Sincerely,
Caroline
E-iceblue support team
User avatar

caroline.zhang
 
Posts: 291
Joined: Mon Mar 07, 2016 9:22 am

Wed May 25, 2016 10:53 am

Thanks you for your help Caroline, that did the trick.

dgh8
 
Posts: 12
Joined: Fri Mar 04, 2016 4:24 pm

Thu May 26, 2016 1:11 am

Hello,

Glad to hear that it works for your scenario.
If there is any problem, welcome to give us feedback again.

Sincerely,
Caroline
E-iceblue support team
User avatar

caroline.zhang
 
Posts: 291
Joined: Mon Mar 07, 2016 9:22 am

Return to Spire.Presentation