如何打印从C#Word文档文档、Word

2023-09-03 08:16:05 作者:命中不缺狗

我如何可以启动从C#.NET应用程序文档的打印? 在Word文档已经存在于硬盘驱动器。我只想开始打印在按钮点击事件的Word文档。

解决方案

 的ProcessStartInfo磅=新的ProcessStartInfo(wordFilename)
 {
    UseShellExecute = TRUE,
    动词=打印,
    RedirectStandardOutput =假,
    CreateNoWindow =真
 };

 使用(进程p =新的Process {StartInfo的= PSI})
 {
     p.Start();
     p.WaitForExit();
 }
 

How can I launch the print of a document from C# .NET application ? the Word document already exists in the hard drive. I just wish to start printing that Word document upon the button click event.

解决方案 如何在word软件打印满页纸

 ProcessStartInfo psi = new ProcessStartInfo(wordFilename)
 {
    UseShellExecute = true,
    Verb = "print",
    RedirectStandardOutput = false,
    CreateNoWindow = true
 };

 using (Process p = new Process {StartInfo = psi})
 {
     p.Start();
     p.WaitForExit();
 }