Help needs with Transforming word Documents in to xml

Hi,

I searched in msdn abt how to Transfer word Documents into XML or XSL-FO From that I got this link Transforming Word Documents into the XSL-FO Format, here they given all the procedure how to do that.Its manual one. But i wanted these work to be done by program itself. Can u please help in this. So far i did something like

Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application();

Microsoft.Office.Interop.Word.Document doc = new Microsoft.Office.Interop.Word.Document();

try

{

object filename = @"E:\Share\docgen\Word2003\TestResult\All_Classes.doc";

object tFileName = @"E:\Share\docgen\Word2003\TestResult\All_Classes.xml";

doc = word.Documents.Open(ref filename,

ref missing, ref missing, ref missing, ref missing, ref missing,

ref missing, ref missing, ref missing, ref missing, ref missing,

ref missing, ref missing, ref missing, ref missing, ref missing);

doc.Activate();

object format = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatXML;

word.Application.XMLNamespaces.Add(@"E:\Share\docgen\Word2003\Test\note.xsl", ref missing, ref missing, true);

word.ActiveDocument.SaveAs(ref tFileName, ref format, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);

but it is throwing an exception as "Bad Command" Because Appl.xmlNameSpaces.Add is taking xsd as input but i was specifying xsl, because i want to apply transformation (.xsl) to doc. How Can i Do that



Answer this question

Help needs with Transforming word Documents in to xml