# -*- coding: utf-8 -*-
import openpyxl,shutil,re
from openpyxl.styles import PatternFill
SRC='한국중부발전.xlsx'
shutil.copy(SRC,'한국중부발전_backup_N재검수전.xlsx')
wb=openpyxl.load_workbook(SRC);ws=wb.active
BLUE=PatternFill('solid',fgColor='BDD7EE')
changes={157:'어문,이미지', 223:'어문,영상'}
for r,v in changes.items():
    old=ws.cell(r,14).value
    ws.cell(r,14).value=v
    ws.cell(r,14).fill=BLUE
    print(f'r{r}: {old!r} -> {v!r}')
# trailing-space normalize across N
fixn=0
for r in range(3,ws.max_row+1):
    n=ws.cell(r,14).value
    if isinstance(n,str) and n!=n.strip():
        ws.cell(r,14).value=n.strip();fixn+=1
print('N 공백정규화:',fixn)
wb.save(SRC)
print('saved')
