xlwings 是否支持 "Wrap Text" 属性?
Does xlwings support "Wrap Text" property?
我可以使用 Python+xlwings 控制单元格的 "Wrap Text" 属性 吗?
目前尚未实现,但我已提出功能请求 here。同时,您始终可以通过访问 Windows 上的基础 COM 对象来解决问题:mysheet.range('A1').api.WrapText = True
或 Mac 上的 appscript 对象:mysheet.range('A1').api.wrap_text.set(True)
.
最新的xlwings版本:
import xlwings as xw
wb1 = xw.Book('Book1.xlsm').sheets['Sheet1']
wb1.range('A1').value="It's currently not implemented but I've opened a feature request here. In the meantime, you can always work around by accessing the underlying COM object on Windows: "
wb1.range('A1').WrapText = True
对于像我这样现在来到这里但发现这些解决方案不起作用的人,我发现直接使用 work_sheet.range('A:A').api.WrapText = True
访问 pywin32
API 在 Python 3.7 和 xlwings 0.15.8 在 Windows 7 和 Excel 2010.
xlwings 0.19.5 这个有效:
sht.range('A1').api.WrapText = True
我可以使用 Python+xlwings 控制单元格的 "Wrap Text" 属性 吗?
目前尚未实现,但我已提出功能请求 here。同时,您始终可以通过访问 Windows 上的基础 COM 对象来解决问题:mysheet.range('A1').api.WrapText = True
或 Mac 上的 appscript 对象:mysheet.range('A1').api.wrap_text.set(True)
.
最新的xlwings版本:
import xlwings as xw
wb1 = xw.Book('Book1.xlsm').sheets['Sheet1']
wb1.range('A1').value="It's currently not implemented but I've opened a feature request here. In the meantime, you can always work around by accessing the underlying COM object on Windows: "
wb1.range('A1').WrapText = True
对于像我这样现在来到这里但发现这些解决方案不起作用的人,我发现直接使用 work_sheet.range('A:A').api.WrapText = True
访问 pywin32
API 在 Python 3.7 和 xlwings 0.15.8 在 Windows 7 和 Excel 2010.
xlwings 0.19.5 这个有效:
sht.range('A1').api.WrapText = True