Back to Devexpress

Presentation(Byte[]) Constructor

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

latest2.4 KB
Original Source

Presentation(Byte[]) 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(
    byte[] buffer
)
vb
Public Sub New(
    buffer As Byte()
)

Parameters

NameTypeDescription
bufferByte[]

A presentation as a byte array.

|

Remarks

The following code snippet loads a presentation (PPTX file) from a byte array:

csharp
using DevExpress.Docs.Presentation;

namespace PresentationApiSample;

public class Program {
    public static void Main(string[] _) {
        // Load a presentation from a byte array 
        Presentation presentation = new Presentation(File.ReadAllBytes(@"D:\mypresentation.pptx"));
    }
}
vb
Imports DevExpress.Docs.Presentation

Namespace PresentationApiSample

    Public Class Program
        Public Shared Sub Main(__ As String())
            ' Load a presentation from a byte array
            Dim presentation As Presentation = New Presentation(File.ReadAllBytes("D:\mypresentation.pptx"))
        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