如何打开可见的excel全尺寸?

问题描述 投票:1回答:1

我在笔记本电脑和家用电脑上运行python脚本:

os.startfile(r'C:\\A file.xlsx')

这很好用,但我似乎无法找到如何制作这个完整尺寸的任何地方

关于如何通过python实现全尺寸的任何想法?

我同时使用Apache OpenOffice和Microsoft Excel

image

python excel python-3.x operating-system subprocess
1个回答
1
投票

您应该能够使用以下方法最大化窗口:

import win32gui, win32con, os, time

os.startfile('C:\\Path\To\File.xlsx')
# Wait as long as needed for the file to open, this value can be adjusted as needed
time.sleep(3)
# Now maximize the current foreground window (should be the one we care about at this point)
hwnd = win32gui.GetForegroundWindow()
win32gui.ShowWindow(hwnd, win32con.SW_MAXIMIZE)
© www.soinside.com 2019 - 2024. All rights reserved.