]> source.dussan.org Git - poi.git/commitdiff
[bug-66518] fix issue in AbstractExcelUtils.getColor(HSSFColor)
authorPJ Fanning <fanningpj@apache.org>
Wed, 8 Mar 2023 11:03:19 +0000 (11:03 +0000)
committerPJ Fanning <fanningpj@apache.org>
Wed, 8 Mar 2023 11:03:19 +0000 (11:03 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1908191 13f79535-47bb-0310-9956-ffa450edef68

poi-scratchpad/src/main/java/org/apache/poi/hssf/converter/AbstractExcelUtils.java

index a4f9b13e23ccf50ac291e7364b110f93953b48d8..9d85fea9719187abb15f686f084157f1b37d549a 100644 (file)
@@ -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";