How To: Generate a Table With Rows of Data

You can generate a PDF or DOCX document with rows of data by providing the data as a list to the "table_data" attribute. The first column that appears in the table is called a "Pivot" and will be used as the key to identify how the data is merged into the document.

In the following example, we have a simple table with 3 columns. The first column, known as the Pivot, is used to determine which table data is to be placed into. In this example, "ITEM" is our pivot.

Data Syntax:

[
  {
    "ITEM" : [
      {
        "ITEM" : "Red Widget",
        "QUANTITY" : 2,
        "PRICE" : 3.99
      },
      {
        "ITEM" : "Blue Widget",
        "QUANTITY" : 5,
        "PRICE" : 19.99
      },
      {
        "ITEM" : "Widget Repair Kit",
        "QUANTITY" : 1,
        "PRICE" : 10.00
      }
    ]
  }
]

The output document will have 3 rows rendered into the table.

Show Comments