Skip to content

Settings

Via the Settings property on the exporter you can control how the html and css are exported. For how to create an exporter, see HTML & CSS.

Exporter.Settings

Property Data type Default value Description
TableId string null id of the table html element.
Minify bool true If true the html will not contain indents and linebreaks.
HiddenRows eHiddenState Exclude Controls how hidden cells are exported. One of the following: Exclude, IncludeButHide, Include.
HorizontalAlignmentWhenGeneral eHtmlGeneralAlignmentHandling CellDataType Controls alignment when a cell's style is set to General. One of the following: DontSet (no alignment is set), ColumnDataType (if the column data type is numeric or date, alignment will be right, otherwise left), CellDataType (if the cell value data type is numeric or date, alignment will be right, otherwise left).
Accessibility AccessibilitySettings N/A See Accessibility.
AdditionalTableClassNames List<string> The list is empty Additional class names that will be added to the class attribute of the exported tables.
Culture CultureInfo CurrentCulture The culture used when formatting the cell output.
Encoding Encoding Encoding.UTF8 Encoding for the output.
SetColumnWidth bool false Set the column width for columns in the table via the columngroup/col element. Columns with the default width will have the default column width class set. Columns with custom column width will have the width set directly via the style attribute.
SetRowHeight bool false Set the row height for rows in the table. Rows with the default height will have the default row height class set. Rows with custom row height will have the height set directly via the style attribute.
StyleClassPrefix string epp- Prefix for style classes added by EPPlus.
CellStyleClassName string s The name used for cell style css classes. Cell style css classes will be named {StyleClassPrefix}{CellStyleClassName}{index}.
IncludePictures bool false If pictures in cells should be included.
IncludeCssClassNames bool true If true the exported html will include css class names that refer to the exported css.
RenderDataAttributes bool true If true raw cell data values will be included in the data-value attribute.
RenderDataTypes bool true If true data types will be included in the data-datatype attribute.

Css settings

The Settings.Css property controls the css output.

Property Data type Default value Description
CssExclude CssExclude Properties to exclude specific styles from the css.
AdditionalCssElements Dictionary<string,string> empty Add additional css elements to the default table style. For example exporter.Settings.Css.AdditionalCssElements.Add("font-family", "verdana");
IncludeSharedClasses bool true If the css should include shared styles used for the exported table.
IncludeNormalFont bool true If the normal font name and size should be included in the css for the table.
IndentValue float 2 The value for indented cells.
IndentUnit string em The unit for indented cells.

Picture settings

Pictures/images are not exported per default, but this can be enabled via the Settings.Drawings.Pictures property:

exporter.Settings.Drawings.Pictures.Include = ePictureInclude.Include;
exporter.Settings.Drawings.Pictures.Include = ePictureInclude.Include

The ePictureInclude enum has three members: Exclude (pictures will not be included), IncludeInCssOnly (pictures will be included in css only, so they can be added manually) and Include.

These are the properties you can set via Settings.Drawings.Pictures:

Property Data type Default value Description
Include ePictureInclude Exclude Sets if and how pictures should be included.
Position ePicturePosition Relative Possible values: DontSet, Absolute or Relative.
AddMarginTop bool false If the margin in pixels from the top corner should be used.
AddMarginLeft bool false If the margin in pixels from the left corner should be used.
KeepOriginalSize bool false If set to true the original size of the image is used, otherwise the size in the workbook is used.
CssExclude PictureCssExclude N/A With this property you can exclude certain parts from the exported css, such as border and alignment.

Settings.Pictures is obsolete

In earlier versions the picture settings were accessed via Settings.Pictures. This property is obsolete, use Settings.Drawings.Pictures instead.