title: Convert .XLSX or .XLSM to XML
body: <p>I have the code below which I using to programmatically save a Office 2010 Excel Spreadsheet to XML.  This code generates a perfect XML document with a schema that matches the Excel Save As option.  My question is there a way to achieve this without using the interop assemblies.  I have looked through the Open XML documentation and I can't find a "Save As" option that will allow me to save the document as xml.  Is this possible? Any help in c# or vb.net would be appreciated. </p>
  
  <pre><code> Private Function ConvertExcelToXml(path As String, file As String) As Boolean
      Dim returnValue as Boolean
      returnValue = True
      Try
          Dim importfile As String = (path &amp; file) + ".xlsm"
          Dim exportfile As String = (path &amp; file) + ".xml"
          Dim app As New Application()
          app.Workbooks.Open(importfile, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
                             Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
                             Type.Missing, Type.Missing, Type.Missing)
          Dim data As String = String.Empty
  
          app.ActiveWorkbook.XmlMaps(1).ExportXml(data)  'export the excel sheet xml to the string variable
          System.IO.File.Delete(exportfile)   'delete the file if it already exists
          System.IO.File.WriteAllText(exportfile, data) 'write the new file
          app.Workbooks.Close()
      Catch ex As Exception
          returnValue = false
      End Try
      return returnValue
  End Function
  </code></pre>
  
  <p>Thanks,
  Chaos</p>