import sys, io
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
import openpyxl
PKG = r'D:\01.프로젝트\DB수집\작업파일\_제출패키지_2026-06-03\프리랜서1\충청남도_부여군.xlsx'
ws = openpyxl.load_workbook(PKG).active

def bd(cell):
    b=cell.border
    f=lambda s: (s.style or '-')[:4]
    return f'{f(b.left)}/{f(b.right)}/{f(b.top)}/{f(b.bottom)}'

def merged_cols(r):
    cols=set()
    for m in ws.merged_cells.ranges:
        if m.min_row<=r<=m.max_row:
            for c in range(m.min_col,m.max_col+1):
                if not (r==m.min_row and True): pass
            cols.add((m.min_col,m.max_col,m.min_row,m.max_row))
    return cols

for r in (137, 138, 233, 234, 235):
    print(f'\n=== row {r} (L/R/T/B per col B..S) ===')
    for c in range(2,20):
        print(f'  {ws.cell(r,c).coordinate}={bd(ws.cell(r,c))}', end='')
        if c%6==1 or c==19: print()
    # merges on this row
    ms=[str(m) for m in ws.merged_cells.ranges if m.min_row<=r<=m.max_row and m.min_col<=11<=m.max_col]
    print('  K in merge?:', ms)
