2

I have tried this link for getting multiple headers<code>this is the autotable am getting</code>

    download() {

    var columns = ["ID", "Country", "Rank", "Capital"];
    var data = [
        [1, "Denmark", 7.526, "Copenhagen"],
        [2, "Switzerland",  7.509, "Bern"]
    ];

        var pdfsize = 'a0';
    var doc = new jsPDF('l', 'pt','a0');

     doc.autoTable(columns, data, {
            theme : 'grid',
            styles: {
               halign: 'right'
            },
            headerStyles: {
               fillColor: [33, 150, 243],
               halign:'center',
               lineWidth: 1,
               lineColor: [221, 221, 221]

            },
            columnStyles:{
                 0: {columnWidth: 266}
            },
            margin : {
              top : 100
            }
        });

        var columns2= ["ID","Rank", "Country","Rank", "ID", "Rank","ID",  "Capital"];
        doc.autoTable(columns2, data, {
            theme : 'grid',
            styles: {
               halign: 'right'
            },
            headerStyles: {
               halign:'center',
               lineWidth: 1,
               lineColor: [221, 221, 221]
            },
            margin : {
              top : 120
            },
            columnStyles:{
                 0: {halign:'left'}
            },

        });
     doc.save('table.pdf');    };

}

This is the code i have tried for the jspdf-autotable . I need multiple headers tablethe table how i require like this.I need two headers how do i map those headers together can you please me with this. Am not able to map those headers like as shown in below image.

teja
  • 51
  • 1
  • 8

1 Answers1

0

In v3 multiple headers and colspans/rowspans are supported out of the box so no hacks needed.

Simon Bengtsson
  • 7,573
  • 3
  • 58
  • 87