c# - Convert word document to XML -



c# - Convert word document to XML -

can suggest how convert word document xml document using c#.net code? want track sections of word documents against word document standard template. differences between 2 xml structures help in validation.

for c#, can utilize com reference microsoft.word object library want. using visualstudio 2010 , reference version 14.0 sure older versions work same.

after create reference, include using statement such:

using word = microsoft.office.interop.word;

after that, explore wdformatxmldocument see if want.

//creating instance of word application word.application newapp = new word.application(); // specifying source & target file names object source = "c:\\abc\\source.doc"; object target = "c:\\abc\\target.xml"; // utilize parameter type not known or // missing object unknown = type.missing; // source document open here // additional parameters not known // set missing type newapp.documents.open(ref source, ref unknown, ref unknown, ref unknown, ref unknown, ref unknown, ref unknown, ref unknown, ref unknown, ref unknown, ref unknown, ref unknown, ref unknown, ref unknown, ref unknown); // specifying format in want output file object format = word.wdsaveformat.wdformatxmldocument; //changing format of document newapp.activedocument.saveas(ref target, ref format, ref unknown, ref unknown, ref unknown, ref unknown, ref unknown, ref unknown, ref unknown, ref unknown, ref unknown, ref unknown, ref unknown, ref unknown, ref unknown, ref unknown); // closing application newapp.quit(ref unknown, ref unknown, ref unknown);

i got info here: http://www.codeproject.com/articles/5273/how-to-convert-doc-into-other-formats-using-c

c# xml ms-word

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -