[英]Using Win32api to print to printer
I'm trying to get a python script of mine to print a CSV file to the printer via Win32api.ShellExectute, IE我正在尝试获取我的 python 脚本以通过 Win32api.ShellExectute、IE 将 CSV 文件打印到打印机
win32api.ShellExecute(0,"print","C:\Test.csv",None,".",0)
Here's my problem: when I associate the file with Open Office, it just completely refuses to print.这是我的问题:当我将文件与 Open Office 关联时,它完全拒绝打印。 Prints fine in notepad.在记事本中打印良好。 Prints fine in Microsoft Excel.在 Microsoft Excel 中打印良好。 Refuses to print in Open Office.拒绝在 Open Office 中打印。
There's no error message, either.也没有错误信息。 If anyone knows a way to get an error message or SOMETHING at least I could try to work on it.如果有人知道获取错误消息或某些东西的方法,至少我可以尝试处理它。 I went to OpenOffice.org's website and their wiki and all of their solutions are involving their integrated python macro scripting using the UNO module.我访问了 OpenOffice.org 的网站和他们的 wiki,他们的所有解决方案都涉及使用 UNO 模块的集成 python 宏脚本。 I'm looking to call the print from a seperate application.我希望从单独的应用程序中调用打印。
You're relying on the shell defining a "print" verb for a particular file type.您依赖 shell 为特定文件类型定义“打印”动词。 This works as follows:这工作如下:
All of those registry keys must be placed there by an installation program.所有这些注册表项都必须由安装程序放置在那里。 When you associate a file type, you're changing the lookup in step 2.关联文件类型时,您将在步骤 2 中更改查找。
Edit: What I left unsaid is that there's nothing to prevent you from correcting the ommision of a verb from a specific file type, as long as you can edit the registry and provide an appropriate command line.编辑:我没有说的是,只要您可以编辑注册表并提供适当的命令行,就没有什么可以阻止您更正特定文件类型中动词的省略。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.