如何打印从C#Word文档 [英] How to print a Word document from C#

查看:174
本文介绍了如何打印从C#Word文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何可以启动从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.

解决方案

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

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

这篇关于如何打印从C#Word文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