Click or drag to resize
ExcelFileSave Method (String)
Saves the spreadsheet to a file with the specified path.

Namespace:  GemBox.Spreadsheet
Assembly:  GemBox.Spreadsheet (in GemBox.Spreadsheet.dll) Version: 41.3.30.1033
Syntax
public void Save(
	string path
)

Parameters

path
Type: SystemString
The path to which to save the spreadsheet.
Remarks
File extension that is extracted from the path is used to create the appropriate SaveOptions derived class instance that is then passed to the Save(String, SaveOptions) method.

Following file extensions are supported:

  • Microsoft Excel: .xlsx, xlsm, .xltx, .xltm, .xls, .xlt
  • OpenDocument Spreadsheet: .ods, .ots
  • Character Separated Values: .csv, .tsv
  • HyperText Markup Language: .htm, .html, .mht, .mhtml
  • Portable Document Format: .pdf
  • XML Paper Specification: .xps
  • Image: .bmp, .gif, .jpg, .jpeg, .png, .tif, .tiff, .wdp
Examples

Following code demonstrates different ways of saving ExcelFile to specified file format.

// Saves the spreadsheet to a file with the specified path
ef.Save("Report.xlsx");

using (FileStream stream = new FileStream("Report.pdf", FileMode.Create))
{
    // Saves file to the stream
    ef.Save(stream, SaveOptions.PdfDefault);
}

// Saves the file using specified save options
ef.Save("Report.html", new HtmlSaveOptions
{
    SelectionType = SelectionType.EntireFile
});
See Also