Center align - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Center align (/thread-28791.html) |
Center align - Kristenl2784 - Aug-03-2020 Hello, Is there a way to center align ws3 cells as the values from ws1 get written into the ws3? ws3[f'A{i+2}']=ws1['A1'].value[28:] ws3[f'D{i+2}']=ws1['B4'].value ws3[f'E{i+2}']=ws1['D4'].value ws3[f'I{i+2}']=ws1['B'][-1].value ws3[f'J{i+2}']=ws1['D'][-1].value ws3[f'O{i+2}']=ws1['E'][-1].value ws3[f'N{i+2}']=ws2[f'I{i+6}'].value RE: Center align - bowlofred - Aug-03-2020 Center alignment requires an assumption of total width. How do you know what the maximum width should be? It's uncommon to put alignment into your data cells. Instead, you would apply formatting when the data is read/displayed and do it dynamically based upon the data. There are a lot of modules that can take tabular data and apply an alignment to it as printed. |