Problem with appendDocument using a Mix of Windows and Mac Word docx

Hello there,

I’m experiencing an issue when I try to seamlessly attach one document to another.

If I use a matching set (Windows docx + Windows docx or Mac docx + Mac docx) everything works fine (ie. there is no new page between those two parts in the resulting document),

If I mix them, there’s always a pagebreak in between them.

I attached a simple test case to reproduce that issue.

Is this behavior intentional?

Best regards

Hi Scherge,

Thanks for your inquiry. Please note that Aspose.Words tries to mimic the same behavior as MS Word do. If you insert Mac document to Windows document and vice versa by using MS Word, you will get the same output (page-break between two documents)

In your case, I suggest you please use the insertDocument method to insert a Document at any location of another document. Please read the detail from here:
https://docs.aspose.com/words/java/insert-and-append-documents/

private void combineDocuments(Document srcDoc, Document targetDoc, String name) throws Exception
{
    // srcDoc.getFirstSection().getPageSetup().setSectionStart(SectionStart.CONTINUOUS);
    // targetDoc.appendDocument(srcDoc, ImportFormatMode.USE_DESTINATION_STYLES);
    insertDocument(targetDoc.getLastSection().getBody().getLastParagraph(), srcDoc);
    System.out.println("Page count " + name + ": " + targetDoc.getPageCount());
    targetDoc.save(MyDir + name + ".pdf", SaveFormat.PDF);
}

Thank you very much for your answer.
I’m glad you’re reproducing Words behavior as much as possible.

Hi Scherge,

Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.