MS Word appending without creating the instance - Need a performance effective solution

Hello there,

Thanks for this tool, hopefully it can do wonders.
My problem here is to append N number of documents (docx) into 1 docx without opening MS word instance at all. I think the solution is,
i. Read 1st docx’s data (biforcate the structure and read it from the xml); similarly do this for N documents
ii. Copy any of the docx file and replace the xml content with appended content
but my doubt here is, how do i achieve this without opening the instance. I would like to have sample C# code for this so that i can develop taking that as a base.
Or is there any better solution? I shouldn’t take much time in doing the processing.

Thanks,
Sami

This message was posted using Page2Forum from Document Builder - Aspose.Words Demos

Hi

Thanks for your inquiry. You can easily combine documents using Aspose.Words. Here is simple code, which combines two document:

// Open documents.
Document dstDoc = new Document("dst.docx");
Document srcDoc = new Document("src.docx");
// Append source document to the destination document.
dstDoc.AppendDocument(srcDoc, ImportFormatMode.UseDestinationStyles);
// Save output document.
dstDoc.Save("out.docx");

Hope this helps. Please let me if you need more assistance, I will be glad to help you.
Best regards.

Hi Alexey,

Thanks much… it worked. Couple of queries

  1. Hope it doesnt create even a single word instance
  2. Do we need to have ms office installed on the machine its running?

Best Wishes,
Sami

Hi,
Wondering is there any way to append word documents without creating the instance using C#…
I have 1.docx and 2.docx, I’ve to append the contents of these 2 to another file 3.docx without creating word instance.
Any thoughts? or Is this possible only with Aspose / Similar tools other than Word

Thanks,
Sami

Hi

Thanks for your request. Aspose.Words does not use MS Word at all, so MS Word is not required to process documents using Aspose.Words. Please see the following links for more information:
https://docs.aspose.com/words/net/system-requirements/
https://docs.aspose.com/words/net/aspose-words-or-other-solutions/
Best regards.