Bouke / docx-mailmerge

Mail merge for Office Open XML (docx) files without the need for Microsoft Office Word.
MIT License
273 stars 104 forks source link

Ability to disable page breaks in merge_pages function #27

Open min-infcof opened 7 years ago

min-infcof commented 7 years ago

It would be quite useful to be able to generate merged pages without blank pages in between, especially when working with many single page documents. Possibly achievable with Boolean kwarg in merge_pages function?

min-infcof commented 7 years ago

Looks like there's an issue with libreoffice's docx parser. After generating files I noticed mailmerge will produce such code in between pages:

</w:body>
<w:br w:type="page"/> 
<w:body> 

Libreoffice will inserts a blank page between every \<body> element, making \<br> element break empty page. Removing \<body> elements between generated templates did the the trick and it didn't affected ms word.

Current solution I found is to mailmerge single files and then further merge them all together within libreoffice.