officefileapi-devexpress-dot-docs-dot-presentation-dot-presentation-dot-ctor-x28-system-dot-io-dot-stream-x29.md
Initializes a new instance of the Presentation class with specified settings.
Namespace : DevExpress.Docs.Presentation
Assembly : DevExpress.Docs.Presentation.v25.2.dll
NuGet Package : DevExpress.Docs.Presentation
public Presentation(
Stream stream
)
Public Sub New(
stream As Stream
)
| Name | Type | Description |
|---|---|---|
| stream | Stream |
A stream that contains a presentation.
|
The following code snippet loads a presentation from a stream:
using DevExpress.Docs.Presentation;
namespace PresentationApiSample;
public class Program {
public static void Main(string[] _) {
// Load a presentation from a stream
using (FileStream fs = File.OpenRead(@"D:\mypresentation.pptx")) {
Presentation presentation = new Presentation(fs);
// Do something with the presentation. For example, export it:
presentation.ExportToPdf(new FileStream(@"D:\exported-document.pdf", FileMode.Create));
}
}
}
Imports DevExpress.Docs.Presentation
Namespace PresentationApiSample
Public Class Program
Public Shared Sub Main(__ As String())
' Load a presentation from a stream
Using fs As FileStream = File.OpenRead("D:\mypresentation.pptx")
Dim presentation As Presentation = New Presentation(fs)
' Do something with the presentation. For example, export it:
presentation.ExportToPdf(New FileStream("D:\exported-document.pdf", FileMode.Create))
End Using
End Sub
End Class
End Namespace
Note : If you try to load a corrupted presentation file or file in unsupported format, you get a PresentationUnsupportedFormatException.
For more information, refer to the following help topic: DevExpress Presentation API Library: Create, Load, and Save Presentations.
See Also