报错:
File "C:\Users\xx\AppData\Local\Programs\Python\Python38\lib\site-packages\excel2img\excel2img.py", line 113, in export_img
for shape in rng.parent.Shapes: pass
File "C:\Users\xx\AppData\Local\Programs\Python\Python38\lib\site-packages\win32com\client\__init__.py", line 580, in __getattr__
raise AttributeError(
AttributeError: '<win32com.gen_py.Microsoft Excel 16.0 Object Library.Range instance at 0x2426291144016>' object has no attribute 'parent'
解决方法:
查了半天中文互联网上没有解决方案,终于在stackoverflow上看到了问题所在:
在Excel 2016文件格式中,属性parent更改为Parent。由于Python区分大小写,因此无法找到适当的属性。
把excel2img的源代码第113行中的parent改成首字母大写就行:
附上链接:https://stackoverflow.com/questions/57173575/pythons-excel2img-package-not-working-with-ms-office-2016
对你有帮助能给我一个like吗~