title: CustomXmlParts in Excel
body: <p>I've written an Add-In in Excel. I'm adding a CustomXmlPart on the click of button in ribbon. When the CustomXmlPart is added I'm saving its GUID in seperate sheet(XML) for retriving the xml later. </p>
  
  <p>Here is the code:</p>
  
  <pre><code>    private void btnAddXML_Click(object sender, RibbonControlEventArgs e)
      {
          Excel.Workbook WB = Globals.ThisAddIn.Application.ActiveWorkbook;
          XmlDocument xmlDoc = new XmlDocument();
          xmlDoc.Load(@"C:\Users\shree\Desktop\Correct.xml");
          Microsoft.Office.Core.CustomXMLPart TaggingXml = WB.CustomXMLParts.Add(xmlDoc.OuterXml);
          string strXmlGUID = TaggingXml.Id;
          Excel.Worksheet WS = WB.Sheets.Add(After: WB.Sheets[WB.Sheets.Count]);
          WS.Name = "XML";
          WS.Cells[1, 1] = strXmlGUID;
      }
  
      private void btnShowXML_Click(object sender, RibbonControlEventArgs e)
      {
          Excel.Workbook WB = Globals.ThisAddIn.Application.ActiveWorkbook;
          Excel.Worksheet WS = WB.Sheets["XML"];
          XmlDocument xmlDoc = new XmlDocument();
          Microsoft.Office.Core.CustomXMLPart TaggingXml = WB.CustomXMLParts.SelectByID(WS.Cells[1, 1].Value.ToString());
          StreamWriter sw = File.CreateText(@"C:\Users\shree\Desktop\New.xml");
          sw.Write(TaggingXml.XML);
          sw.Close();
          sw.Dispose();
          MessageBox.Show("Done");
      }
  </code></pre>
  
  <p>Now my question is how can I view this xml document inside excel(if possible). If I move this file to another system, will I be able to access this xml or it is stored locally in my system. What if the GUID which I'm using to read xml conflicts with the GUID of some other object in other machine. How does a CustomXmlPart works? Where it is stored?  </p>