]> source.dussan.org Git - poi.git/commitdiff
Apply patch from bug #51476 - Correct XSSF cell formatting in HTML export
authorNick Burch <nick@apache.org>
Fri, 8 Jul 2011 14:27:21 +0000 (14:27 +0000)
committerNick Burch <nick@apache.org>
Fri, 8 Jul 2011 14:27:21 +0000 (14:27 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1144331 13f79535-47bb-0310-9956-ffa450edef68

src/documentation/content/xdocs/status.xml
src/examples/src/org/apache/poi/ss/examples/html/XSSFHtmlHelper.java
src/java/org/apache/poi/ss/format/CellFormat.java

index a85e1c0d16c8d5b84ea7ddd4dab93f39cf9e4382..f3d998c9646c9f2d08ffc2f6df07eb2aef0af16e 100644 (file)
@@ -34,6 +34,7 @@
 
     <changes>
         <release version="3.8-beta4" date="2011-??-??">
+           <action dev="poi-developers" type="fix">51476 - Correct XSSF cell formatting in HTML export</action>
            <action dev="poi-developers" type="add">51486 - XWPF support for adding new footnotes</action>
            <action dev="poi-developers" type="fix">48065 - Problems with save output of HWPF (losing formatting)</action>
            <action dev="poi-developers" type="fix">47563 - Exception when working with table</action>
index 08108e8e6c3236ae4cb49a436e5f0dd5fbb6d159..0fe76d17be67f962bed40b7d0f3fc3b32faeb027 100644 (file)
@@ -58,7 +58,11 @@ public class XSSFHtmlHelper implements HtmlHelper {
         // support it will ignore the rgba specification and stick with the
         // solid color, which is declared first
         out.format("  %s: #%02x%02x%02x;%n", attr, rgb[0], rgb[1], rgb[2]);
+        byte[] argb = color.getARgb();
+        if (argb == null) {
+            return;
+        }
         out.format("  %s: rgba(0x%02x, 0x%02x, 0x%02x, 0x%02x);%n", attr,
-                rgb[0], rgb[1], rgb[2], rgb[3]);
+                argb[3], argb[0], argb[1], argb[2]);
     }
 }
\ No newline at end of file
index c7c22f004e50e93b02db01837e3fd0109a84c04e..4f9ad1aaa6bd1dbb4a079a22b9c3b7fd9645c9a6 100644 (file)
@@ -212,7 +212,7 @@ public class CellFormat {
         case Cell.CELL_TYPE_BLANK:
             return apply("");
         case Cell.CELL_TYPE_BOOLEAN:
-            return apply(c.getStringCellValue());
+            return apply(Boolean.toString(c.getBooleanCellValue()));
         case Cell.CELL_TYPE_NUMERIC:
             return apply(c.getNumericCellValue());
         case Cell.CELL_TYPE_STRING:
@@ -254,7 +254,7 @@ public class CellFormat {
         case Cell.CELL_TYPE_BLANK:
             return apply(label, "");
         case Cell.CELL_TYPE_BOOLEAN:
-            return apply(label, c.getStringCellValue());
+            return apply(Boolean.toString(c.getBooleanCellValue()));
         case Cell.CELL_TYPE_NUMERIC:
             return apply(label, c.getNumericCellValue());
         case Cell.CELL_TYPE_STRING: