项目添加引用microsoft word 10 object library
Word.Application app = new Word.ApplicationClass();
app.Visible = false;
string strFile = "c:\\bbb.doc";
object obj = System.Reflection.Missing.Value;
Object infile = (object)strFile;
Word.Document doc = app.Documents.Open(ref infile, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj);
string strnew = "c:\\bbb.txt";
Object outfile = (object)strnew;
Object fmt = (object)Word.WdSaveFormat.wdFormatText;
doc.SaveAs(ref outfile, ref fmt, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj);
doc.Close(ref obj, ref obj, ref obj);
app.Quit();
app = null;
Word.Application app = new Word.ApplicationClass();
app.Visible = false;
string strFile = "c:\\bbb.doc";
object obj = System.Reflection.Missing.Value;
Object infile = (object)strFile;
Word.Document doc = app.Documents.Open(ref infile, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj);
string strnew = "c:\\bbb.txt";
Object outfile = (object)strnew;
Object fmt = (object)Word.WdSaveFormat.wdFormatText;
doc.SaveAs(ref outfile, ref fmt, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj);
doc.Close(ref obj, ref obj, ref obj);
app.Quit();
app = null;