Building table dynamically with PDFMake

前端 未结 3 1646
刺人心
刺人心 2020-12-28 10:14

I\'m working with pdfmake to generate pdf with javascript. I\'m trying to build a table dynamically but not works ,this my attempt



        
3条回答
  •  猫巷女王i
    2020-12-28 10:43

    You should make array of column names & values:

    var column = [];
    column.push({ text: 'A', style: 'tableHeader'});
    column.push({ text: 'B', style: 'tableHeader'});
    
    var value = [];
    value.push({ text: 'Asda', style: 'tableHeader'});
    value.push({ text: 'Bsa', style: 'tableHeader'});

    When you make a table, you should do like this.

    table: {
      headerRows: 1,
        body: [
          column, value
        ]
    }

提交回复
热议问题