python excel 设置单元强制换行
from openpyxl import Workbook
from openpyxl.styles import Alignment
wb = Workbook()
sheet = wb.active
sheet['G1'] = "Line 1\nLine 2\nLine 3"
sheet['G1'].alignment = Alignment(wrapText=True)
if __name__ == '__main__':
wb.save("sample.xlsx")
本文来自博客园,作者:vx_guanchaoguo0,转载请注明原文链接:https://www.cnblogs.com/guanchaoguo/p/17184430.html