Use POI on Android export word, use POI version 3.14, use is replaced in the 
template content to be derived, if the word template in the form of column 
number is less than or equal to 6 is replaced each column in the normal export 
of, if the form template is greater than 6 columns is derived from the word can 
not be opened, do not know what that is? You had encountered this problem? How 
to solve it.


code??
        public void writeDoc(File demoFile ,File newFile ,Map<String, String> 
map)
        {
                try
                {       
                        FileInputStream in = new FileInputStream(demoFile);
                        HWPFDocument hdt = new HWPFDocument(in);
                        // Fields fields = hdt.getFields();
                        // ????word????????
                        Range range = hdt.getRange();
                        // System.out.println(range.text());
                        
                        // ????????????
                        for(Map.Entry<String, String> entry : map.entrySet())
                        {
                                range.replaceText(entry.getKey(), 
entry.getValue());
                        }
                        ByteArrayOutputStream ostream = new 
ByteArrayOutputStream();
                        FileOutputStream out = new FileOutputStream(newFile, 
true);
                        hdt.write(ostream);
                        // ??????????
                        out.write(ostream.toByteArray());
                        out.close();
                        ostream.close();
                }
                catch(IOException e)
                {
                        e.printStackTrace();
                }
                catch(Exception e)
                {
                        e.printStackTrace();
                }
        }


template
         
????????????(??????????)
         
????????????????????
         
????????????????
         
????????????????
         
????????????????
         
??????????????????
         
????????????????
         
????????????????????
     
        
R15(M??)
         
063
         
064
         
065
         
066
         
067
         
068
         
069
     
        
R15(20??) (M??)
         
070
         
071
         
072
         
073
         
074
         
075
         
076
     
        
R60(M??)
         
077
         
078
         
079
         
080
         
081
         
082
         
083
     
        
R60(20??) (M??)
         
084
         
085
         
086
         
087
         
088
         
089
         
090
     
        
R600(M??)
         
091
         
092
         
093
         
094
         
095
         
096
         
097
     
        
R600(20??) (M??)
         
098
         
099
         
100
         
101
         
102
         
103
         
104
     
        
??????
         
105
         
106
         
107
         
108
         
109
         
110
         
111
     
        
????????
         
112
         
113
         
114
         
115
         
116
         
117
         
118
     
        
??????????119
   
??????????120
     
        
??????????121

Reply via email to