You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
aaaa/test.py

13 lines
350 B

from openpyxl import load_workbook
from openpyxl.styles import *
def style(file):
wb = load_workbook(file)
ws = wb.active
for row in ws.iter_rows():
for cell in row:
if cell is not None:
cell.alignment = Alignment(horizontal='center',vertical='center')
wb.save(file)
style('测试3.xlsx')