import sys, io
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
import openpyxl, importlib.util
spec = importlib.util.spec_from_file_location('chk', r'D:\01.프로젝트\DB수집\작업파일\광역_사이트맵\_검수체크.py')
chk = importlib.util.module_from_spec(spec); spec.loader.exec_module(chk)

PKG = r'D:\01.프로젝트\DB수집\작업파일\_제출패키지_2026-06-03\프리랜서1\충청남도_부여군.xlsx'
BK  = PKG.replace('.xlsx','_backup_테두리보정전.xlsx')
n, issues = chk.inspect(PKG)
print(f'검수: {n}행 -> {"PASS" if not issues else "FAIL "+str(issues)}')

# values & heights identical to pre-border backup (only borders should differ)
a = openpyxl.load_workbook(PKG).active
b = openpyxl.load_workbook(BK).active
vdiff = sum(1 for r in range(1,a.max_row+1) for c in range(1,28) if a.cell(r,c).value!=b.cell(r,c).value)
hdiff = sum(1 for r in range(1,a.max_row+1) if a.row_dimensions[r].height!=b.row_dimensions[r].height)
print(f'값 변화: {vdiff}  높이 변화: {hdiff}  (둘 다 0이어야 정상)')
print(f'max_row {a.max_row}  (전부 height=15: {all(a.row_dimensions[r].height==15 for r in range(1,a.max_row+1))})')
