From 2077a666ab81637be72c58445c5fc5948ec583c1 Mon Sep 17 00:00:00 2001 From: mjkhan21 Date: Tue, 23 Jul 2024 13:57:50 +0900 Subject: [PATCH] =?UTF-8?q?CellDef.trackWidth(..)=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/cokr/xit/base/docs/xls/CellDef.java | 11 +++++++++-- src/main/java/cokr/xit/base/docs/xls/Style.java | 3 ++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/java/cokr/xit/base/docs/xls/CellDef.java b/src/main/java/cokr/xit/base/docs/xls/CellDef.java index 34a6947..d51571c 100644 --- a/src/main/java/cokr/xit/base/docs/xls/CellDef.java +++ b/src/main/java/cokr/xit/base/docs/xls/CellDef.java @@ -22,8 +22,15 @@ public class CellDef { /** 빈 셀 정보 */ public static CellDef EMPTY = new CellDef().setLabel("").setField(""); - public static int[] intArray(int endExclusive) { - return IntStream.range(0, endExclusive).toArray(); + /**셀의 너비를 추적(너비 < 1)할 컬럼의 인덱스를 반환한다. + * @param defs CellDef 목록 + * @return 셀의 너비를 추적할 컬럼의 인덱스 + */ + public static int[] trackWidth(List defs) { + return IntStream + .range(0, defs.size()) + .filter(pos -> defs.get(pos).width < 1) + .toArray(); } /**CellDef 목록에서 셀헤더 이름과 스타일을 반환한다. diff --git a/src/main/java/cokr/xit/base/docs/xls/Style.java b/src/main/java/cokr/xit/base/docs/xls/Style.java index c31d773..ef36953 100644 --- a/src/main/java/cokr/xit/base/docs/xls/Style.java +++ b/src/main/java/cokr/xit/base/docs/xls/Style.java @@ -60,7 +60,8 @@ public class Style { * @return 현재 Style */ public Style width(int chars) { - this.width = chars; + if (chars > 0) + this.width = chars; return this; }