From 9a181c1a2dc9a59da4ad9ad657cdea96f470420c Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Wed, 8 Mar 2023 11:03:19 +0000 Subject: [PATCH] [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 --- .../org/apache/poi/hssf/converter/AbstractExcelUtils.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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"; -- 2.39.5