0

I have two .docx documents in byte[] format and I have to merge these two documents into one. The java code runs successfully but I am not able to open the document I have used the below link to write the merging code -

Is there any java library (maybe poi?) which allows to merge docx files?

This works well when I do not have any headers and footers on any of my document. In case, any one of the two document will have the header or footer, I am not able to open the merged document as the document.xml is malformed or invalid.

I am getting the below error while trying opening the document -

Microsoft Office can't open this file because some parts are missing or invalid
Location : Part:/word/document.xml, Line 2, Column 0

I had a look at document.xml, it just have the below xml fragment at line 2-

<w:document  xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
Community
  • 1
  • 1
KADeveloper
  • 1
  • 1
  • 2

0 Answers0