[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.IWorksheet.Save

Save Method

Save(string)

Saves the current worksheet to the specified file.

The output format is inferred from the file name extension.

Declaration
void Save(string fileName)
Sub Save(fileName As String)
Parameters
Type Name Description
string fileName

The output file path.

Examples
worksheet.Range["A1:B2"].Value = new object[,] {
    {"Name", "Score"},
    {"Alice", 100}
};
worksheet.Save("worksheet.xlsx");

Save(string, SaveFileFormat)

Saves current worksheet to the specified format file.

Declaration
void Save(string fileName, SaveFileFormat fileFormat)
Sub Save(fileName As String, fileFormat As SaveFileFormat)
Parameters
Type Name Description
string fileName

The output file path.

SaveFileFormat fileFormat

The file format to use when saving the worksheet.

Examples
worksheet.Range["A1"].Value = "Sample";
worksheet.Save("path/to/output.xlsx", SaveFileFormat.Xlsx);

Save(Stream, SaveFileFormat)

Saves current worksheet to the specified format file stream.

Declaration
void Save(Stream fileStream, SaveFileFormat fileFormat)
Sub Save(fileStream As Stream, fileFormat As SaveFileFormat)
Parameters
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.

Examples
worksheet.Range["A1"].Value = "Sample";
MemoryStream stream = new MemoryStream();
worksheet.Save(stream, SaveFileFormat.Pdf);

Save(string, SaveOptionsBase)

Saves current worksheet to the specified file.

Declaration
void Save(string fileName, SaveOptionsBase options)
Sub Save(fileName As String, options As SaveOptionsBase)
Parameters
Type Name Description
string fileName

The output file path.

SaveOptionsBase options

The options of saving the file.

Examples
worksheet.Range["A1"].Value = "Sample";
PdfSaveOptions options = new PdfSaveOptions();
worksheet.Save("path/to/output.pdf", options);

Save(Stream, SaveOptionsBase)

Saves current worksheet to the specified file stream.

Declaration
void Save(Stream fileStream, SaveOptionsBase options)
Sub Save(fileStream As Stream, options As SaveOptionsBase)
Parameters
Type Name Description
Stream fileStream

The output stream to which the worksheet content is written.

SaveOptionsBase options

The options of saving the file stream.

Examples
worksheet.Range["A1"].Value = "Sample";
MemoryStream stream = new MemoryStream();
PdfSaveOptions options = new PdfSaveOptions();
worksheet.Save(stream, options);