日期:2014-05-18 浏览次数:20840 次
public void PrintWord(string path) { Object nothing = Missing.Value; Object falseValue = false; Object trueValue = true; Object pages = 1; Object paths = path; MSWord.ApplicationClass app = new Microsoft.Office.Interop.Word.ApplicationClass(); app.Visible = false; MSWord.Document doc = app.Documents.Open(ref paths, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref trueValue, ref nothing, ref nothing, ref nothing, ref nothing); // doc.Activate();<-------------------------------------这里 doc.PrintOut(ref trueValue, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref pages, ref nothing, ref nothing, ref falseValue, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing); doc.Close(ref falseValue, ref nothing, ref nothing); app.Quit(ref nothing, ref nothing, ref nothing); GC.Collect(); }