#2832·pdfmake

fillColor of nested tables not being applied when unbreakable is true

Author: bobsquitoCreated Jan 11, 2025Updated Apr 2, 2026
Labelstablepage

When I run the following code, it should create a table with 1 column and 2 rows

  • one has row "Heading" with a grey fillColor
  • the second row has a fillColor "red" and contains a nested table which is just one cell with the word "Tag".
  • The fillColor of the is green.

When unbreakable = true (as shown in the code below), the fillColor is red (unexpected behaviour) instead of green (expected behaviour). I have not been able to set the fillColor of the tag using the table layout, changing the opacity, nothing works.

When unbreakable is set to false, or removed, the fillColor of the tag is green (expected behaviour).

There does seem to be another bug when the table is set to unbreakable = true and the table is over 1 page in length , the table just disappears. This is sort of documented already in #1159

The following code can be added to the playground.

var dd = {
  unbreakable: true,
  table: {
    body: [
      [
        {
          stack: [{ text: 'Heading' }],
          fillColor: 'grey',
        },
      ],
      [
        {
          fillColor: 'red',
          stack: [
            {
              fillColor: 'green',
              table: {
                body: [[{ text: 'Tag' }]],
                widths: ['auto'],
              },
            },
          ],
        },
      ],
    ],
    widths: ['100%'],
  },
};