Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LibreOffice Manual Page Breaks #700

Open
jcalfee opened this issue Feb 19, 2023 · 3 comments
Open

LibreOffice Manual Page Breaks #700

jcalfee opened this issue Feb 19, 2023 · 3 comments

Comments

@jcalfee
Copy link

jcalfee commented Feb 19, 2023

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

@edi9999
Copy link
Member

edi9999 commented Feb 20, 2023

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
Copy link
Member

edi9999 commented Feb 20, 2023

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).

@jcalfee
Copy link
Author

jcalfee commented Feb 21, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants