xlsx.js导出复杂表格(多表头,嵌套数据)?

     orderTable: [

{

supplierId: 1,

supplierName: '张三',

orderId: 1,

creator: '墨子',

createTime: "2023/4/5",

orderStatus: "进行中",

instmName: '剪子',

qxNum: 2,

gudingPrice: 10,

zhiruList: [

{ itemid: 1, itemName: "物品1", itemPrice: 10, itemNum: 1 },

{ itemid: 2, itemName: "物品2", itemPrice: 10, itemNum: 2 },

],

xiaoji: 10,

zongji: 10

}, {

supplierId: 1,

supplierName: '张三',

orderId: 1,

creator: 'jian',

createTime: "2023/4/5",

orderStatus: "进行中",

instmName: 'ddd',

qxNum: 2,

gudingPrice: 10,

zhiruList: [

{ itemid: 1, itemName: "物品1", itemPrice: 10, itemNum: 1 },

{ itemid: 2, itemName: "物品2", itemPrice: 10, itemNum: 2 },

],

xiaoji: 10,

zongji: 10

},

{

supplierId: 2,

supplierName: '张三',

orderId: 2,

creator: '赤炼',

createTime: "2023/4/5",

orderStatus: "进行中",

instmName: '剑子',

qxNum: 1,

gudingPrice: 10,

zhiruList: [

{ itemid: 1, itemName: "物品1", itemPrice: 10, itemNum: 1 },

{ itemid: 2, itemName: "物品2", itemPrice: 10, itemNum: 2 },

{ itemid: 1, itemName: "物品1", itemPrice: 10, itemNum: 1 },

],

xiaoji: 10,

zongji: 10

}

],

用xlsx.js导出以上结构,表头部分:一级表头zhiruList下嵌套三个二级表头:itemName,itemPrice,itemNum,每行数据中嵌套一个数组


回答:

https://pengchen96.github.io/table-xlsx/docs/tutorial-api/exp...


回答:

如何可以换库的话,可以尝试下 @zurmokeeper/exceljs , 直接内置了导出时设置多表头的API,worksheet.makeColumns 方法,link:

以上是 xlsx.js导出复杂表格(多表头,嵌套数据)? 的全部内容, 来源链接: utcz.com/p/935044.html

回到顶部