Click or drag to resize
XlsxSaveOptions Class
Represent options for saving to XLSX file format (Microsoft Excel Open XML Spreadsheet; Excel 2007 and later).
Inheritance Hierarchy

Namespace: GemBox.Spreadsheet
Assembly: GemBox.Spreadsheet (in GemBox.Spreadsheet.dll) Version: 41.3.30.1000
Syntax
public sealed class XlsxSaveOptions : SaveOptions

The XlsxSaveOptions type exposes the following members.

Constructors
  NameDescription
Public methodXlsxSaveOptions
Initializes a new instance of the XlsxSaveOptions class.
Top
Properties
  NameDescription
Public propertyContentType
Gets the content-type for XLSX file format:
  • application/vnd.openxmlformats-officedocument.spreadsheetml.sheet if Type is Xlsx,
  • application/vnd.ms-excel.sheet.macroenabled.12 if Type is Xlsm,
  • application/vnd.openxmlformats-officedocument.spreadsheetml.template if Type is Xltx,
  • application/vnd.ms-excel.template.macroenabled.12 if Type is Xltm.
(Overrides SaveOptionsContentType.)
Public propertyLimitations
Gets limitations for saving to XLSX file format.
(Overrides SaveOptionsLimitations.)
Public propertyPassword
Gets or sets the password used to protect / encrypt the workbook.
Public propertyType
Specifies type of generated file. Set this property only if you want to override default type.
Top
Examples

Following code demonstrates how to save ExcelFile to XLSX (Excel 2007+) file format.

// Save file as .xlsx file
ef.Save("Report.xlsx");

// Save file as .xlsm file
ef.Save("Report.xlsm");

using (FileStream stream = new FileStream("Report.xlsx", FileMode.Create))
{
    // Save file to stream
    ef.Save(stream, SaveOptions.XlsxDefault);
}

using (FileStream stream = new FileStream("Report.xltx", FileMode.Create))
{
    // Save .xltx file to stream
    ef.Save(stream, new XlsxSaveOptions()
    {
        Type = XlsxType.Xltx
    });
}
See Also