Excel for WPF | ComponentOne
C1.WPF.Excel Namespace / C1XLBook Class / Save Method / Save(Stream) Method
System.IO.Stream where the worksheet is saved.
Example

In This Topic
    Save(Stream) Method
    In This Topic
    Saves the worksheet into a stream.
    Syntax
    'Declaration
     
    
    Public Overloads Sub Save( _
       ByVal stream As Stream _
    ) 
    public void Save( 
       Stream stream
    )

    Parameters

    stream
    System.IO.Stream where the worksheet is saved.
    Remarks
    This method allows saving the workbook directly into streams without using temporary files. Typical uses include saving books to web page response streams or mail attachment streams.
    Example
    The code below saves a C1XLBook into a System.IO.MemoryStream, clears the book, then loads it back from the same stream.
    // save book into new MemoryStream
    MemoryStream ms = new MemoryStream();
    _book.Save(ms);
                
    // clear book
    _book.Clear();
                
    // load it back from the MemoryStream
    ms.Position = 0;
    _book.Load(ms);
    See Also