Hello,
I try to use the method appendDocument to merge two docx files using the ImportFormatMode KeepSourceFormatting. But merging doesn’t keep the format of the second docx file. Text without explicit formating (default formatting) takes the format of the text in the first file. Then the rendering is not correct in the final file.
I join examples of files. This is my code :
try
{
Document doc1 = new Document("doc1.docx");
Document doc2 = new Document("doc2.docx");
doc1.appendDocument(doc2, ImportFormatMode.KEEP_SOURCE_FORMATTING);
doc1.save("docFinal.docx");
}
catch (Exception e)
{
e.printStackTrace();
}
How can I solve this problem ? Is there something wrong ? Thank you for your help.
Best regards