110,538
社区成员
发帖
与我相关
我的任务
分享
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();
}