How to Merge Documents with DOCX and DOC file Formats using .NET

Hi,

Does Aspose.words for java support merging 2 documents, one with .doc extension and the other .docx extension to a new .docx ?

thank you,
Kartik

@kartikbalaji01

Yes, Aspose.Words for Java does support merging of document (DOC and DOCX file formats). Please read the following article for more detail.

Moreover, you can import the supported documents into Aspose.Words’ DOM and join them.

ok thanks, Do we need to handle .doc/.docx specifically or does the aspose library identify those by itself?

@kartikbalaji01

Aspose.Words detect the document’s file format when it is imported into Aspose.Words’ DOM. Following code example shows how to join DOC and DOCX files.

Document srcDoc = new Document(MyDir + "input.doc");
Document dstDoc = new Document(MyDir + "input.docx");

dstDoc.AppendDocument(srcDoc, ImportFormatMode.KeepSourceFormatting);
dstDoc.Save(MyDir + "Document.AppendDocument.docx");