//// This code is part of Document Solutions for Word demos.// Copyright (c) MESCIUS inc. All rights reserved.//usingSystem.IO;usingGrapeCity.Documents.Word; namespaceDsWordWeb.Demos{// This sample shows how to merge two DOCX files into one.publicclassMergeDocs {publicGcWordDocumentCreateDocx() {var doc1 = newGcWordDocument(); doc1.Load(Path.Combine("Resources", "WordDocs", "SampleParagraphs.docx")); var doc2 = newGcWordDocument(); doc2.Load(Path.Combine("Resources", "WordDocs", "BuiltInStyles.docx")); // Static MergeDocuments() method overloads allow to merge any number of documents.// Internally, those methods call the Body.CopyTo() method on each of the documents// being merged, so the same results can be achieved using CopyTo().// The different overloads allow to merge documents with full formatting,// without formatting, or using combinations of both.// Here we demonstrate the most flexible MergeDocuments() overload by merging the// two loaded documents twice, first copying their original formatting, and then// clearing it:var doc = GcWordDocument.MergeDocuments( (doc1, FormattingCopyStrategy.Copy), (doc2, FormattingCopyStrategy.Copy), (doc1, FormattingCopyStrategy.Clear), (doc2, FormattingCopyStrategy.Clear)); // Done:return doc; } }}