From: PJ Fanning Date: Wed, 8 Mar 2023 11:03:19 +0000 (+0000) Subject: [bug-66518] fix issue in AbstractExcelUtils.getColor(HSSFColor) X-Git-Tag: REL_5_2_4~225 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9a181c1a2dc9a59da4ad9ad657cdea96f470420c;p=poi.git [bug-66518] fix issue in AbstractExcelUtils.getColor(HSSFColor) git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1908191 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hssf/converter/AbstractExcelUtils.java b/poi-scratchpad/src/main/java/org/apache/poi/hssf/converter/AbstractExcelUtils.java index a4f9b13e23..9d85fea971 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hssf/converter/AbstractExcelUtils.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hssf/converter/AbstractExcelUtils.java @@ -113,13 +113,13 @@ class AbstractExcelUtils { StringBuilder stringBuilder = new StringBuilder(7); stringBuilder.append('#'); for (short s : color.getTriplet()) { - if (s < 10) { + String hex = Integer.toHexString(s); + if (hex.length() == 1) { stringBuilder.append('0'); } - - stringBuilder.append(Integer.toHexString(s)); + stringBuilder.append(hex); } - String result = stringBuilder.toString(); + String result = color.getHexString(); if (result.equals("#ffffff")) { return "white";