diff --git a/A00_Common/spreadsheet/spreadsheet_numfmt.ts b/A00_Common/spreadsheet/spreadsheet_numfmt.ts index b2c277f2..66215037 100644 --- a/A00_Common/spreadsheet/spreadsheet_numfmt.ts +++ b/A00_Common/spreadsheet/spreadsheet_numfmt.ts @@ -185,7 +185,11 @@ function renderNumericSection(toks: Tok[], magnitude: Frac): string { const rawFracStr = fracDigitToks.length > 0 ? allDigits.slice(-fracDigitToks.length) : ""; let intStr = rawIntStr; - if (intDigitToks.length > intStr.length) { + // 정수부가 온통 `?`(회계 형식 0 구역의 `"-"??` 자리맞춤 버릇)뿐이고 값이 정말 0 이면 + // 자리마다 빈칸(엑셀은 `?` 를 「있으면 숫자 · 없으면 빈칸」으로 봄 — `0` 처럼 0 을 안 채움). + if (intDigitToks.length > 0 && rawIntStr === "0" && intDigitToks.every((t) => t.ch === "?")) { + intStr = " ".repeat(intDigitToks.length); + } else if (intDigitToks.length > intStr.length) { const need = intDigitToks.length - intStr.length; let pad = ""; for (let i = 0; i < need; i++) pad += intDigitToks[i].ch === "0" ? "0" : ""; diff --git a/resources/tester/spreadsheet/spreadsheet_b_test_entry.ts b/resources/tester/spreadsheet/spreadsheet_b_test_entry.ts index 6d739c64..cbdc8ca3 100644 --- a/resources/tester/spreadsheet/spreadsheet_b_test_entry.ts +++ b/resources/tester/spreadsheet/spreadsheet_b_test_entry.ts @@ -441,6 +441,16 @@ ok( fmt(frac(2n), '_-[$€-2]* #,##0.00_-;-[$€-2]* #,##0.00_-;_-[$€-2]* "-"??_-') === " €2.00 ", fmt(frac(2n), '_-[$€-2]* #,##0.00_-;-[$€-2]* #,##0.00_-;_-[$€-2]* "-"??_-'), ); +ok( + "회계형 0 구역 '-'?? 는 자리만(0 안 보임)", + fmt(frac(0n), '_-[$-412]* #,##0.00_-;-[$-412]* #,##0.00_-;_-[$-412]* "-"??_-') === " - ", + JSON.stringify(fmt(frac(0n), '_-[$-412]* #,##0.00_-;-[$-412]* #,##0.00_-;_-[$-412]* "-"??_-')), +); +ok( + "통화 로캘 태그만([$-412] · 기호 없음)은 통화 기호를 안 보임", + !fmt(frac(2n), "[$-412]#,##0.00").includes("₩") && fmt(frac(2n), "[$-412]#,##0.00") === "2.00", + fmt(frac(2n), "[$-412]#,##0.00"), +); ok("따옴표 접두·접미", fmt(frac(800n), '"φ"###') === "φ800", fmt(frac(800n), '"φ"###')); ok( "음수 회계형",