如何在xlwings中将excel窗口放在前面?
如何将 Excel 窗口的可见性置于其他应用程序之前?我不想让它在 App 的 visible=True
属性中可见,因为我只能在任务栏中看到 Excel 窗口。我需要在我面前看到它(在其他应用程序之上),这样我就可以使用 pyautogui。
app = xw.App(add_book=False)
api_wb = app.books.api.Open(file_directory, UpdateLinks=False)
wb = xw.Book(impl=xw._xlwindows.Book(xl=api_wb))
代码示例在这里。尽管任何其他打开文件的方法都会导致相同的 Excel 被包装到任务栏。 我该如何解决这个问题?
我还想上传该问题的图像,但 stackoverflow 不允许我说:“上传图像时发生错误:服务不可用”。图片格式为.png
How can I put excel window in front of other apps in terms of visibility? I am not interested in making it visible in visible=True
attribute of App, because I can only see the excel window in taskbar. I need to see it in front of me (on top of other apps), so I can use pyautogui.
app = xw.App(add_book=False)
api_wb = app.books.api.Open(file_directory, UpdateLinks=False)
wb = xw.Book(impl=xw._xlwindows.Book(xl=api_wb))
A sample of the code is here. Although any other method of opening file will result in the same excel being wrapped to taskbar.
How can I solve this?
I also wanted to upload an image of the issue, but stackoverflow didn't let me saying: 'An error occurred when uploading the image: Service Unavailable'. The image format is .png
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要激活应用程序并像这样窃取焦点:
请参阅: https://docs.xlwings.org/en/stable/api.html#xlwings.App.activate
You need to activate the app and steal the focus like this:
see: https://docs.xlwings.org/en/stable/api.html#xlwings.App.activate