aboutsummaryrefslogtreecommitdiffstats
path: root/src/examples
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2015-03-22 21:48:48 +0000
committerDominik Stadler <centic@apache.org>2015-03-22 21:48:48 +0000
commit7801cb1f549c7df249cf47fa4995db8832926cb3 (patch)
tree53ae60e6af9b3662c29cb96b7525206b4f7922dc /src/examples
parentdd875c9c040ac0e42326bb3c5b76a1d6748908ed (diff)
downloadpoi-7801cb1f549c7df249cf47fa4995db8832926cb3.tar.gz
poi-7801cb1f549c7df249cf47fa4995db8832926cb3.zip
Bug 55386: Fix handling of bold formatting in example application 'ToHtml'
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1668486 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/examples')
-rw-r--r--src/examples/src/org/apache/poi/ss/examples/html/ToHtml.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/examples/src/org/apache/poi/ss/examples/html/ToHtml.java b/src/examples/src/org/apache/poi/ss/examples/html/ToHtml.java
index b5480cf59e..bcfb5dffe6 100644
--- a/src/examples/src/org/apache/poi/ss/examples/html/ToHtml.java
+++ b/src/examples/src/org/apache/poi/ss/examples/html/ToHtml.java
@@ -289,7 +289,7 @@ public class ToHtml {
private void fontStyle(CellStyle style) {
Font font = wb.getFontAt(style.getFontIndex());
- if (font.getBoldweight() >= HSSFFont.BOLDWEIGHT_NORMAL)
+ if (font.getBoldweight() >= HSSFFont.BOLDWEIGHT_BOLD)
out.format(" font-weight: bold;%n");
if (font.getItalic())
out.format(" font-style: italic;%n");
@@ -309,8 +309,12 @@ public class ToHtml {
style = wb.getCellStyleAt((short) 0);
StringBuilder sb = new StringBuilder();
Formatter fmt = new Formatter(sb);
- fmt.format("style_%02x", style.getIndex());
- return fmt.toString();
+ try {
+ fmt.format("style_%02x", style.getIndex());
+ return fmt.toString();
+ } finally {
+ fmt.close();
+ }
}
private <K> void styleOut(String attr, K key, Map<K, String> mapping) {