Search code examples
c#office-interop

Save existing Docx as XML using c#


i have an existing word document (office 2010) and want to programatically saveAs it as XML. i was tried

   Microsoft.Office.Interop.Word.Application.Documents.Open(@"C:\Test\NewDocument.docx");

but its not correct.

how can i do this?


Solution

  • var myfile= @"C:\Test\NewDocument.docx"; 
    var fileInfo = new FileInfo(myfile); 
    fileInfo.MoveTo(Path.ChangeExtension(myfile, ".xml"));