officefileapi-devexpress-dot-docs-dot-presentation-dot-presentation-dot-savedocument-x28-system-dot-io-dot-stream-devexpress-dot-docs-dot-presentation-dot-documentformat-x29.md
Saves the presentation in the specified format to the given stream.
Namespace : DevExpress.Docs.Presentation
Assembly : DevExpress.Docs.Presentation.v25.2.dll
NuGet Package : DevExpress.Docs.Presentation
public void SaveDocument(
Stream stream,
DocumentFormat documentFormat
)
Public Sub SaveDocument(
stream As Stream,
documentFormat As DocumentFormat
)
| Name | Type | Description |
|---|---|---|
| stream | Stream |
A stream to which the presentation should be saved.
| | documentFormat | DocumentFormat |
The format in which the presentation should be saved.
|
The following code snippet saves a presentation in the POTX format:
using DevExpress.Docs.Presentation;
using System.Drawing;
namespace PresentationApiSample;
public class Program {
public static void Main(string[] _) {
Presentation presentation = new Presentation(File.ReadAllBytes(@"..\..\..\data\Presentation2.pptx"));
//...
FileStream outputStream = new FileStream(@"D:\\presentation.potx", FileMode.Create);
presentation.SaveDocument(outputStream, DocumentFormat.Potx);
outputStream.Dispose();
}
}
Imports DevExpress.Docs.Presentation
Imports System.Drawing
Imports System.IO
Namespace PresentationApiSample
Public Class Program
Public Shared Sub Main(__ As String())
Dim presentation As New Presentation(File.ReadAllBytes("..\..\..\data\Presentation2.pptx"))
'...
Dim outputStream As New FileStream("D:\presentation.potx", FileMode.Create)
presentation.SaveDocument(outputStream, DocumentFormat.Potx)
outputStream.Dispose()
End Sub
End Class
End Namespace
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the SaveDocument(Stream, DocumentFormat) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
office-file-api-ai-implementation/CS/BusinessObjects/Helpers.cs#L190
PresentationDocumentFormat documentFormat = new PresentationDocumentFormat((int)outputFormat);
presentation.SaveDocument(resultStream, documentFormat);
}
See Also
DevExpress Presentation API Library: Create, Load, and Save Presentations