Back to Devexpress

Presentation(Stream) Constructor

officefileapi-devexpress-dot-docs-dot-presentation-dot-presentation-dot-ctor-x28-system-dot-io-dot-stream-x29.md

latest2.8 KB
Original Source

Presentation(Stream) Constructor

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

Declaration

csharp
public Presentation(
    Stream stream
)
vb
Public Sub New(
    stream As Stream
)

Parameters

NameTypeDescription
streamStream

A stream that contains a presentation.

|

Remarks

The following code snippet loads a presentation from a stream:

csharp
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));
        }
    }
}
vb
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

Presentation Class

Presentation Members

DevExpress.Docs.Presentation Namespace