docxtemplater icon indicating copy to clipboard operation
docxtemplater copied to clipboard

LibreOffice Manual Page Breaks

Open jcalfee opened this issue 2 years ago • 3 comments

Environment

  • Version of docxtemplater : 3.34.1
  • Used docxtemplater-modules : none
  • Runner : Node.JS v14
  • libreoffice7.3

How to reproduce my problem :

My template is the following : multidoc.zip

  Length      Date    Time    Name
---------  ---------- -----   ----
        0  2023-02-18 19:18   multidoc/
     6356  2023-02-18 18:29   multidoc/input.docx
      461  2023-02-18 18:41   multidoc/render.js
       71  2022-07-12 08:43   multidoc/nodemon.json
     7382  2023-02-18 19:13   multidoc/output-expected.docx
    23374  2023-02-18 18:41   multidoc/output.docx
const fs = require('fs')
const Docxtemplater = require('docxtemplater')

const content = fs.readFileSync(__dirname + "/input.docx", "binary")

const PizZip = require('pizzip')
const zip = new PizZip(content)

const doc = new Docxtemplater(zip)

doc.render({
  Letters: [null, null] // Two
})

const buf = doc.getZip().generate({type: 'nodebuffer'})

const template = __dirname + '/output.docx'
console.log(`writing ${template}`)
fs.writeFileSync(template, buf)

I would expect it to :

Recognize LibreOffice Manual Page Breaks

  • page styles mirror the input.docx
  • page number resets mirror the input.docx
  • works in a loop

image

walk through video multidoc.zip

jcalfee avatar Feb 19 '23 01:02 jcalfee

I will be going in the detail of the video if what I suggest does not work, but my main idea would be to try to use the paragraphLoop option :

like this :

const doc = new Docxtemplater(zip, {
    paragraphLoop: true,
});

Please let me know if that works

edi9999 avatar Feb 20 '23 21:02 edi9999

I now have seen the video, the fix I suggested is wrong, it has to do with something else.

I have to check that more deeply, it is not that easy so it might take some time to get a fix or an explanation (maybe it is too complex to handle in the free version).

edi9999 avatar Feb 20 '23 21:02 edi9999

We do our best to keep open source on the servers, however, I can ask the group if we can approve a gift / donation. You have certainly already earned it. I do that anyways. I have crypto on hand and they have company card. Plus, I hope this server's your interest and the open source community at the same time.

jcalfee avatar Feb 21 '23 22:02 jcalfee