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:
public void Save(
	string path


Type: SystemString
The path to which to save the spreadsheet.
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

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

// Saves the spreadsheet to a file with the specified path

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