其他分享
首页 > 其他分享> > excel 自动行宽

excel 自动行宽

作者:互联网

def adaptive_cell(ws):
    col_width = []
    for i in range(len(next(ws.iter_rows()))):
        col_letter = get_column_letter(i + 1)
        minimum_width = 0
        current_width = ws.column_dimensions[col_letter].width
        if not current_width or current_width < minimum_width:
            ws.column_dimensions[col_letter].width = minimum_width
        col_width.append(ws.column_dimensions[col_letter].width)

标签:column,excel,current,width,自动,letter,ws,行宽,col
来源: https://www.cnblogs.com/exceptionalChild/p/16302336.html