Back to Devexpress

ISpreadsheetComponent.SaveDocument(Stream, DocumentFormat) Method

officefileapi-devexpress-dot-spreadsheet-dot-ispreadsheetcomponent-dot-savedocument-x28-system-dot-io-dot-stream-devexpress-dot-spreadsheet-dot-documentformat-x29.md

latest3.1 KB
Original Source

ISpreadsheetComponent.SaveDocument(Stream, DocumentFormat) Method

Saves the document to a stream, specifying the document format.

Namespace : DevExpress.Spreadsheet

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
void SaveDocument(
    Stream stream,
    DocumentFormat format
)
vb
Sub SaveDocument(
    stream As Stream,
    format As DocumentFormat
)

Parameters

NameTypeDescription
streamStream

The Stream object to output the document to.

| | format | DocumentFormat |

One of the DocumentFormat enumeration values.

|

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.

asp-net-web-forms-spreadsheet-download-file-on-custom-ribbon-item-click/CS/ASPxSpreadsheetBinding/Default.aspx.cs#L30

csharp
using (var stream = new MemoryStream()) {
    Spreadsheet.Document.SaveDocument(stream, DocumentFormat.Xlsx);
    Response.Clear();

asp-net-web-forms-spreadsheet-download-file-on-custom-ribbon-item-click/VB/ASPxSpreadsheetBinding/Default.aspx.vb#L40

vb
Using stream = New MemoryStream()
    Spreadsheet.Document.SaveDocument(stream, DocumentFormat.Xlsx)
    Response.Clear()

See Also

LoadDocument

ISpreadsheetComponent Interface

ISpreadsheetComponent Members

DevExpress.Spreadsheet Namespace