1.5.1 • Published 1 year ago

gupo-xlsx-populate v1.5.1

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

gupo-xlsx-populate

基于xlsx-populate进行封装,通过简单的调用方式实现导出Excle文件

安装

yarn

yarn add gupo-xlsx-populate

npm

npm install gupo-xlsx-populate

举个栗子

import ExportExcel from "gupo-xlsx-populate";

ExportExcel({
  dataConfig: {
    rule_id: "规则ID",
    name: "规则名称",
    des: "规则描述",
  },
  dataSource: [
    {
      rule_id: 4045,
      name: "被申请机构名称是否存在验证",
      des: "被申请机构名称是否存在验证",
    },
    {
      rule_id: 4046,
      name: "被申请机构名称是否null验证",
      des: "被申请机构名称是否null验证",
    },
  ],
  stripe: true,
  border: true,
  rowHeight: 30,
  columnWidth: 30,
});

API参考

参数名称类型描述
nameString导出的表格名称,默认时间戳
dataConfigObject、Array数据源配置
dataSourceArray数据源
stripeBoolean是否为斑马纹,默认'false'
borderBoolean是否带有边框,默认'false'
wrapTextBoolean是否换行,默认'false'
rowHeightNumber行高,默认自适应
columnWidthNumber列宽,默认自适应
verticalAlignmentString单元格垂直居中,可选值: 'top', 'center', 'bottom', 'justify', 'distributed',默认'center'
horizontalAlignmentString单元格水平居中,可选值: 'left', 'center', 'right', 'fill', 'justify', 'centerContinuous', 'distributed',默认'left'

dataConfigArray

参数名称类型描述
labelString表头名称
propString数据配置
setValueFunction数据配置方法
......支持传入xlsx-populate所支持的样式显示,参考文档