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 内容,请继续关注编程基础学习网。
编程基础网
本文标题为:vuejs导出excel设置字体,对齐,背景色
基础教程推荐
猜你喜欢
- 关于extjs:在网格上实现beforeedit监听器 2022-09-15
- 一文带你掌握axios 工具函数 2023-12-01
- JavaScript中的方法重载实例 2023-12-01
- CSS多种方式实现底部对齐的示例代码 2023-12-09
- echarts如何实现动态曲线图(多条曲线) 2022-08-30
- css3动画过渡实现鼠标跟随导航效果 2023-12-21
- HTML clearfix清除浮动讲解 2022-11-23
- 详解CSS不定宽溢出文本适配滚动 2022-11-16
- Vue页面中引入img图片使用动态路径import、require 2024-12-07
- HTML语言大全 2024-01-08
