Search code examples
c#ms-wordsharepoint-2007

Merging word documents C#


I am trying to merge c# documents. My idea is to have a master document and just append the other documents to this master document. Environment is in SharePoint, so basically the documents exist in the document library and I have no problem with my code being able to find the documents. Once I locate them programattically I have no clue how to open and merge them. I have been searching and seems to be like OpenXML SDK 2.0 is a way to do it, but I am not familar with that tool at all and was trying to see if their is a way to do it with the current tools I have in Visual Studio 3.5 . Either using Microsoft.Office.Interop.Word or something else. From what I understand, the actual files are stored in the content database as binary form so the physical file doesn't actually exist, so I cant just easily open them with word. Any help.


Solution

  • I think this link is exactly what you're looking for:

    Merging Word Documents on the Server Side with SharePoint 2010

    There's a little Open Xml, but nothing too bad. If you decide that this isn't giving you the control you need, you can check this article out:

    Creating Documents by Using the Open XML Format SDK 2.0 (Part 3 of 3)