Utilizing Angular DataTable to display a list of data, with alternate row background color and border styles defined.
An issue arises when exporting the Data table to excel as the alternate row style and border styles are lost. Only the raw data is included.
The approach involves using Data Table buttons for this purpose. The following Code snippet showcases the button Options being used:
this.dtOptions = DTOptionsBuilder.newOptions()
.withFnServerData(serverData)
.withDataProp('data')
.withOption('processing', true)
.withOption('serverSide', true)
.withOption('paging', true)
.withOption('autoWidth', false)
.withPaginationType('full_numbers')
.withDisplayLength(rowCount)
.withDOM('lrtip')
.withButtons([
{
extend: "excelHtml5",
filename: "MailItemList",
text: "<i class='fa fa-file-excel-o'></i> Excel",
title: "Mail Item List",
exportOptions: {
columns:[2,3,4,5,6,7,8.9,10,11,12,13,14,15,16,17,18,19,20,21,22]
},
exportData: { decodeEntities: true }
}
]);
Any assistance on this matter would be highly appreciated.