日期:2014-05-18 浏览次数:20979 次
Word.Application newApp = new Word.Application(); // specifying the Source & Target file names object Source="c:\\abc\\Source.doc"; object Target="c:\\abc\\Target.rtf"; // Use for the parameter whose type are not known or // say Missing object Unknown =Type.Missing; // Source document open here // Additional Parameters are not known so that are // set as a 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 the format in which you want the output file object format = Word.WdSaveFormat.wdFormatRTF; //Changing the format of the 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); // for closing the application newApp.Quit(ref Unknown,ref Unknown,ref Unknown);