'how to show two rows on table pdfmake.js in ionic 3

I have a problem making pdf files ionic with pdfmake.js. because the data I use is in the form of arrays.This is my first data

First data

screen shot

but if i run function create pdf like this :

createPdf() {
  var docDefinition = {
      content: [
        {
          table: 
          {
            body:this.score2,
          }
        },
      ],
      styles: {}
  }
  this.pdfObj = pdfMake.createPdf(docDefinition);
}

y data change like this the data change after i run function create pdf given below:

The data change

Screen shot

And this is my pdf print print pdf how to make 2 row in my table given below ?

Print pdf

Screen shot



Solution 1:[1]

You can do it like this:

       const bodyData: any[] = [];

       // Here change bodyColumns to your columns array
       bodyData.push(bodyColumns);

       // Here change bodyRowsData to your rows array And then assign this body to your table body

       const body = bodyData.concat(bodyRowsData);

       

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 H S Progr