Does xlwings support “Wrap Text” property?

2019-08-08 19:24发布

问题:

Can I control the "Wrap Text" property of a cell using Python+xlwings?

回答1:

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: Range('A1').xl_range.WrapText = True or appscript object on Mac: Range('A1').xl_range.wrap_text.set(True).



回答2:

For the newest xlwings version:

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