You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2011/03/18 15:43:23 UTC

svn commit: r1082938 - /poi/trunk/src/examples/src/org/apache/poi/xssf/usermodel/examples/BigGridDemo.java

Author: nick
Date: Fri Mar 18 14:43:22 2011
New Revision: 1082938

URL: http://svn.apache.org/viewvc?rev=1082938&view=rev
Log:
Ensure that BigGridDemo is consistent in the encoding of the XML

Modified:
    poi/trunk/src/examples/src/org/apache/poi/xssf/usermodel/examples/BigGridDemo.java

Modified: poi/trunk/src/examples/src/org/apache/poi/xssf/usermodel/examples/BigGridDemo.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/xssf/usermodel/examples/BigGridDemo.java?rev=1082938&r1=1082937&r2=1082938&view=diff
==============================================================================
--- poi/trunk/src/examples/src/org/apache/poi/xssf/usermodel/examples/BigGridDemo.java (original)
+++ poi/trunk/src/examples/src/org/apache/poi/xssf/usermodel/examples/BigGridDemo.java Fri Mar 18 14:43:22 2011
@@ -39,6 +39,8 @@ import org.apache.poi.xssf.usermodel.*;
  * @author Yegor Kozlov
  */
 public class BigGridDemo {
+    private static final String XML_ENCODING = "UTF-8";
+    
     public static void main(String[] args) throws Exception {
 
         // Step 1. Create a template file. Setup sheets and workbook-level objects such as
@@ -58,7 +60,7 @@ public class BigGridDemo {
 
         //Step 2. Generate XML file.
         File tmp = File.createTempFile("sheet", ".xml");
-        Writer fw = new FileWriter(tmp);
+        Writer fw = new OutputStreamWriter(new FileOutputStream(tmp), XML_ENCODING);
         generate(fw, styles);
         fw.close();
 
@@ -194,7 +196,7 @@ public class BigGridDemo {
         }
 
         public void beginSheet() throws IOException {
-            _out.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+            _out.write("<?xml version=\"1.0\" encoding=\""+XML_ENCODING+"\"?>" +
                     "<worksheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">" );
             _out.write("<sheetData>\n");
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org