【发布时间】:2021-08-24 15:52:41
【问题描述】:
这实际上是 3 列表,我需要最后三行应该是两列,这意味着 colspan 2 , 我们如何将 colspan 用于某些行? 这是表结构和代码
--------------------------------
| Si | item | Amount |
--------------------------------
| 1 | Keyboard | 10 $ |
| 2 | Mouse | 5 $ |
--------------------------------
this.cols.push({si:"1",itm:"keyboard",amt:"10"})
this.cols.push({si:"2",itm:"Mouse",amt:"5"})
var columns = [
{title: "Si.", dataKey: "si"},
{title: "Item", dataKey: "itm"},
{title: "Amount", dataKey: "amt"},
]
var a = doc.autoTable(columns, this.cols, {
theme: 'striped',
styles: {
lineWidth: 0.2,
lineColor: 0,
fontSize:8
},
headerStyles: {
fillColor: 230,
textColor:0,
fontStyle:'normal',
halign: 'center'
},
margin: {top: 92},
columnStyles:{
value_usd: {halign: 'right'},
value_aed: {halign: 'right'}
}
});
预期的结果:
--------------------------------
| Si | item | Amount |
--------------------------------
| 1 | Keyboard | 10 $ |
| 2 | Mouse | 5 $ |
--------------------------------
| Total | 15 $ |
--------------------------------
| VAT | 5% |
--------------------------------
| Grand Sum | 15.75 |
【问题讨论】:
标签: javascript jspdf jspdf-autotable