From c5ad429dc3fae6cc2b6fbc2e2ac53c43092896e6 Mon Sep 17 00:00:00 2001 From: umsangdon Date: Mon, 28 Sep 2026 13:45:41 +0900 Subject: [PATCH] =?UTF-8?q?fix(spreadsheet):=20=ED=9A=8C=EA=B3=84=20?= =?UTF-8?q?=ED=98=95=EC=8B=9D=20=EB=94=B0=EC=98=B4=ED=91=9C=20CSS=20?= =?UTF-8?q?=EC=9C=A0=EB=8B=88=EC=BD=94=EB=93=9C=20=EC=9D=B4=EC=8A=A4?= =?UTF-8?q?=EC=BC=80=EC=9D=B4=ED=94=84(\0022)=20=EC=95=88=20=ED=92=80?= =?UTF-8?q?=EB=A6=AC=EB=8D=98=20=EA=B2=83=20=EA=B3=A0=EC=B9=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 사용자 실제 엑셀 견본(resources/tester/spreadsheet/fixture_excel_user_won.html, origin/main_desktop_1)으로 붙여넣기 시험 중 회계류 형식(예: `.xl126`)의 `\0022` — 진짜 CSS 유니코드 이스케이프(16진 1~6 자리, 따옴표 `"` 를 이렇게 실음) — 가 한 글자만 풀리고(`\0` → `0`) 나머지 `022` 가 그대로 남아 형식에 글자 "0022" 가 끼던 것 발견 · `unescapeMsoNumFmt` 가 `\x` 한 글자 이스케이프 앞에 `\` + 16진 1~6 자리 이스케이프를 먼저 찾게 고침 - 고친 뒤 회계 4구역 형식이 `_-* #,##0.00_-;\-* #,##0.00_-;_-* "-"??_-;_-@_-` 처럼 온전히 들어옴(글자 "0022" 없음 · 남는 홑 역슬래시 없음 · ₩ 없음) - ORCA 로 이 견본 통째 붙여넣기 확인 — 칸 133개 값 · 병합 9개 · Fixed·0·General· 0% 이름 형식 그대로 넘김 · 「 =」(앞에 공백 있어 원래도 식 아님) · 「1식」· 「3식」 글자 칸 모두 글로 남음(식으로 안 잡힘), 기존 회계 형식 견본 회귀 없음 - 수식 흔적(x:fmla) 없음 재확인 — 이 실 견본에도 x:str/x:num 만 있고 수식은 칸 글 자체가 「=...」 로 시작하는 형태(HTML 클립보드엔 수식이 안 실림) Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01AeeQRLknEpP4SFjVkjDWDs --- A00_Common/spreadsheet/spreadsheet_clipboard.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/A00_Common/spreadsheet/spreadsheet_clipboard.ts b/A00_Common/spreadsheet/spreadsheet_clipboard.ts index 06c25067..45c514d4 100644 --- a/A00_Common/spreadsheet/spreadsheet_clipboard.ts +++ b/A00_Common/spreadsheet/spreadsheet_clipboard.ts @@ -254,9 +254,16 @@ function cssColorToHex(v: string | undefined): string | undefined { return undefined; } -/** 엑셀 `mso-number-format:"\#\,\#\#0\.00"` — 따옴표 떼고 `\x` 이스케이프 풀기. */ +/** 엑셀 `mso-number-format:"\#\,\#\#0\.00"` — 따옴표 떼고 `\x` 이스케이프 풀기(`\0022` 처럼 진짜 + * CSS 유니코드 이스케이프(`\` + 16진 1~6 자리, 회계 형식 글자 구역 따옴표 `"` 를 이렇게 실음)도 + * 먼저 풀지 않으면 따옴표 대신 글자 "0022" 가 그대로 남아 형식이 깨짐 — sub5 numfmt 가 받는 + * 형식 코드에는 이 CSS 껍데기가 없어야 함). */ function unescapeMsoNumFmt(v: string): string { - return v.replace(/^"|"$/g, "").replace(/\\(.)/g, "$1"); + return v + .replace(/^"|"$/g, "") + .replace(/\\([0-9a-fA-F]{1,6}) ?|\\(.)/g, (_, hex, ch) => + hex !== undefined ? String.fromCodePoint(parseInt(hex, 16)) : ch, + ); } /** pt 굵기 → 우리 선 종류(엑셀 내보내기 흔한 값 기준 — hairline ≈ .5pt 이하 · thin ≈ 1pt · medium ≈