공공기관2 작업 중. _temp 몽타주(재생성가능)는 제외. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
31 lines
1.5 KiB
Python
31 lines
1.5 KiB
Python
import sys, io
|
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
|
import openpyxl
|
|
from openpyxl.utils import get_column_letter
|
|
PKG = r'D:\01.프로젝트\DB수집\작업파일\_제출패키지_2026-06-03\프리랜서1\충청남도_부여군.xlsx'
|
|
ws = openpyxl.load_workbook(PKG).active
|
|
|
|
def sides(cell):
|
|
b=cell.border
|
|
return (b.left.style,b.right.style,b.top.style,b.bottom.style)
|
|
|
|
# pick a GOOD vertical merge in clean region: E column. Find E merges with their rows.
|
|
emerges=sorted([m for m in ws.merged_cells.ranges if m.min_col==5 and m.min_row>=3], key=lambda x:x.min_row)
|
|
print('=== E-column merges: anchor & interior & last border (col E) ===')
|
|
for m in emerges:
|
|
a=m.min_row; z=m.max_row
|
|
mid=(a+z)//2
|
|
print(f'E{a}:{z} anchor E{a}={sides(ws.cell(a,5))} mid E{mid}={sides(ws.cell(mid,5))} last E{z}={sides(ws.cell(z,5))} val={ws.cell(a,5).value!r}')
|
|
|
|
print('\n=== D-column merges ===')
|
|
dmerges=sorted([m for m in ws.merged_cells.ranges if m.min_col==4 and m.min_row>=3], key=lambda x:x.min_row)
|
|
for m in dmerges:
|
|
a=m.min_row; z=m.max_row; mid=(a+z)//2
|
|
print(f'D{a}:{z} anchor={sides(ws.cell(a,4))} mid={sides(ws.cell(mid,4))} last={sides(ws.cell(z,4))} val={ws.cell(a,4).value!r}')
|
|
|
|
print('\n=== F-column merges (first few + region 441+) ===')
|
|
fmerges=sorted([m for m in ws.merged_cells.ranges if m.min_col==6 and m.min_row>=3], key=lambda x:x.min_row)
|
|
for m in fmerges:
|
|
a=m.min_row; z=m.max_row
|
|
print(f'F{a}:{z} anchor={sides(ws.cell(a,6))} last={sides(ws.cell(z,6))} val={ws.cell(a,6).value!r}')
|