Skip to content

Instantly share code, notes, and snippets.

@johnathan-sewell
johnathan-sewell / RibbonXMLPersistance.cs
Created November 29, 2012 14:24
Example of saving XML to the Excel document file from a VSTO Excel Ribbon Addin
public void AddCustomXmlPartToWorkbook()
{
var workbook = Globals.ThisAddIn.Application.ActiveWorkbook;
const string xmlString = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" +
"<employees xmlns=\"http://myapi.com\">" +
"<employee>" +
"<name>Karina Leal</name>" +
"<hireDate>1999-04-01</hireDate>" +
"<title>Manager</title>" +