]> source.dussan.org Git - poi.git/commitdiff
ability to change CSS building procedure
authorSergey Vladimirov <sergey@apache.org>
Thu, 27 Oct 2011 06:07:12 +0000 (06:07 +0000)
committerSergey Vladimirov <sergey@apache.org>
Thu, 27 Oct 2011 06:07:12 +0000 (06:07 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1189618 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/src/org/apache/poi/hwpf/converter/HtmlDocumentFacade.java

index 7c28c368658d72c5f0baf7edfc18f4f39877851c..b405b2cb6ac0bdbb6c4f7beeb83dc7e7f26a357e 100644 (file)
@@ -93,6 +93,28 @@ public class HtmlDocumentFacade
         element.setAttribute( "class", newClassValue );
     }
 
+    protected String buildStylesheet(
+            final Map<String, Map<String, String>> prefixToMapOfStyles )
+    {
+        StringBuilder stringBuilder = new StringBuilder();
+        for ( Map<String, String> byPrefix : prefixToMapOfStyles.values() )
+        {
+            for ( Map.Entry<String, String> byStyle : byPrefix.entrySet() )
+            {
+                String style = byStyle.getKey();
+                String className = byStyle.getValue();
+
+                stringBuilder.append( "." );
+                stringBuilder.append( className );
+                stringBuilder.append( "{" );
+                stringBuilder.append( style );
+                stringBuilder.append( "}\n" );
+            }
+        }
+        final String stylesheetText = stringBuilder.toString();
+        return stylesheetText;
+    }
+
     public Element createBlock()
     {
         return document.createElement( "div" );
@@ -255,17 +277,6 @@ public class HtmlDocumentFacade
 
     public void updateStylesheet()
     {
-        StringBuilder stringBuilder = new StringBuilder();
-        for ( Map<String, String> byPrefix : stylesheet.values() )
-        {
-            for ( Map.Entry<String, String> byStyle : byPrefix.entrySet() )
-            {
-                String style = byStyle.getKey();
-                String className = byStyle.getValue();
-
-                stringBuilder.append( "." + className + "{" + style + "}\n" );
-            }
-        }
-        stylesheetElement.setTextContent( stringBuilder.toString() );
+        stylesheetElement.setTextContent( buildStylesheet( stylesheet ) );
     }
 }