docx 属性“addSection”是私有的,只能在类“File”中访问

问题描述 投票:0回答:1

const versionList = Object.keys(releaseNote) for (versionList 的 const 键) { // 如果没有选择该版本的发行说明进行挑选,则跳过该版本。 const shouldIninclude =cherryPick[key].some(Boolean) 如果(!应该包括){ 继续 }

// Add version title
doc.addSection({
  properties: {},
  children: [
    new Paragraph({
      children: [
        new TextRun({
          text: key,
          bold: true,
          size: 16,
        }),
      ],
    }),
  ],
})

// Iterate over each release note in the current version.
for (let i = 0; i < releaseNote[key].length; i++) {
  // Check if that release note is selected or not
  if (cherryPick[key][i]) {
    // Add a bullet point before each release note.
    doc.addSection({
      properties: {},
      children: [
        new Paragraph({
          children: [
            new TextRun({
              text: '•',
              bold: true,
            }),
            new TextRun({
              text: releaseNote[key][i],
            }),
          ],
        }),
      ],
    })
  }
}

我正在尝试添加一个部分,但这不起作用,任何解决方案

javascript next.js docx
1个回答
0
投票

我也在努力寻找解决方案。有一种情况,但不太酷。

 const doc = new Document({
  sections: [
  // Your sections
  ],
});

© www.soinside.com 2019 - 2024. All rights reserved.