Merging documents into a single document using Open XML SDK 2.0 and Word Automation Services

Published on

The code below will create a webpart that can be added to any document library, when the button ‘Merge Reports’ is clicked it will merge all the documents together in the library in to a single document using Open XML SDK & Word Automation Services. You will need to add the following references: DocumentFormat.OpenXml Microsoft.Office.Word.Server … Continue reading Merging documents into a single document using Open XML SDK 2.0 and Word Automation Services

How to create an Excel Workbook from an SQL database using Open XML SDK 2.0

Published on

Below is the C# code to create a new Excel workbook based on a template file & populated by an SQL database. You need to add references to: DocumentFormat.OpenXml System.Data.Linq Windows.Base using System; using System.IO; using System.Data; using System.Collections.Generic; using System.Linq; using System.Text; using DocumentFormat.OpenXml.Packaging; using DocumentFormat.OpenXml.Spreadsheet; using DocumentFormat.OpenXml; namespace ElitetoExcel { class Program { … Continue reading How to create an Excel Workbook from an SQL database using Open XML SDK 2.0

Modifying an Open XML Document in a SharePoint Document Library

Published on

C# Console Application code to query a Sharepoint Library, Open a document, Make a change & then save the document. You need references to WindowsBase.dll, Microsoft.Sharepoint & DocumentFormat.OpenXml You also need to ensure your project is .Net 3.5 & set to target ‘Any CPU’ in the project properties. Code written by Eric White

How to auto populate Word template using Open XML SDK 2.0

Published on

Here is some simple code that updates a word document template that contains 2 content controls in the template document called: MatterNumber DocType The template document is – C:UsersstilgoepWordTesttest-contentcontrol.docx The output document is – C:UsersstilgoepWordTesttest-contentcontrol-updated.docx You need to add the following 2 references: DocumentFormat.OpenXml WindowsBase.dll You will also need to download the Word Content Control … Continue reading How to auto populate Word template using Open XML SDK 2.0