[]
Saves the current worksheet to the specified file.
The output format is inferred from the file name extension.
void Save(string fileName)
Sub Save(fileName As String)
| Type | Name | Description |
|---|---|---|
| string | fileName | The output file path. |
worksheet.Range["A1:B2"].Value = new object[,] {
{"Name", "Score"},
{"Alice", 100}
};
worksheet.Save("worksheet.xlsx");
Saves current worksheet to the specified format file.
void Save(string fileName, SaveFileFormat fileFormat)
Sub Save(fileName As String, fileFormat As SaveFileFormat)
| Type | Name | Description |
|---|---|---|
| string | fileName | The output file path. |
| SaveFileFormat | fileFormat | The file format to use when saving the worksheet. |
worksheet.Range["A1"].Value = "Sample";
worksheet.Save("path/to/output.xlsx", SaveFileFormat.Xlsx);
Saves current worksheet to the specified format file stream.
void Save(Stream fileStream, SaveFileFormat fileFormat)
Sub Save(fileStream As Stream, fileFormat As SaveFileFormat)
| Type | Name | Description |
|---|---|---|
| Stream | fileStream | The output stream to which the worksheet content is written. |
| SaveFileFormat | fileFormat | The file format to use when saving to the stream. |
worksheet.Range["A1"].Value = "Sample";
MemoryStream stream = new MemoryStream();
worksheet.Save(stream, SaveFileFormat.Pdf);
Saves current worksheet to the specified file.
void Save(string fileName, SaveOptionsBase options)
Sub Save(fileName As String, options As SaveOptionsBase)
| Type | Name | Description |
|---|---|---|
| string | fileName | The output file path. |
| SaveOptionsBase | options | The options of saving the file. |
worksheet.Range["A1"].Value = "Sample";
PdfSaveOptions options = new PdfSaveOptions();
worksheet.Save("path/to/output.pdf", options);
Saves current worksheet to the specified file stream.
void Save(Stream fileStream, SaveOptionsBase options)
Sub Save(fileStream As Stream, options As SaveOptionsBase)
| Type | Name | Description |
|---|---|---|
| Stream | fileStream | The output stream to which the worksheet content is written. |
| SaveOptionsBase | options | The options of saving the file stream. |
worksheet.Range["A1"].Value = "Sample";
MemoryStream stream = new MemoryStream();
PdfSaveOptions options = new PdfSaveOptions();
worksheet.Save(stream, options);