vuejs导出excel设置字体,对齐,背景色 发布时间:2025/01/16 xlsx基础版本不能设置样式,所有需要使用xlsx-style替代npm install –save xlsx //引入XLSXStyle import XLSXStyle from 'xlsx-style' 复制代码 设置字体,对齐,背景色 let style = { // 表头样式 header: { font: { sz: 10, color: { rgb: "ff0000" }, bold: true }, alignment: { horizontal: "center", vertical: "center", wrapText: true }, fill: { bgColor: { indexed: 64 }, fgColor: { rgb: "FFFF00" }}, }, // 内容样式 content: { font: { sz: 11 }, alignment: { horizontal: "center", vertical: "center", wrapText: true }, }, // 注释行样式 trips: { font: { sz: 10, bold: true }, alignment: { vertical: "center", wrapText: true }, fill: { bgColor: { indexed: 64 }, fgColor: { rgb: "00B050" }} } }; sheet['A1'].s = style.header; 复制代码 以上是编程学习网小编为您介绍的“vuejs导出excel设置字体,对齐,背景色”的全面内容,想了解更多关于 vuejs 内容,请继续关注编程基础学习网。