我有一个导出到Excel的表。 导出到Excel时如何更改标题行的背景颜色?
这是我的代码:
exportExcel() {
var row = new Array();
var header;
//Get header
this.data.forEach(data => {
header = Object.keys(data);
});
row.push(header);
//Push data
this.data.forEach(data => {
let dataProps = Object.values(data);
row.push(dataProps);
});
const ws: XLSX.WorkSheet = XLSX.utils.aoa_to_sheet(row);
const wb: XLSX.WorkBook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
XLSX.writeFile(wb, 'export.xlsx');
}