﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-小石头-文章分类-我的java学习</title><link>http://www.blogjava.net/yongbing/category/18984.html</link><description>Excellence in any department can be attained only by the labor of a lifetime; it is not to be purchased at a lesser price.</description><language>zh-cn</language><lastBuildDate>Wed, 28 Feb 2007 03:44:03 GMT</lastBuildDate><pubDate>Wed, 28 Feb 2007 03:44:03 GMT</pubDate><ttl>60</ttl><item><title>[转]半角和全角的转换</title><link>http://www.blogjava.net/yongbing/articles/94322.html</link><dc:creator>小石头</dc:creator><author>小石头</author><pubDate>Tue, 16 Jan 2007 15:10:00 GMT</pubDate><guid>http://www.blogjava.net/yongbing/articles/94322.html</guid><wfw:comment>http://www.blogjava.net/yongbing/comments/94322.html</wfw:comment><comments>http://www.blogjava.net/yongbing/articles/94322.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/yongbing/comments/commentRss/94322.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/yongbing/services/trackbacks/94322.html</trackback:ping><description><![CDATA[
		<p>关于全角转半角的问题，在Unicode中，标点、数字、字母的半角编码最高位均为0，它们的全角编码与半角编码的第三位相差32h。</p>
		<p>public class Test<br />{<br /> public static void main(String [] args)<br /> {<br />  String QJstr="HELLO";<br />  String QJstr1="ＨＥＬＬＯ";<br />     <br />     String result=BQchange(QJstr);<br />     String result1=QBchange(QJstr1);<br />    <br />      System.out.println(QJstr+"\n"+result);<br />      System.out.println(QJstr1+"\n"+result1);</p>
		<p>
				<br /> }</p>
		<p>//半角转全角<br />  public static final String BQchange(String QJstr)<br />  {<br />      String outStr="";<br />     String Tstr="";<br />     byte[] b=null;</p>
		<p>      for(int i=0;i&lt;QJstr.length();i++)<br />      {     <br />        try<br />        {<br />          Tstr=QJstr.substring(i,i+1);<br />          b=Tstr.getBytes("unicode");<br />        }<br />        catch(java.io.UnsupportedEncodingException e)<br />        {<br />          e.printStackTrace();<br />        }     <br />   <br />       if (b[3] !=-1)<br />       {<br />         b[2]=(byte)(b[2]-32);<br />         b[3]=-1;<br />         try<br />         {       <br />           outStr=outStr+new String(b,"unicode");<br />         }<br />         catch(java.io.UnsupportedEncodingException e)<br />         {<br />          e.printStackTrace();<br />         }      <br />       }<br />       else outStr=outStr+Tstr;<br />     }<br />    <br />     return outStr;<br />  }<br />  </p>
		<p>//全角转半角<br />  public static final String QBchange(String QJstr)<br />  {<br />     String outStr="";<br />     String Tstr="";<br />     byte[] b=null;</p>
		<p>     for(int i=0;i&lt;QJstr.length();i++)<br />     {     <br />       try<br />       {<br />         Tstr=QJstr.substring(i,i+1);<br />         b=Tstr.getBytes("unicode");<br />       }<br />       catch(java.io.UnsupportedEncodingException e)<br />       {<br />         e.printStackTrace();<br />       }     <br />   <br />       if (b[3] ==-1)<br />       {<br />         b[2]=(byte)(b[2]+32);<br />         b[3]=0;<br />        try<br />        {       <br />         outStr=outStr+new String(b,"unicode");<br />        }<br />        catch(java.io.UnsupportedEncodingException e)<br />        {<br />         e.printStackTrace();<br />        }      <br />       }<br />       else outStr=outStr+Tstr;<br />     }<br />    <br />     return outStr;<br />  }</p>
		<p>}</p>
		<p>输出结果为：</p>
		<p>HELLO<br />ＨＥＬＬＯ<br />ＨＥＬＬＯ<br />HELLO</p>
		<p> </p>
		<p>
				<br />Trackback: <a href="http://tb.blog.csdn.net/TrackBack.aspx?PostId=496423">http://tb.blog.csdn.net/TrackBack.aspx?PostId=496423</a></p>
		<p> </p>
<img src ="http://www.blogjava.net/yongbing/aggbug/94322.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/yongbing/" target="_blank">小石头</a> 2007-01-16 23:10 <a href="http://www.blogjava.net/yongbing/articles/94322.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>收藏blog</title><link>http://www.blogjava.net/yongbing/articles/93150.html</link><dc:creator>小石头</dc:creator><author>小石头</author><pubDate>Thu, 11 Jan 2007 06:15:00 GMT</pubDate><guid>http://www.blogjava.net/yongbing/articles/93150.html</guid><wfw:comment>http://www.blogjava.net/yongbing/comments/93150.html</wfw:comment><comments>http://www.blogjava.net/yongbing/articles/93150.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/yongbing/comments/commentRss/93150.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/yongbing/services/trackbacks/93150.html</trackback:ping><description><![CDATA[
		<p>简易java框架<br /><a href="/easyjf/">http://www.blogjava.net/easyjf/</a></p>
		<p>永远的船长<br /><a href="/buaacaptain/">http://www.blogjava.net/buaacaptain/</a></p>
		<p>华山论剑<br /><a href="/daxia/">http://www.blogjava.net/daxia/</a></p>
