Learn how to copy content from one Word document to another in C#: https://blog.aspose.com/2021/11/01/copy-content-of-a-word-document-to-another-in-csharp/
Last active
December 7, 2021 13:46
-
-
Save aspose-com-gists/0b41e0adc9a80929ced47d11d5aca759 to your computer and use it in GitHub Desktop.
Copy Content from One Word Document to Another in C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load source Word documents | |
Document doc = new Document("document.docx"); | |
// Clone document | |
Document newDoc = doc.Clone(); | |
// Save document | |
newDoc.Save("output.docx"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load source and destination Word documents | |
Document doc = new Document("document.docx"); | |
Document docDest = new Document("document2.docx"); | |
// Copy the content from source document to destination document | |
docDest.AppendDocument(doc, ImportFormatMode.KeepSourceFormatting); | |
// Save document | |
docDest.Save("output.docx"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment