ComponentOne Excel for .NET
C1.Excel Assembly / C1.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 System.IO.Stream _
    ) 
    public void Save( 
       System.IO.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