mac下xlwings 无法修改字体大小,同样的代码在windows下可以运行
最近再练习写用xlwings,但是遇到了问题,我在mac上尝试修改字体大小,
fg1=sheet.range("A1:D1")
fg1.merge()
fg1.value="消费账单"
fg1.api.Font.Size=25
fg1.api.HorizontalAlignment=-4108
fg1.row_height=38.25
其中fg1.api.Font.Size=25这行报错,报错信息是
Traceback (most recent call last):
File "/Users/mengchuancao/codeLibiary/workShopPy/untitled/venv/lib/python3.8/site-packages/aeosa/appscript/reference.py", line 599, in __getattr__
selectortype, code = self.AS_appdata.referencebyname()[name]
KeyError: 'Font'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/mengchuancao/codeLibiary/workShopPy/autoRecord/自动记账.py", line 22, in <module>
sheetStyle()
File "/Users/mengchuancao/codeLibiary/workShopPy/autoRecord/自动记账.py", line 18, in sheetStyle
fg1.api.Font.Size=25
File "/Users/mengchuancao/codeLibiary/workShopPy/untitled/venv/lib/python3.8/site-packages/aeosa/appscript/reference.py", line 601, in __getattr__
raise AttributeError("Unknown property, element or command: {!r}".format(name)) from e
AttributeError: Unknown property, element or command: 'Font'
但是在win下面这代码运行就正常了,python是3.8,xlwings版本0.19,求助要怎么解决这个问题