这是我的代码
string destinationFileWord = filePath;
Process print = new Process();
print.StartInfo.FileName = destinationFileWord;
print.StartInfo.UseShellExecute = true;
print.StartInfo.CreateNoWindow = true;
print.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
print.StartInfo.Verb = "PrintTo";
print.StartInfo.Arguments = Utility.GetAppSettings("PrinterSettings", "Address1");
print.StartInfo.WorkingDirectory = Path.GetDirectoryName(destinationFileWord);
print.Start();
if (print.HasExited == false)
{
print.WaitForExit(5000);
}
以上代码仅在LibreOffice Calc是我的默认应用程序时有效。如果是Microsoft Excel,它将继续加载。
有人知道为什么吗?