raulbojalil/docx-builder

Problem merging section break with Page layout changing (Horizontal / Vertical)

saudraisn opened this issue · 1 comments

Hi @raulbojalil, hope you're doing well!

I ran into this issue while trying to merge a document which contains a section break with a page layout change (one page with vertical layout, the next one with horizontal layout) into an empty builder.document().

Here's my sample code :

var builder = require('docx-builder')
var docx = new builder.Document()

docx.insertDocxSync(__dirname + '/test.docx')

docx.save(__dirname + '/result.docx', function(err) {
  if (err) console.log(err)
})

and the test file :
test.docx

Here's the result file :
result.docx

and here's what I obtain when I open the result.docx document :
image

Thanks for your help!

Hi @raulbojalil,

It turns out the closing xml tags
</w:sectPr> and </w:pPr>
are missing in the generated "document.xml" file.

image

Still after fixing this issue (closing the xml tags manually), I obtain a document that I can open, but both pages are in vertical layout mode (landscape is missing).

I'll get back to you if I find more details about this problem.