[]
Saves the worksheet to a file.
public void Save(string fileName)
Public Sub Save(fileName As String)
| Type | Name | Description |
|---|---|---|
| string | fileName | Name of the file to save. |
<p>The format used to save the file is automatically determined by the
file name extension. "Xlsx" and "zip" files are saved as OpenXml; all others are saved as Biff8 files ("xls").
If the file can't be created, an exception is thrown. This typically indicates that the file is currently open by another application (such as Microsoft Excel).
Saves the worksheet to a file.
public void Save(string fileName, FileFormat format)
Public Sub Save(fileName As String, format As FileFormat)
| Type | Name | Description |
|---|---|---|
| string | fileName | Name of the file to save. |
| FileFormat | format | C1.WPF.Excel.C1XLBook.FileFormat value that specifies the type of file to save. |
Saves the worksheet into a stream.
public void Save(Stream stream)
Public Sub Save(stream As Stream)
| Type | Name | Description |
|---|---|---|
| Stream | stream | Stream where the worksheet is saved. |
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.
The code below saves a C1XLBook into a 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);
Saves the worksheet into a stream.
public void Save(Stream stream, FileFormat format)
Public Sub Save(stream As Stream, format As FileFormat)
| Type | Name | Description |
|---|---|---|
| Stream | stream | Stream where the worksheet is saved. |
| FileFormat | format | C1.WPF.Excel.C1XLBook.FileFormat value that specifies the format to save the worksheet in. |