From fa1e0a0b1d843dfe46f7f72cc42556a468f715a0 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Fri, 8 Jul 2011 14:27:21 +0000 Subject: [PATCH] Apply patch from bug #51476 - Correct XSSF cell formatting in HTML export git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1144331 13f79535-47bb-0310-9956-ffa450edef68 --- src/documentation/content/xdocs/status.xml | 1 + .../src/org/apache/poi/ss/examples/html/XSSFHtmlHelper.java | 6 +++++- src/java/org/apache/poi/ss/format/CellFormat.java | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index a85e1c0d1..f3d998c96 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,7 @@ + 51476 - Correct XSSF cell formatting in HTML export 51486 - XWPF support for adding new footnotes 48065 - Problems with save output of HWPF (losing formatting) 47563 - Exception when working with table diff --git a/src/examples/src/org/apache/poi/ss/examples/html/XSSFHtmlHelper.java b/src/examples/src/org/apache/poi/ss/examples/html/XSSFHtmlHelper.java index 08108e8e6..0fe76d17b 100644 --- a/src/examples/src/org/apache/poi/ss/examples/html/XSSFHtmlHelper.java +++ b/src/examples/src/org/apache/poi/ss/examples/html/XSSFHtmlHelper.java @@ -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 diff --git a/src/java/org/apache/poi/ss/format/CellFormat.java b/src/java/org/apache/poi/ss/format/CellFormat.java index c7c22f004..4f9ad1aaa 100644 --- a/src/java/org/apache/poi/ss/format/CellFormat.java +++ b/src/java/org/apache/poi/ss/format/CellFormat.java @@ -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: