[]
Represents options for saving a workbook as an .xlsx file.
Use this class to control how workbook content is exported to the XLSX format. It supports settings for password protection, shared formula export, compact mode, formula handling, binding source export, auto-merged cells, and excluding unused styles, names, or empty region cells to reduce file size.
public class XlsxSaveOptions : SaveOptionsBase
Public Class XlsxSaveOptions
Inherits SaveOptionsBase
string password = GetWorkbookPassword();
XlsxSaveOptions options = new XlsxSaveOptions();
options.Password = password;
options.ExcludeUnusedStyles = true;
options.ExportSharedFormula = false;
workbook.Save("path/to/output.xlsx", options);
| Name | Description |
|---|---|
| XlsxSaveOptions() | Constructor. |
| Name | Description |
|---|---|
| ExcludeEmptyRegionCells | Gets or sets whether to exclude empty cells outside the used data range when saving the workbook. Empty cells in this context are cells that contain no data or only style information. The default value is false. |
| ExcludeUnusedNames | Gets or sets whether user-defined but unused defined names are excluded when saving the workbook to an XLSX file. If this property is true, unused defined names are omitted during export. The default value is false. |
| ExcludeUnusedStyles | Gets or sets whether user-defined but unused cell styles are excluded when saving the workbook to an XLSX file. If this property is true, user-defined cell styles that are never applied in the workbook are omitted during export. The default value is false. |
| ExportSharedFormula | Gets or sets whether to export shared formulas when saving the workbook. Shared formula export is enabled by default. This option can be useful when working with third-party libraries that do not support shared formulas. |
| IgnoreFormulas | Gets or sets whether formula cells are treated as value cells when saving to an .xlsx file. When this property is true, formula cells are exported as value cells in Excel instead of preserving their formulas. |
| IncludeAutoMergedCells | Gets or sets whether to include automatically merged cells when saving a file. The default value is false. |
| IncludeBindingSource | Gets or sets whether to include the binding source when saving the file. This option controls whether bound data is exported when the workbook is saved. The default value is true. |
| IsCompactMode | Gets or sets whether to save the workbook in compact mode. When this option is true, the generated .xlsx content is written in a more compact form. The default value is false. |
| Password | Gets or sets the password used to encrypt the saved xlsx file. Use this property to configure password protection before saving a workbook. |