Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

SpreadsheetControl.SaveDocument(Stream, DocumentFormat, EncryptionSettings) Method

Saves the workbook to a stream, specifying the export format and encryption settings.

Namespace: DevExpress.Xpf.Spreadsheet

Assembly: DevExpress.Xpf.Spreadsheet.v24.2.dll

NuGet Package: DevExpress.Wpf.Spreadsheet

#Declaration

public void SaveDocument(
    Stream stream,
    DocumentFormat format,
    EncryptionSettings encryptionSettings
)

#Parameters

Name Type Description
stream Stream

An object to output the document to.

format DocumentFormat

The format of the exported document.

encryptionSettings EncryptionSettings

Document encryption settings.

#Remarks

Take into account the following when you save a document to a stream:

  • Do not save a workbook to a stream that does not support seek operations. An exception is thrown in this case. Use the System.IO.Stream.CanSeek property to determine if the steam supports seeking.
  • Do not save a workbook to the same stream from which it was loaded. In this case, document bytes are written to the end of the existing stream and an invalid document is produced.
See Also