pdfmake:一些表格不显示表格标题

pdfmake: Table headers not coming appearing for a few tables

提问人:Vivek 提问时间:5/7/2023 最后编辑:Vivek 更新时间:5/8/2023 访问量:124

问:

我正在尝试创建动态表格内容,它似乎工作正常。内容属于以下类型

    content: [
          {
            text: "5.24011.01.0",
            style: "header",
            pageBreak: "before",
          },
          {
            table: {
              widths: [
                "*",
                "*",
                "*",
                "*",
                "*",
              ],
              headerRows: 1,
              body: [
                [
                  {
                    text: "Assembly",
                    style: "tableHeader",
                  },
                  {
                    text: "Description",
                    style: "tableHeader",
                  },
                  {
                    text: "Reason For Variance",
                    style: "tableHeader",
                  },
                  {
                    text: "Component",
                    style: "tableHeader",
                  },
                  {
                    text: "Scrap Quantity",
                    style: "tableHeader",
                  },
                ],
                [
                  "5.24011.01.0",
                  "Damage",
                  "O600",
                  "7.08982.00.0",
                  3,
                ],
              ],
              margin: [
                5,
                2,
                10,
                20,
              ],
              height: "50px",
            },
          },
          {
            text: "7.09062.05.0",
            style: "header",
            pageBreak: "before",
          },
          {
            table: {
              widths: [
                "*",
                "*",
                "*",
                "*",
                "*",
              ],
              headerRows: 1,
              body: [
                [
                  {
                    text: "Assembly",
                    style: "tableHeader",
                  },
                  {
                    text: "Description",
                    style: "tableHeader",
                  },
                  {
                    text: "Reason For Variance",
                    style: "tableHeader",
                  },
                  {
                    text: "Component",
                    style: "tableHeader",
                  },
                  {
                    text: "Scrap Quantity",
                    style: "tableHeader",
                  },
                ],
                [
                  "7.09062.05.0",
                  "Destructive quality test",
                  "7000",
                  "3.69438.00.0",
                  1,
                ],
              ],
              margin: [
                5,
                2,
                10,
                20,
              ],
              height: "50px",
            },
          },

        ],

挑战在于,虽然第一个表有标题并且工作正常,但第二个表没有:!。

令我彻底失望的是,当我在 pdfmake playground 中尝试相同的代码时,一切似乎都正常工作!

任何建议将不胜感激,因为我已经尝试了许多选择,但似乎没有任何效果!

bTW 我正在使用服务器端代码

let pdfDoc = printer.createPdfKitDocument(docDefinition);

上面提到的在哪里docDefinitionjson

我附上了有问题的表格的屏幕截图

enter image description here

node.js 服务器端 pdfmake

评论


答: 暂无答案