<img src ="http://www.blogjava.net/yongbing/aggbug/93150.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/yongbing/" target="_blank">小石头</a> 2007-01-11 14:15 <a href="http://www.blogjava.net/yongbing/articles/93150.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Quartz Cron Expression [转]</title><link>http://www.blogjava.net/yongbing/articles/93146.html</link><dc:creator>小石头</dc:creator><author>小石头</author><pubDate>Thu, 11 Jan 2007 05:59:00 GMT</pubDate><guid>http://www.blogjava.net/yongbing/articles/93146.html</guid><wfw:comment>http://www.blogjava.net/yongbing/comments/93146.html</wfw:comment><comments>http://www.blogjava.net/yongbing/articles/93146.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/yongbing/comments/commentRss/93146.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/yongbing/services/trackbacks/93146.html</trackback:ping><description><![CDATA[
		<div class="postTitle">
				<a class="postTitle2" id="viewpost1_TitleUrl" href="/allen-zhe/archive/2007/01/09/92668.html">
						<font color="#000000">Quartz Cron Expression</font>
				</a>
		</div>
		<p>
				<font face="Palatino Linotype">
						<strong>原文解释：</strong>
				</font>
		</p>
		<table class="confluenceTable">
				<tbody>
						<tr>
								<th class="confluenceTh">
										<font size="2">
												<font face="Palatino Linotype">Field Name</font>
										</font>
								</th>
								<th class="confluenceTh">
										<font size="2">
												<font face="Palatino Linotype">Mandatory?</font>
										</font>
								</th>
								<th class="confluenceTh">
										<font size="2">
												<font face="Palatino Linotype">Allowed Values</font>
										</font>
								</th>
								<th class="confluenceTh">
										<font size="2">
												<font face="Palatino Linotype">Allowed Special Characters</font>
										</font>
								</th>
						</tr>
						<tr>
								<td class="confluenceTd">
										<font size="2">
												<font face="Palatino Linotype">Seconds</font>
										</font>
								</td>
								<td class="confluenceTd">
										<font size="2">
												<font face="Palatino Linotype">YES</font>
										</font>
								</td>
								<td class="confluenceTd">
										<font size="2">
												<font face="Palatino Linotype">0-59</font>
										</font>
								</td>
								<td class="confluenceTd">
										<font size="2">
												<font face="Palatino Linotype">, - * /</font>
										</font>
								</td>
						</tr>
						<tr>
								<td class="confluenceTd">
										<font size="2">
												<font face="Palatino Linotype">Minutes</font>
										</font>
								</td>
								<td class="confluenceTd">
										<font size="2">
												<font face="Palatino Linotype">YES</font>
										</font>
								</td>
								<td class="confluenceTd">
										<font size="2">
												<font face="Palatino Linotype">0-59</font>
										</font>
								</td>
								<td class="confluenceTd">
										<font size="2">
												<font face="Palatino Linotype">, - * /</font>
										</font>
								</td>
						</tr>
						<tr>
								<td class="confluenceTd">
										<font size="2">
												<font face="Palatino Linotype">Hours</font>
										</font>
								</td>
								<td class="confluenceTd">
										<font size="2">
												<font face="Palatino Linotype">YES</font>
										</font>
								</td>
								<td class="confluenceTd">
										<font size="2">
												<font face="Palatino Linotype">0-23</font>
										</font>
								</td>
								<td class="confluenceTd">
										<font size="2">
												<font face="Palatino Linotype">, - * /</font>
										</font>
								</td>
						</tr>
						<tr>
								<td class="confluenceTd">
										<font size="2">
												<font face="Palatino Linotype">Day of month</font>
										</font>
								</td>
								<td class="confluenceTd">
										<font size="2">
												<font face="Palatino Linotype">YES</font>
										</font>
								</td>
								<td class="confluenceTd">
										<font size="2">
												<font face="Palatino Linotype">1-31</font>
										</font>
								</td>
								<td class="confluenceTd">
										<font size="2">
												<font face="Palatino Linotype">, - * ? / L W C</font>
										</font>
								</td>
						</tr>
						<tr>
								<td class="confluenceTd">
										<font size="2">
												<font face="Palatino Linotype">Month</font>
										</font>
								</td>
								<td class="confluenceTd">
										<font size="2">
												<font face="Palatino Linotype">YES</font>
										</font>
								</td>
								<td class="confluenceTd">
										<font size="2">
												<font face="Palatino Linotype">1-12 or JAN-DEC</font>
										</font>
								</td>
								<td class="confluenceTd">
										<font size="2">
												<font face="Palatino Linotype">, - * /</font>
										</font>
								</td>
						</tr>
						<tr>
								<td class="confluenceTd">
										<font size="2">
												<font face="Palatino Linotype">Day of week</font>
										</font>
								</td>
								<td class="confluenceTd">
										<font size="2">
												<font face="Palatino Linotype">YES</font>
										</font>
								</td>
								<td class="confluenceTd">
										<font size="2">
												<font face="Palatino Linotype">1-7 or SUN-SAT</font>
										</font>
								</td>
								<td class="confluenceTd">
										<font size="2">
												<font face="Palatino Linotype">, - * ? / L C #</font>
										</font>
								</td>
						</tr>
						<tr>
								<td class="confluenceTd">
										<font size="2">
												<font face="Palatino Linotype">Year</font>
										</font>
								</td>
								<td class="confluenceTd">
										<font size="2">
												<font face="Palatino Linotype">NO</font>
										</font>
								</td>
								<td class="confluenceTd">
										<font size="2">
												<font face="Palatino Linotype">empty, 1970-2099</font>
										</font>
								</td>
								<td class="confluenceTd">
										<font face="Palatino Linotype" size="2">, - * /</font>
								</td>
						</tr>
				</tbody>
		</table>
		<div align="left">
				<font face="Palatino Linotype">
				</font> </div>
		<div align="left">
				<font face="Palatino Linotype" color="#000080">
						<strong>项目实例：</strong>
				</font>
		</div>
		<div align="left">
				<font face="Palatino Linotype" color="#000080">              second  minute  hours  dayOfMonth  month  dayOfWeek  year</font>
		</div>
		<div align="left">
				<font face="Palatino Linotype" color="#000080">每月         0            0           6              ?                    *                6#3            ?</font>
		</div>
		<div align="left">
				<font face="Palatino Linotype">
						<div align="left">
								<font face="Palatino Linotype" color="#000080">每周        59           59         18            ?                    *                1                ?</font>
						</div>
						<div align="left">
								<div align="left">
										<font face="Palatino Linotype" color="#000080">自定义    28          47          9             30                 7                ?             2006</font>
								</div>
						</div>
				</font>
				<font face="Palatino Linotype">
				</font>
		</div>
		<div align="left">
				<font face="Palatino Linotype" color="#000080">
				</font> </div>
		<div align="left">
				<font face="Palatino Linotype" color="#000080">每月：每个月的第三个星期五的上午6:00:00 触发</font>
		</div>
		<div align="left">
				<font face="Palatino Linotype" color="#000080">每周：每周的星期日的下午18:59:59 触发</font>
		</div>
		<div align="left">
				<font face="Palatino Linotype" color="#000080">自定义：2006年7月30日上午9:47:28 触发</font>
		</div>
		<div align="left">
				<font face="Palatino Linotype">
				</font> </div>
		<div align="left">
				<font face="Palatino Linotype">
						<p>所有星号对应的段位置，都可以出现后面的符号（, - * /） <br />（? / L C）这些符号可以出现在"一月哪天"和"星期"段位置 <br />（w）只能出现在"一月哪天"段位置 <br />（#）只能出现在"星期"段位置</p>
						<p>解释符号代表的意思： <br />* 代表任意合法的字段 <br />0 * 17 * * ? ：表示在每天的5 PM 到 5:59之间的每一分钟启动scheduler <br /><br />? 表示没值被指定 <br />如果同时指定"一月哪天"和"星期"，可能两者对应不起来 <br />0 0,15,30,45 * * * ? ：表示每刻钟启动scheduler <br />所以推荐用法是其中一个指定值，另一个用?指定</p>
						<p>/ 表示时间的增量 <br />0 0/15 * * * ? ：表示每刻钟启动scheduler <br /><br />- 表示值的范围 <br />0 45 3-8 ? * * <br /><br />L 如果用在"一月哪天"段上，表示一个月的最后一天；如果用在"星期"段上。表示一个星期的最后一天（星期六） <br />0 0 8 L * ? ：表示每个月最后一天的8点启动scheduler <br /><br />W 表示最靠近给定时间的一天，（必须是星期一到星期五）</p>
						<p># 例如 6#3表示一个月的第三个星期五</p>
				</font>
		</div>
