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

Sharepoint Object Model C# Error The Web Application at could not be found. Verify that you have typed the URL correctly

Published on

When running some C# code containing a reference to SPSite ie I was getting the following error: The Web Application at could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the … Continue reading Sharepoint Object Model C# Error The Web Application at could not be found. Verify that you have typed the URL correctly

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