编辑代码

```python
from pathlib import Path
from openpyxl import load_workbook
from openpyxl.styles import Font, Alignment, Border, Side
def format_excel(file_path):
wb = load_workbook(file_path)
ws = wb.active
# 设置通用样式
font = Font(name='微软雅黑', size=11)
align = Alignment(horizontal='center', vertical='center')
thin_border = Border(left=Side(style='thin'), 
right=Side(style='thin'),
top=Side(style='thin'), 
bottom=Side(style='thin'))
# 应用样式
for row in ws.iter_rows():
for cell in row:
cell.font = font
cell.alignment = align
cell.border = thin_border
# 保存时统一转为xlsx格式
wb.save(file_path.with_suffix('.xlsx'))
# 批量处理
folder = Path(r"E:\待处理文件")
for file in folder.glob("*.xls*"):
format_excel(file)