<img src ="http://www.blogjava.net/yongbing/aggbug/93146.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/yongbing/" target="_blank">小石头</a> 2007-01-11 13:59 <a href="http://www.blogjava.net/yongbing/articles/93146.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>通过构造XML数据流下载成Excel文件[转]</title><link>http://www.blogjava.net/yongbing/articles/92394.html</link><dc:creator>小石头</dc:creator><author>小石头</author><pubDate>Mon, 08 Jan 2007 07:38:00 GMT</pubDate><guid>http://www.blogjava.net/yongbing/articles/92394.html</guid><wfw:comment>http://www.blogjava.net/yongbing/comments/92394.html</wfw:comment><comments>http://www.blogjava.net/yongbing/articles/92394.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/yongbing/comments/commentRss/92394.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/yongbing/services/trackbacks/92394.html</trackback:ping><description><![CDATA[
		<div class="postTitle">
				<a class="postTitle2" id="viewpost1_TitleUrl" href="/wujiaqian/archive/2006/12/11/86970.html">
						<font color="#1a8bc8">通过构造XML数据流下载成Excel文件[原]</font>
				</a>
		</div>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
						<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /?>
						<o:p>    前些天做了一个EXCEL数据下载的东西,发现当数据超过10万行之后,就会内存溢出(用的是本机TOMCAT测试,内存有限,没能调过),新做一种方式,来感觉一下,发现速度有点慢,其他还可以. </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<b style="mso-bidi-font-weight: normal">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'; mso-bidi-font-size: 10.5pt">一、问题描述</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt">
								<o:p>
								</o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
						<span style="mso-tab-count: 1">    </span>
				</span>
				<span style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: Verdana; mso-bidi-font-family: 'Courier New'">该问题出现是因为在导出文件之后</span>
				<span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
				</span>
				<span style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: Verdana; mso-bidi-font-family: 'Courier New'">用户下载的是</span>
				<span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">.csv</span>
				<span style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: Verdana; mso-bidi-font-family: 'Courier New'">文件，如果用文本编辑器打开可以查看所有记录，但是如果用</span>
				<span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">excel</span>
				<span style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: Verdana; mso-bidi-font-family: 'Courier New'">打开就出现一个</span>
				<span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">sheet</span>
				<span style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: Verdana; mso-bidi-font-family: 'Courier New'">最多</span>
				<span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">6</span>
				<span style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: Verdana; mso-bidi-font-family: 'Courier New'">万条的记录。因此就不可以使用保存为</span>
				<span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-hansi-font-family: Verdana">csv</span>
				<span style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: Verdana; mso-bidi-font-family: 'Courier New'">文件来实现</span>
				<span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-hansi-font-family: Verdana">excel</span>
				<span style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: Verdana; mso-bidi-font-family: 'Courier New'">文件的下载，需要使用新的方式去实现。</span>
				<span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-hansi-font-family: Verdana">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-hansi-font-family: Verdana">
						<span style="mso-tab-count: 1">    </span>
				</span>
				<span style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: Verdana; mso-bidi-font-family: 'Courier New'">如果使用</span>
				<span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-hansi-font-family: Verdana">jxl</span>
				<span style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: Verdana; mso-bidi-font-family: 'Courier New'">开发包在</span>
				<span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-hansi-font-family: Verdana">web</span>
				<span style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: Verdana; mso-bidi-font-family: 'Courier New'">后台去创建</span>
				<span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-hansi-font-family: Verdana">Excel</span>
				<span style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: Verdana; mso-bidi-font-family: 'Courier New'">文件，如果数据量比较大，则用户需要等待很长很长的时间才可以下载到，因为</span>
				<span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-hansi-font-family: Verdana">jxl</span>
				<span style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: Verdana; mso-bidi-font-family: 'Courier New'">的对于</span>
				<span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-hansi-font-family: Verdana">excel</span>
				<span style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: Verdana; mso-bidi-font-family: 'Courier New'">文件的操作都是对象级的</span>
				<span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-hansi-font-family: Verdana">,</span>
				<span style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: Verdana; mso-bidi-font-family: 'Courier New'">文件中每一个格子都是一个</span>
				<span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-hansi-font-family: Verdana">cell</span>
				<span style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: Verdana; mso-bidi-font-family: 'Courier New'">对象，需要后台去</span>
				<span lang="EN-US" style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-hansi-font-family: Verdana">new</span>
				<span style="FONT-SIZE: 10pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: Verdana; mso-bidi-font-family: 'Courier New'">。所以还需要考虑别的方式。</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
						<span style="mso-tab-count: 1">    </span>
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<b style="mso-bidi-font-weight: normal">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'; mso-bidi-font-size: 10.5pt">二、实现灵感</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt">
								<o:p>
								</o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
						<span style="mso-tab-count: 1">    </span>Excel</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'">文件打开之后选择另存为可以保存为</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">XML</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'">类型文件，因此就考虑构造符合</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">Excel</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'">可以打开的</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">XML</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'">类型文件，并且对该</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">XML</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'">文件进行最简单化处理，去除</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">Excel</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'">文件中的每个</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">cell</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'">的</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">style</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'">定义、</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">XML</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'">文件头部的多余信息，最后整理出一个符合资讯平台所下载的</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">Excel</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'">文件的格式</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">,</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'">请看下面：</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
						<o:p> </o:p>
				</span>
		</p>
		<table class="MsoTableGrid" style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BACKGROUND: #e6e6e6; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-border-alt: solid windowtext .5pt; mso-yfti-tbllook: 480; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-border-insideh: .5pt solid windowtext; mso-border-insidev: .5pt solid windowtext" cellspacing="0" cellpadding="0" border="1">
				<tbody>
						<tr style="HEIGHT: 163.05pt; mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes">
								<td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 1pt solid; WIDTH: 426.1pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; HEIGHT: 163.05pt; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt" valign="top" width="568">
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'">&lt;!—XML</span>
												<span style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'">文件头部</span>
												<span lang="EN-US" style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'">--//&gt;<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">&lt;?xml version="1.0"?&gt;<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">&lt;Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
														<span style="mso-spacerun: yes"> </span>xmlns:o="urn:schemas-microsoft-com:office:office"<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
														<span style="mso-spacerun: yes"> </span>xmlns:x="urn:schemas-microsoft-com:office:excel"<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
														<span style="mso-spacerun: yes"> </span>xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
														<span style="mso-spacerun: yes"> </span>xmlns:html="http://www.w3.org/TR/REC-html40"&gt;<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
														<o:p> </o:p>
												</span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'">&lt;!—Excel</span>
												<span style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'">文件第一个</span>
												<span lang="EN-US" style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'">SHEET --//&gt;<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">&lt;Worksheet ss:Name="sheet0"&gt;<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">&lt;Table&gt;<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">&lt;Row&gt;<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">&lt;Cell&gt;&lt;Data ss:Type="String"&gt;aa0&lt;/Data&gt;&lt;/Cell&gt;<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">&lt;Cell&gt;&lt;Data ss:Type="String"&gt;aa1&lt;/Data&gt;&lt;/Cell&gt;<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">&lt;Cell&gt;&lt;Data ss:Type="String"&gt;aa2&lt;/Data&gt;&lt;/Cell&gt;<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">&lt;/Row&gt;<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">&lt;Row&gt;<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">&lt;Cell&gt;&lt;Data ss:Type="String"&gt;aa0&lt;/Data&gt;&lt;/Cell&gt;<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">&lt;Cell&gt;&lt;Data ss:Type="String"&gt;aa1&lt;/Data&gt;&lt;/Cell&gt;<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">&lt;Cell&gt;&lt;Data ss:Type="String"&gt;aa2&lt;/Data&gt;&lt;/Cell&gt;<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">&lt;/Row&gt;<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">&lt;/Table&gt;<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">&lt;/Worksheet&gt;<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
														<o:p> </o:p>
												</span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'">&lt;!—Excel</span>
												<span style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'">文件第二个</span>
												<span lang="EN-US" style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'">SHEET --//&gt;<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">&lt;Worksheet ss:Name="sheet1"&gt;<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">&lt;Table&gt;<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
														<span style="mso-tab-count: 1">    </span>&lt;!— </span>
												<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'">一行数据</span>
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">--//&gt;<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">&lt;Row&gt;<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">&lt;Cell&gt;&lt;Data ss:Type="String"&gt;aa0&lt;/Data&gt;&lt;/Cell&gt;<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">&lt;Cell&gt;&lt;Data ss:Type="String"&gt;aa1&lt;/Data&gt;&lt;/Cell&gt;<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">&lt;Cell&gt;&lt;Data ss:Type="String"&gt;aa2&lt;/Data&gt;&lt;/Cell&gt;<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">&lt;/Row&gt;<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">&lt;Row&gt;<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">&lt;Cell&gt;&lt;Data ss:Type="String"&gt;aa0&lt;/Data&gt;&lt;/Cell&gt;<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">&lt;Cell&gt;&lt;Data ss:Type="String"&gt;aa1&lt;/Data&gt;&lt;/Cell&gt;<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 21pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">&lt;Cell&gt;&lt;Data ss:Type="String"&gt;aa2&lt;/Data&gt;&lt;/Cell&gt;<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 42pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">&lt;/Row&gt;<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">&lt;/Table&gt;<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">&lt;/Worksheet&gt;<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
														<o:p> </o:p>
												</span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">&lt;/Workbook&gt;<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
														<o:p> </o:p>
												</span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'">&lt;!-- XML</span>
												<span style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'">文件结束</span>
												<span lang="EN-US" style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 'Courier New'">--//&gt;<o:p></o:p></span>
										</p>
										<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
												<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
														<o:p> </o:p>
												</span>
										</p>
								</td>
						</tr>
				</tbody>
		</table>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'">注释：</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">a</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'">、</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">&lt;Worksheet ss:Name="sheet0"&gt;<span style="mso-spacerun: yes">  </span></span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'">引号内部的是该</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">sheet</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'">的名称。</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">b</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'">、</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">&lt;Data ss:Type="String"&gt;aa1&lt;/Data&gt; <span style="mso-spacerun: yes"> </span>ss:Type</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'">的值是用来定义该</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">cell</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'">格数据的类型，例如可以为</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">Number,</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'">表是该</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">cell</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'">格数据是数字。</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<b style="mso-bidi-font-weight: normal">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'; mso-bidi-font-size: 10.5pt">三、实现方式</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.5pt">
								<o:p>
								</o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
						<span style="mso-tab-count: 1">    </span>
				</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'">通过第一步的分析可以发现只要我们构建这样格式的</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">XML</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'">数据，就可以通过</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">Excel</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'">打开，并且可以实现分</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">sheet</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'">的样式。但是数据下载到用户本地是</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">XML</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'">类型的话，那是没什么意义的，就算打开方式选择使用</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">Excel</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'">可以打开，因此如何将用户下载的文件类型改为</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">XLS</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'">呢？这里就可以通过在下载的</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">servlet</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'">中设置</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">response.setContentType("application/vnd.ms-excel")</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Courier New'; mso-hansi-font-family: 'Courier New'; mso-bidi-font-family: 'Courier New'">来实现。<br /></span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
						<o:p>我实现了五个类来封闭XML字符串(CellData,TableCell,TableRow,WorkBook,WorkSheet),写了一个测试类<br /><br />package com.hoten.util.xmlxls;</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
						<o:p>import java.util.List;<br />import java.util.ArrayList;</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
						<o:p>
								<font color="#ff0000">public class <strong>WorkBook</strong> {<br /></font> private final static String XML_HEARDER = "&lt;?xml version=\"1.0\"?&gt;";<br /> <br /> private List sheetList = new ArrayList(); //存放每行多个sheet的list<br /> <br /> /**<br />  * 取得workbook的xml文件的头部字符串<br />  * @return<br />  */<br /> private String getHeader(){  <br />  return XML_HEARDER + <br />    "&lt;Workbook xmlns=\"urn:schemas-microsoft-com:office:spreadsheet\"" + Contants.SEP_N + <br />    " xmlns:o=\"urn:schemas-microsoft-com:office:office\"" + Contants.SEP_N + <br />    " xmlns:x=\"urn:schemas-microsoft-com:office:excel\"" +  Contants.SEP_N + <br />    " xmlns:ss=\"urn:schemas-microsoft-com:office:spreadsheet\"" + Contants.SEP_N + <br />    " xmlns:html=\"<a href="http://www.w3.org/TR/REC-html40/"><font color="#1a8bc8">http://www.w3.org/TR/REC-html40\</font></a>"&gt;" + Contants.SEP_N ; <br /> } <br /> <br /> private String getFoot(){<br />  return "&lt;/Workbook&gt;";<br /> }<br /> <br /> public String toString(){<br />  StringBuffer strBuff = new StringBuffer();<br />  <br />  strBuff.append(getHeader());<br />  <br />  int len = sheetList.size();<br />  for(int i=0;i&lt;len;i++){<br />   WorkSheet sheet = (WorkSheet)sheetList.remove(0);<br />   strBuff.append(sheet.toString());<br />   sheet = null;<br />  }  <br />  sheetList.clear();<br />  <br />  strBuff.append(getFoot());<br />  <br />  return strBuff.toString();<br /> }<br /> <br /> public void addSheet(WorkSheet sheet){<br />  sheetList.add(sheet);<br /> }<br /> <br /> public void removeSheet(int i){<br />  sheetList.remove(i);<br /> }  <br />}<br /><br /><br />package com.hoten.util.xmlxls;</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
						<o:p>import java.util.List;<br />import java.util.ArrayList;</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
						<o:p>
								<font color="#ff0000">public class <strong>WorkSheet </strong>{</font>
								<br /> <br /> private String name = ""; //该sheet的name<br /> <br /> private List rowList = new ArrayList(); //存放每行多个row的list<br /> <br /> public String toString(){<br />  StringBuffer strBuff = new StringBuffer();<br />  <br />  strBuff.append("&lt;Worksheet ss:Name=\"" + name + "\"&gt;").append(Contants.SEP_N);<br />  strBuff.append("&lt;Table&gt;").append(Contants.SEP_N);<br />  <br />  int len = rowList.size();<br />  for(int i=0;i&lt;len;i++){<br />   TableRow row = (TableRow)rowList.remove(0);<br />   strBuff.append(row.toString());<br />   row = null;<br />  }  <br />  rowList.clear();<br />  <br />  strBuff.append("&lt;/Table&gt;").append(Contants.SEP_N);<br />  strBuff.append("&lt;/Worksheet&gt;").append(Contants.SEP_N);<br />  <br />  return strBuff.toString();<br /> }<br /> <br /> public void addRow(TableRow row){<br />  rowList.add(row);<br /> }<br /> <br /> public void removeRow(int i){<br />  rowList.remove(i);<br /> }</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
						<o:p> public String getName() {<br />  return name;<br /> }</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
						<o:p> public void setName(String name) {<br />  this.name = name;<br /> } <br />}<br /><br /><br />package com.hoten.util.xmlxls;</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
						<o:p>import java.util.List;<br />import java.util.ArrayList;</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
						<o:p>
								<font color="#ff0000">public class <strong>TableRow</strong> {</font>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
						<o:p> private List cellList = new ArrayList(); //存放每行多个cell的list<br /> <br /> <br /> public String toString(){<br />  StringBuffer strBuff = new StringBuffer();<br />  <br />  strBuff.append("&lt;Row&gt;").append(Contants.SEP_N);</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
						<o:p>  //循环显示每行的cell<br />  int len = cellList.size();<br />  for(int i=0;i&lt;len;i++){<br />   TableCell cell = (TableCell)cellList.remove(0);<br />   strBuff.append(cell.toString()).append(Contants.SEP_N);<br />   cell = null;   <br />  }<br />  cellList.clear();<br />  <br />  strBuff.append("&lt;/Row&gt;").append(Contants.SEP_N);<br />  <br />  return strBuff.toString();<br /> } <br /> <br /> public void addCell(TableCell cell){<br />  cellList.add(cell);<br /> }<br /> <br /> public void removeCell(int i){<br />  cellList.remove(i);<br /> }<br /> <br />}<br /><br /><br />package com.hoten.util.xmlxls;</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
						<o:p>
								<font color="#ff0000">public class <strong>TableCell</strong> {</font>
								<br /> private String index = ""; //cell在每行显示的索引位置,可以不填<br /> <br /> private CellData data = new CellData(); //cell的数据对象</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
						<o:p> public CellData getData() {<br />  return data;<br /> }</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
						<o:p> public void setData(CellData data) {<br />  this.data = data;<br /> }</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
						<o:p> public String getIndex() {<br />  return index;<br /> }</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
						<o:p> public void setIndex(String index) {<br />  this.index = index;<br /> }<br /> <br /> <br /> public String toString(){<br />  return "&lt;Cell&gt;" + data.toString() + "&lt;/Cell&gt;";<br /> }<br /> <br />}<br /><br /><br />package com.hoten.util.xmlxls;</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
						<o:p>
								<font color="#ff0000">public class <strong>CellData</strong> {</font>
								<br /> private String type = "String"; //cell数据类型<br /> private String value = ""; //cell数据<br /> <br /> public String getType() {<br />  return type;<br /> }<br /> public void setType(String type) {<br />  this.type = type;<br /> }<br /> public String getValue() {<br />  return value;<br /> }<br /> public void setValue(String value) {<br />  this.value = value;<br /> }<br /> <br /> <br /> public String toString(){<br />  return "&lt;Data ss:Type=\"" + type + "\"&gt;" + value + "&lt;/Data&gt;";<br /> }<br />}<br /><br /><br /><br />package com.hoten.util.xmlxls;</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
						<o:p>
								<font color="#ff0000">public class <strong>Contants </strong>{</font>
								<br /> public final static String SEP_N = "\n";<br /> /**<br />  * XML中常量定义<br />  */<br /> public final static String SS_NAME = "ss:Name";<br /> public final static String SS_INDEX = "ss:Index";<br /> public final static String SS_TYPE = "ss:Type";</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
						<o:p>}<br /><br /><br /><br />测试的方法:<br />PrintWriter out = response.getWriter();<br />         // 设置响应头和下载保存的文件名<br />         response.setContentType("application/vnd.ms-excel");<br />         response.setHeader("Content-Disposition","attachment; filename=\""+Chinese.toPage(fileNametemp)+"\"");<br />         <br />         String rows_temp = request.getParameter("rows");//页面传过来的每个SHEET可以存放的条数<br />   if (rows_temp == null){<br />    rows_temp = "20000";<br />   }<br />   int count_rows = Integer.parseInt(rows_temp);//一个SHEET有多行<br />         <br />         WorkBook book = new WorkBook();<br />         Vector v_Rs = RsToVector.ResultSetToVector(rs);// 把RS的值转换成VECTOR,这个可以看我上一版本,上面有详细的写法<br />         <br />         if (v_Rs != null) {<br />    int a = v_Rs.size();    <br />    int sheet_count = a / count_rows;// 30000行一个sheet。<br />    <br />    if (sheet_count &gt;0){//大于0，则需要多个SHEET<br />     for (int i = 0;i&lt;sheet_count;i++){<br />      WorkSheet sheet = new WorkSheet();//创建一个新的SHEET<br />      sheet.setName("sheet" + i);//设置SHEET的名称<br />           <br />      for (int b = i* count_rows ;b&lt;(i+1) * count_rows ;b++){       <br />       //temp_v.add(v_Rs.get(b));<br />       Vector temp_v = new Vector();<br />       temp_v =(Vector) v_Rs.get(b);       <br />       //取出一个对象,把对象的值放到EXCEL里<br />       TableRow row = new TableRow();//设置行 <br />       for(int m=0;m&lt;numColumns;m++){<br />              TableCell cell = new TableCell();<br />              CellData data = new CellData();<br />              data.setValue((String)temp_v.get(m));<br />              cell.setData(data);              <br />              row.addCell(cell);<br />             }             <br />             sheet.addRow(row);<br />      } <br />      book.addSheet(sheet);<br />     }<br />     //还有剩余的数据<br />     if (sheet_count * count_rows &lt; a){<br />      WorkSheet sheet = new WorkSheet();//创建一个新的SHEET<br />      sheet.setName("sheet" + sheet_count);//设置SHEET的名称<br />       <br />      for (int c = sheet_count* count_rows ;c&lt;a ;c++){       <br />       Vector temp_vv = new Vector();<br />       temp_vv =(Vector) v_Rs.get(c);<br />       //取出一个对象,把对象的值放到EXCEL里<br />       TableRow row = new TableRow();//设置行<br />       for(int m=0;m&lt;numColumns;m++){<br />              TableCell cell = new TableCell();<br />              CellData data = new CellData();<br />              data.setValue((String)temp_vv.get(m));<br />              cell.setData(data);              <br />              row.addCell(cell);<br />             }             <br />             sheet.addRow(row);       <br />      }<br />      book.addSheet(sheet);       <br />     }<br />    }else{<br />     <br />     <br />      WorkSheet sheet = new WorkSheet();//创建一个新的SHEET<br />      sheet.setName("sheet1");//设置SHEET的名称<br />           <br />      for (int bb=0  ;bb&lt;a ;bb++){       <br />       //temp_v.add(v_Rs.get(b));<br />       Vector temp_v = new Vector();<br />       temp_v =(Vector) v_Rs.get(bb);       <br />       //取出一个对象,把对象的值放到EXCEL里<br />       TableRow row = new TableRow();//设置行 <br />       for(int m=0;m&lt;numColumns;m++){<br />              TableCell cell = new TableCell();<br />              CellData data = new CellData();<br />              data.setValue((String)temp_v.get(m));<br />              cell.setData(data);              <br />              row.addCell(cell);<br />             }             <br />             sheet.addRow(row);<br />      } <br />      book.addSheet(sheet);<br />    }<br />         <br />    out.print(book.toString());<br />   }<br />    以上拼XML的时候重复代码比较多,可以写一个公用的方法,,我为了把XML描述的详细一点,把这些都封装成了对象,但在拼字符串的时候,对象就会太多,以后如果改版的话,可以把它尽量封装少一点对象,这样速度可能会快一点,内存可能会少用一点.</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">
				</span> </p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: 'Courier New'">转 : <a href="/wujiaqian/archive/2006/12/11/86970.html">http://www.blogjava.net/wujiaqian/archive/2006/12/11/86970.html</a></span>
		</p>
<img src ="http://www.blogjava.net/yongbing/aggbug/92394.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/yongbing/" target="_blank">小石头</a> 2007-01-08 15:38 <a href="http://www.blogjava.net/yongbing/articles/92394.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>根据RS取值的条数,动态生成EXCEL的工作簿[转] </title><link>http://www.blogjava.net/yongbing/articles/92392.html</link><dc:creator>小石头</dc:creator><author>小石头</author><pubDate>Mon, 08 Jan 2007 07:35:00 GMT</pubDate><guid>http://www.blogjava.net/yongbing/articles/92392.html</guid><wfw:comment>http://www.blogjava.net/yongbing/comments/92392.html</wfw:comment><comments>http://www.blogjava.net/yongbing/articles/92392.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/yongbing/comments/commentRss/92392.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/yongbing/services/trackbacks/92392.html</trackback:ping><description><![CDATA[
		<div class="postTitle">
				<a class="postTitle2" id="viewpost1_TitleUrl" href="/wujiaqian/archive/2006/12/08/86269.html">
						<font color="#1a8bc8">根据RS取值的条数,动态生成EXCEL的工作簿[原]</font>
				</a>
		</div>
		<p>      以前公司在做下载数据的时候,主要是用以下这种方式：<br /><br />      <font color="#0000ff">response.setContentType("APPLICATION/OCTET-STREAM");<br /><br />      response.setHeader("Content-Disposition", "attachment; filename=\""+ Chinese.toPage(fileName) + "\"");</font><br /><br />      但这有个不好的就是它只能打开一个EXCEL的一个工作簿，如果数据量非常大的话，后面的数据会丢失，根据这个BUG，我重新做了一个动态生成EXCEL工作薄的例子，以方便后面对此应用的改造。<br /><br /> 首先从数据库里取数据的时候，不知道行，列，这样就需要一个动作，把RS转换成一个VECTOR，此对象里每一行也是一个VECTOR<br />  public static Vector ResultSetToVector(ResultSet rs) {<br />    try {<br />      Vector rows = new Vector();<br />      ResultSetMetaData rsmd = rs.getMetaData();<br />      Vector columnHeads = new Vector();</p>
		<p>      for (int i = 1; i &lt;= rsmd.getColumnCount(); i++) {<br />        columnHeads.addElement(rsmd.getColumnName(i));<br />      }</p>
		<p>      Vector currentRow;<br />      while(rs.next()){<br />        currentRow = new Vector();<br />        for (int i = 1; i &lt;= rsmd.getColumnCount(); i++) {<br />          currentRow.addElement(Chinese.fromDatabase(rs.getString(i)));<br />        }<br />        rows.addElement(currentRow);<br />      }<br />      return rows;<br />    }<br />    catch (Exception err) {<br />      Log.printError(err, "", "", log);<br />      return null;<br />    }<br />    finally{<br />      try {<br />        if(rs!=null){<br />          rs.close();<br />          rs = null;<br />        }<br />      }<br />      catch (Exception ex) {<br />      }<br />    }<br /><br /> 再通过写一个方法，把VECTOR的值放到EXCEL里去。<br />   ResultSetMetaData rmeta = rs.getMetaData();<br />   int numColumns = rmeta.getColumnCount();//取多少行<br />   String fileNametemp = "c:\\"+fileName;<br />   fileNametemp = fileNametemp.substring(0,fileNametemp.lastIndexOf("."))+CTime.getTime(12)+".xls";<br />   <br />   java.io.File file = new java.io.File(fileNametemp);<br />   if (file.exists()) {<br />    file.delete();<br />   }<br />   String rows_temp = request.getParameter("rows");//页面传过来的每个SHEET可以存放的条数<br />   if (rows_temp == null){<br />    rows_temp = "20000";// 一个表单默认20000行。<br />   }<br />   int count_rows = Integer.parseInt(rows_temp);<br />   WritableWorkbook wb = Workbook.createWorkbook(file);<br />     <br />    Vector v_Rs = RsToVector.ResultSetToVector(rs);// 把RS的值转换成VECTOR<br />   boolean fg = true;    <br />    if (v_Rs != null) {<br />    int a = v_Rs.size();    <br />    int sheet_count = a / count_rows;    <br />    if (sheet_count &gt;0){//大于0，则需要多个SHEET<br />     for (int i = 0;i&lt;sheet_count;i++){<br />      Vector temp_v = new Vector();<br />      for (int b = i* count_rows ;b&lt;(i+1) * count_rows ;b++){<br />       <br />       temp_v.add(v_Rs.get(b));<br />      }      <br />      writeExcel(wb,"sheet"+i,temp_v,numColumns,sheet_count);//EXCEL对象、单元薄名、数据、行数、第几个单元薄      <br />     }    <br />     <br />     if (sheet_count * count_rows &lt; a){//不是正好，还有剩余<br />      Vector temp_vv = new Vector();<br />      for (int c = sheet_count* count_rows ;c&lt;a ;c++){       <br />       temp_vv.add(v_Rs.get(c));<br />      }<br />      writeExcel(wb,"sheet"+(sheet_count+1),temp_vv,numColumns,sheet_count+1);//EXCEL对象、单元薄名、数据、行数、第几个单元薄 <br />     }<br />    }else{<br />     writeExcel(wb,"sheet"+sheet_count,v_Rs,numColumns,0);//EXCEL对象、单元薄名、数据、行数、第几个单元薄 <br />    }<br />    fg = true;<br />   }else{<br />    fg = false;<br />   }<br />   wb.write();<br />   wb.close();<br />   String msgs = "";<br />   PrintWriter out = response.getWriter();<br />   if (fg){<br />    msgs = "保存的文件名是"+fileNametemp;<br />    msgs = Chinese.toPage(msgs);    <br />   }else{<br />    msgs = Chinese.toPage("没有数据导出！");    <br />   }<br />   int seg = msgs.indexOf(":");<br />   msgs = msgs.substring(0,seg)+":\\"+msgs.substring(seg+1,msgs.length());<br />   out.println("&lt;script&gt;alert('"+msgs+"');window.close();&lt;/script&gt;");<br /><br /><br />   <br />写EXCLE的方法<br />   /**<br />     * 写Excel文件<br />     * @param filepath String<br />     * @param sheetname String  工作簿名称<br />     * @param list Vector   内容<br />     * @param colum int     列数<br />     * @return boolean<br />     */<br /> private boolean writeExcel(WritableWorkbook wb ,String sheetname,<br />   Vector list, int colum,int count) {<br />  String temp = "";<br />  String[] s;<br />  int i = 0;<br />  try {<br />   if (list == null) {<br />    return false;<br />   }<br />   <br />   WritableSheet ws = wb.createSheet(sheetname, count);<br />   if (colum == 1) {<br />    while (i != list.size() &amp;&amp; list.size() &gt; 0) {<br />     temp = (String) list.get(i);<br />     Label labelC = new Label(i, 0, temp);<br />     ws.addCell(labelC);<br />     i++;<br />    }<br />   } else {<br />    while (i != list.size() &amp;&amp; list.size() &gt; 0) {<br />     //s = (String[]) list.get(i);<br />     Vector tm = (Vector) list.get(i);<br />     if (tm == null) {<br />      continue;<br />     } else {<br />      int kk = tm.size();<br />      for (int j = 0; j &lt; kk; j++) {<br />       temp = (String)tm.get(j);<br />       Label labelC = new Label(j, i, temp);<br />       ws.addCell(labelC);<br />      }<br />     }<br />     i++;<br />    }<br />   }<br />  } catch (Exception ex) {<br />   Log.printError(ex, "写excel文件错误", "", "writeexcel.log");<br />   return false;<br />  }<br />  return true;<br /> }<br /><br /><br /><br />以上方法也有一个问题，就是当程序写100000条数据以后，速度会慢下来，我看了WritableWorkbook 的构造方法的时候，可以生成一个OUTPUTSTREAM对象的，我想可以用这个来做，速度可能会上去，但具体也没有试，如何有哪位哥们试过了，把性能跟兄弟分享一下！谢谢了！<br /><br />转自 : <a href="/wujiaqian/archive/2006/12/08/86269.html">http://www.blogjava.net/wujiaqian/archive/2006/12/08/86269.html</a></p>
<img src ="http://www.blogjava.net/yongbing/aggbug/92392.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/yongbing/" target="_blank">小石头</a> 2007-01-08 15:35 <a href="http://www.blogjava.net/yongbing/articles/92392.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>用JXL写EXCEL方法的封装[转] </title><link>http://www.blogjava.net/yongbing/articles/92382.html</link><dc:creator>小石头</dc:creator><author>小石头</author><pubDate>Mon, 08 Jan 2007 07:19:00 GMT</pubDate><guid>http://www.blogjava.net/yongbing/articles/92382.html</guid><wfw:comment>http://www.blogjava.net/yongbing/comments/92382.html</wfw:comment><comments>http://www.blogjava.net/yongbing/articles/92382.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/yongbing/comments/commentRss/92382.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/yongbing/services/trackbacks/92382.html</trackback:ping><description><![CDATA[
		<div class="postTitle">
				<strong>前些日子写了一些关于EXCEL解决的方法,今天用JXL写文件的方法,来处理。把封装好的东西发上来，大家一起看看。<br /></strong>
				<br />
				<font face="Courier New">import java.util.*;<br />import java.io.*;<br />import java.sql.*;<br />import jxl.*;<br />import jxl.write.*;</font>
		</div>
		<p>
				<font face="Courier New">/**<br /> * 提供了常用的Excel读取和写入的方法<br /> * &lt;p&gt; * Title: * &lt;/p&gt;<br /> * &lt;p&gt; * Description: * &lt;/p&gt;<br /> * &lt;p&gt; * Copyright: Copyright (c) 2006 * &lt;/p&gt;<br /> * &lt;p&gt; * Company: * &lt;/p&gt;<br /> *  * @author wujiaqian * @version 1.0<br /> */</font>
		</p>
		<p>
				<font face="Courier New">public class Excel {<br /> int sheetCount = 1; // excel工作簿，默认为1</font>
		</p>
		<p>
				<font face="Courier New"> WritableWorkbook wwb = null; // 构建Workbook对象,只读Workbook对象</font>
		</p>
		<p>
				<font face="Courier New"> Vector vSheet = null;</font>
		</p>
		<p>
				<font face="Courier New"> /**<br />  * 无参构造函数，生成默认名字的excel文件<br />  */<br /> public Excel() {<br />  this("noName.excel");<br /> }</font>
		</p>
		<p>
				<font face="Courier New"> /**<br />  * 带有一个String类型参数的构造函数<br />  * <br />  * @param fileName<br />  * String 将要生成的excel文件名<br />  */<br /> public Excel(String fileName) {<br />  try {<br />   wwb = Workbook.createWorkbook(new File(fileName));<br />   vSheet = new Vector(5);<br />  } catch (Exception e) {<br />  }<br /> }</font>
		</p>
		<p>
				<font face="Courier New"> /**<br />  * 带有一个File类型参数的构造函数<br />  * <br />  * @param fileName<br />  *  String 将要生成的excel文件名<br />  */<br /> public Excel(File file) {<br />  try {<br />   wwb = Workbook.createWorkbook(file);<br />   vSheet = new Vector(5);<br />  } catch (Exception e) {<br />  }<br /> }</font>
		</p>
		<p>
				<font face="Courier New"> /**<br />  * 读取一个EXCEL文件的所有行和列,在同一行上的数据以一个String的形式保存在Vector中,各列数据以","号分割<br />  * <br />  * @param fileName<br />  *        String 文件名<br />  * @throws Exception<br />  * @return Vector<br />  */<br /> public static Vector readFromExcel(String fileName) throws Exception {<br />  Vector v = new Vector();<br />  File file = new File(fileName);<br />  if (!file.isFile()) {<br />   return null;<br />  }<br />  v = readExl(file, -1, -1);<br />  return v;<br /> }</font>
		</p>
		<p>
				<font face="Courier New"> public static Vector readFromExcel(File file) throws Exception {<br />  Vector v = new Vector();<br />  if (!file.isFile()) {<br />   return null;<br />  }<br />  v = readExl(file, -1, -1);<br />  return v;<br /> }</font>
		</p>
		<p>
				<font face="Courier New"> /**<br />  * 读取一行多列或者一列多行<br />  * <br />  * @param fileName<br />  *        String 文件名<br />  * @param rowORcol<br />  *        int 第几行或者第几列<br />  * @param flag<br />  *        String ROW表示前面一个参数的值指的是行数，行COL表示前面一个参数的值指的是列数<br />  * @throws Exception<br />  * @return Vector<br />  */<br /> public static Vector readFromExcel(String fileName, int rowORcol,<br />   String flag) throws Exception {<br />  Vector v = new Vector();<br />  File file = new File(fileName);<br />  if (!file.isFile()) {<br />   return null;<br />  }<br />  if (flag != null &amp;&amp; flag.equals("ROW")) {<br />   v = readExl(file, rowORcol, -1);<br />  } else if (flag != null &amp;&amp; flag.equals("COL")) {<br />   v = readExl(file, -1, rowORcol);<br />  } else {<br />   return null;<br />  }<br />  return v;<br /> }</font>
		</p>
		<p>
				<font face="Courier New"> public static Vector readFromExcel(File file, int rowORcol, String flag)<br />   throws Exception {<br />  Vector v = new Vector();<br />  if (!file.isFile()) {<br />   return null;<br />  }<br />  if (flag != null &amp;&amp; flag.equals("ROW")) {<br />   v = readExl(file, rowORcol, -1);<br />  } else if (flag != null &amp;&amp; flag.equals("COL")) {<br />   v = readExl(file, -1, rowORcol);<br />  } else {<br />   return null;<br />  }</font>
		</p>
		<p>
				<font face="Courier New">  return v;<br /> }</font>
		</p>
		<p>
				<font face="Courier New"> /**<br />  * 读取多行或者多列,可以任意挑选几行或几列<br />  * <br />  * @param fileName<br />  *        String 文件名<br />  * @param rowORcol<br />  *        int 任意的行或列<br />  * @param flag<br />  *        String ROW表示行COL表示列<br />  * @throws Exception<br />  * @return Vector<br />  */<br /> public static Vector readFromExcel(String fileName, int[] rowORcol,<br />   String flag) throws Exception {<br />  Vector v = new Vector();<br />  return v;<br /> }</font>
		</p>
		<p>
				<font face="Courier New"> public static Vector readFromExcel(File file, int[] rowORcol, String flag)<br />   throws Exception {<br />  Vector v = new Vector();<br />  return v;<br /> }</font>
		</p>
		<p>
				<font face="Courier New"> /**<br />  * 读取第几行第几列的一个数据<br />  * <br />  * @param fileName<br />  *            String<br />  * @param row<br />  *            int<br />  * @param col<br />  *            int<br />  * @throws Exception<br />  * @return String<br />  */<br /> public static String readFromExcel(String fileName, int row, int col)<br />   throws Exception {<br />  String res = null;<br />  File file = new File(fileName);<br />  if (!file.isFile()) {<br />   return null;<br />  }<br />  return res;<br /> }</font>
		</p>
		<p>
				<font face="Courier New"> public static String readFromExcel(File file, int row, int col)<br />   throws Exception {<br />  String res = null;<br />  if (!file.isFile()) {<br />   return null;<br />  }</font>
		</p>
		<p>
				<font face="Courier New">  return res;<br /> }</font>
		</p>
		<p>
				<font face="Courier New"> /**<br />  * 读取xls文件<br />  * <br />  * @param f<br />  *        File 文件<br />  * @param row<br />  *        int 读取从0到row行<br />  * @param col<br />  *        int 读取从0到col列<br />  * @throws Exception<br />  * @return Vector<br />  */</font>
		</p>
		<p>
				<font face="Courier New"> private static Vector readExl(File f, int row, int col) throws Exception {<br />  Vector v = new Vector();<br />  Workbook wb = null;<br />  Sheet st = null;<br />  wb = Workbook.getWorkbook(f);<br />  st = wb.getSheet(0);<br />  int allRow = st.getRows();<br />  if (row == -1) {<br />   row = allRow;<br />  }<br />  int allCol = st.getColumns();<br />  if (col == -1) {<br />   col = allCol;<br />  }<br />  for (int i = 0; i &lt; row; i++) {<br />   String sRow = null;<br />   for (int j = 0; j &lt; col; j++) {<br />    Cell c1 = st.getCell(j, i);<br />    String sCol = c1.getContents();<br />    if (j == 0) {<br />     sRow = sCol;<br />    } else {<br />     if (sCol != null) {<br />      sRow = sRow + "," + sCol;<br />     } else {<br />      sRow = sRow + "," + "";<br />     }<br />    }<br />    c1 = null;<br />    sCol = null;<br />   }<br />   v.addElement(sRow);<br />   sRow = null;<br />  }</font>
		</p>
		<p>
				<font face="Courier New">  st = null;<br />  wb.close();<br />  wb = null;<br />  return v;<br /> }</font>
		</p>
		<p>
				<font face="Courier New"> public void addSheet() throws Exception {<br />  addSheet(String.valueOf(sheetCount));<br /> }</font>
		</p>
		<p>
				<font face="Courier New"> public void addSheet(String sheetName) throws Exception {</font>
		</p>
		<p>
				<font face="Courier New">  // 创建Excel工作表<br />  WritableSheet ws = wwb.createSheet(sheetName, sheetCount);<br />  vSheet.addElement(ws);<br />  sheetCount++;<br /> }</font>
		</p>
		<p>
				<font face="Courier New"> /**<br />  * 为工作表添加内容,指定添加到第几列<br />  * <br />  * @param v<br />  *        Vector 要添加到工作表的内容 格式<br />  *        String,String,String,String,...,...,...,..., 每列内容以逗号隔开<br />  * @param col<br />  *        int 指定列数<br />  * @throws Exception<br />  */<br /> public void addContent(Vector v, int col) throws Exception {<br />  WritableSheet ws = (WritableSheet) vSheet.get(sheetCount - 2);</font>
		</p>
		<p>
				<font face="Courier New">  int size = v.size();<br />  try {<br />   for (int i = 0; i &lt; size; i++) {<br />    String s = (String) v.get(i);<br />    String[] s1 = s.split(",");<br />    for (int j = 0; j &lt; col; j++) {<br />     Label label = new Label(j, i, s1[j]);</font>
		</p>
		<p>
				<font face="Courier New">     ws.addCell(label);<br />     label = null;<br />    }<br />   }<br />  } catch (ArrayIndexOutOfBoundsException e) {<br />   throw new ArrayIndexOutOfBoundsException("check column!");<br />  }<br />  ws = null;<br /> }</font>
		</p>
		<p>
				<font face="Courier New"> /**<br />  * 为工作表添加内容,不指定添加几列<br />  * <br />  * @param v<br />  *        Vector 要添加到工作表的内容 格式<br />  *        String,String,String,String,...,...,...,..., 每列内容以逗号隔开<br />  * @throws Exception<br />  */<br /> public void addContent(Vector v) throws Exception {<br />  WritableSheet ws = (WritableSheet) vSheet.get(sheetCount - 2);</font>
		</p>
		<p>
				<font face="Courier New">  int size = v.size();<br />  try {<br />   for (int i = 0; i &lt; size; i++) {<br />    String s = (String) v.get(i);<br />    String[] s1 = s.split(",");<br />    int col_size = s1.length;<br />    for (int j = 0; j &lt; col_size; j++) {<br />     Label label = new Label(j, i, s1[j]);</font>
		</p>
		<p>
				<font face="Courier New">     ws.addCell(label);<br />     label = null;<br />    }<br />   }<br />  } catch (Exception e) {<br />   throw new Exception();<br />  }<br />  ws = null;<br /> }</font>
		</p>
		<p>
				<font face="Courier New"> /**<br />  * 为工作表添加内容,不指定添加几列<br />  * <br />  * @param rs<br />  *        ResultSet 从数据库中得到的结果集<br />  * @throws Exception<br />  */<br /> public void addContent(ResultSet rs) throws Exception {<br />  if (rs == null) {<br />   return;<br />  }<br />  WritableSheet ws = (WritableSheet) vSheet.get(sheetCount - 2);<br />  ResultSetMetaData rsMetaD = rs.getMetaData();<br />  int col = rsMetaD.getColumnCount();<br />  int i = 0;<br />  while (rs.next()) {<br />   for (int j = 0; j &lt; col; j++) {<br />    Label label = new Label(j, i, rs.getString(j));// Chinese.fromDatabase(rs.getString(j))<br />    ws.addCell(label);<br />    label = null;<br />   }<br />   i++;<br />  }<br /> }</font>
		</p>
		<p>
				<font face="Courier New"> /**<br />  * 最终生成excel文件<br />  * <br />  * @throws Exception<br />  */<br /> public void createExcel() throws Exception {<br />  wwb.write();<br />  wwb.close();<br /> }</font>
		</p>
		<p>
				<font face="Courier New"> public static void main(String[] args) {<br />  Excel t = new Excel("d:\\test.xls");<br />  Vector v = new Vector();<br />  try {<br />   v.addElement("ding,wen,yuan");<br />   v.addElement("ding,wen,yuan");<br />   t.addSheet("first");<br />   t.addContent(v, 3);</font>
		</p>
		<p>
				<font face="Courier New">   v.clear();<br />   v.addElement("xuhy,hai,yong");<br />   v.addElement("xuhy,hai,yong");<br />   t.addSheet("second");<br />   t.addContent(v, 3);</font>
		</p>
		<p>
				<font face="Courier New">   v.clear();<br />   v.addElement("wu,jia,qian");<br />   v.addElement("wu,jia,qian");<br />   t.addSheet("third");<br />   t.addContent(v, 3);</font>
		</p>
		<p>
				<font face="Courier New">   t.createExcel();<br />  } catch (Exception e) {<br />   e.printStackTrace();<br />  }</font>
		</p>
		<p>
				<font face="Courier New"> }</font>
		</p>
		<p>
				<font face="Courier New">}<br /><br />转自:http://www.blogjava.net/wujiaqian/archive/2006/12/21/89308.html?Pending=true#Post</font>
		</p>
<img src ="http://www.blogjava.net/yongbing/aggbug/92382.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/yongbing/" target="_blank">小石头</a> 2007-01-08 15:19 <a href="http://www.blogjava.net/yongbing/articles/92382.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>一个将数字转换为人民币大写的程序</title><link>http://www.blogjava.net/yongbing/articles/92035.html</link><dc:creator>小石头</dc:creator><author>小石头</author><pubDate>Fri, 05 Jan 2007 09:14:00 GMT</pubDate><guid>http://www.blogjava.net/yongbing/articles/92035.html</guid><wfw:comment>http://www.blogjava.net/yongbing/comments/92035.html</wfw:comment><comments>http://www.blogjava.net/yongbing/articles/92035.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/yongbing/comments/commentRss/92035.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/yongbing/services/trackbacks/92035.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: //				UI方式																								import				 javax.swing.JOptionPane;				public				 				class				 ChinaChar 																								{    						static						 						...&nbsp;&nbsp;<a href='http://www.blogjava.net/yongbing/articles/92035.html'>阅读全文</a><img src ="http://www.blogjava.net/yongbing/aggbug/92035.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/yongbing/" target="_blank">小石头</a> 2007-01-05 17:14 <a href="http://www.blogjava.net/yongbing/articles/92035.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>