dolanmiu / docx

Easily generate and modify .docx files with JS/TS with a nice declarative API. Works for Node and on the Browser.
https://docx.js.org/
MIT License
4.24k stars 479 forks source link

Page borders demo not work #2675

Open websashka opened 5 months ago

websashka commented 5 months ago

Related to #1256 https://github.com/dolanmiu/docx/blob/master/demo/71-page-borders-2.ts @dolanmiu, could you check this problem? I check it in use page app, google document. docx version 8.5.0

const doc = new Document({
  sections: [{
    properties: {
      page:{
        borders:{
          pageBorderBottom: {
            style: BorderStyle.SINGLE,
            size: 2*8, //2pt;
            color: '000000',
          },
          pageBorderLeft: {
            style: BorderStyle.SINGLE,
            size: 1*8, //1pt;
            color: '000000',
          },
          pageBorderRight: {
            style: BorderStyle.SINGLE,
            size: 1*8, //1pt;
            color: 'FF00AA',
          },
          pageBorderTop: {
            style: BorderStyle.SINGLE,
            size: 1*8, //1pt;
            color: '000000',
          },

          pageBorders: {
            display: "allPages", //https://docx.js.org/api/enums/PageBorderDisplay.html
            offsetFrom: "text", //https://docx.js.org/api/enums/PageBorderOffsetFrom.html
            zOrder: "front" //https://docx.js.org/api/enums/PageBorderZOrder.html
          }
        }
      },
    },
    children: [
      new Paragraph({
        children: [
          new TextRun({ text: `Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.`})
        ]
      }),
      new Paragraph({
        children: [
          new TextRun({ text: `Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.`})
        ]
      })
    ]
  }],
});