Skip to content

Accessibility

Accessibility attributes are included in the exported html by default. Here is an example of how to set the aria-label attribute on the exported table:

var exporter = sheet.Cells["B5:M19"].CreateHtmlExporter();
exporter.Settings.Accessibility.TableSettings.AriaLabel = "This html-table is exported from EPPlus";
Dim exporter = sheet.Cells("B5:M19").CreateHtmlExporter()
exporter.Settings.Accessibility.TableSettings.AriaLabel = "This html-table is exported from EPPlus"

This results in:

<table class="epplus-table" role="table" aria-label="This html-table is exported from EPPlus">

If you don't want to include accessibility attributes in the html, set the property below to false:

exporter.Settings.Accessibility.TableSettings.AddAccessibilityAttributes = false;
exporter.Settings.Accessibility.TableSettings.AddAccessibilityAttributes = False

Via the exporter's Settings.Accessibility.TableSettings property you can set the following attributes:

EPPlus attribute Html attribute Html element Default value
AriaLabel aria-label table null
AriaLabelledBy aria-labelledby table null
AriaDescribedBy aria-describedby table null
TableRole role table table
TheadRole role table.thead rowgroup
TbodyRole role table.tbody rowgroup
TfootRole role table.tfoot rowgroup
TableHeaderCellRole role table.thead.tr.th columnheader

See also