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设置字体,对齐,背景色


基础教程推荐
猜你喜欢
- javascript获取隐藏元素(display:none)的高度和宽度的方法 2024-03-11
- css3动画鼠标放上图片逐渐变大鼠标离开图片逐渐缩小效果 2023-12-29
- 解决 Django 渲染模板 与 Vue {{ }} 冲突 2023-10-08
- table行随鼠标移动变色示例 2023-12-27
- 基于vue实现探探滑动组件功能 2023-12-27
- 在 React 中使用 Redux 解决的问题小结 2024-02-08
- BootStrap栅格系统、表单样式与按钮样式源码解析 2023-12-27
- 原生JS实现LOADING效果 2023-12-01
- vue实现微信浏览器左上角返回按钮拦截功能 2024-02-12
- 大小不固定的图片、多行文字的水平垂直居中实现方法 2023-12-12