Back to Devexpress

Presentation.SaveDocument(Stream, DocumentFormat) Method

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

latest3.8 KB
Original Source

Presentation.SaveDocument(Stream, DocumentFormat) Method

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

Declaration

csharp
public void SaveDocument(
    Stream stream,
    DocumentFormat documentFormat
)
vb
Public Sub SaveDocument(
    stream As Stream,
    documentFormat As DocumentFormat
)

Parameters

NameTypeDescription
streamStream

A stream to which the presentation should be saved.

| | documentFormat | DocumentFormat |

The format in which the presentation should be saved.

|

Remarks

The following code snippet saves a presentation in the POTX format:

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

csharp
PresentationDocumentFormat documentFormat = new PresentationDocumentFormat((int)outputFormat);
    presentation.SaveDocument(resultStream, documentFormat);
}

See Also

DevExpress Presentation API Library: Create, Load, and Save Presentations

Presentation Class

Presentation Members

DevExpress.Docs.Presentation Namespace