基于DOM4j和POI实现的XML文件转换为XLS(即标准EXCEL)的JAVA程序
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了基于DOM4j和POI实现的XML文件转换为XLS(即标准EXCEL)的JAVA程序,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含56055字,纯文字阅读大概需要81分钟。
内容图文
基于DOM4j和POI实现的XML文件转换为XLS(即标准EXCEL)的JAVA程序
#第一次写博客有点小紧张,希望各位大牛多多包涵
大四狗最近来公司实习,经理大大给了一个测试开发能力的小人物,读取xml文件并转换为xls文件,该xml可以通过修改后缀名用xls打开。所以要求即为读取xml格式的文件并且将其内的数据通过xml里的style格式改写成EXCEL标准单元格格式。
注:该程序有部分讨巧,部分公共格式并不是读取出来的而是直接设置好的,如介意请勿取
完整项目链接地址:
实现过程
首先贴上xml格式的文件:
<?xml version="1.0" encoding="UTF-8"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40">
<Styles>
<Style ID="HyperlinkId" ss:Name="Hyperlink">
<Font ss:Color="#0000ff"/>
</Style>
<Style ss:ID="37">
<Alignment ss:Horizontal="Left" ss:Vertical="Top" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="DiagonalLeft"/>
</Borders>
<Font ss:FontName="serif" ss:Size="10.0" ss:Color="#000000"/>
</Style>
<Style ss:ID="29">
<Alignment ss:Horizontal="Left" ss:Vertical="Top" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Bottom"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" ss:="#000000"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="DiagonalLeft"/>
</Borders>
<Font ss:FontName="serif" ss:Size="10.0" ss:Color="#000000"/>
</Style>
<Style ss:ID="30">
<Alignment ss:Horizontal="Left" ss:Vertical="Top" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="DiagonalLeft"/>
</Borders>
<Font ss:FontName="serif" ss:Size="10.0" ss:Color="#000000"/>
</Style>
<Style ss:ID="40">
<Alignment ss:Horizontal="Center" ss:Vertical="Top" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Bottom"/>
<Border ss:Position="Top"/>
<Border ss:Position="Left"/>
<Border ss:Position="Right"/>
<Border ss:Position="DiagonalLeft"/>
</Borders>
<Font ss:FontName="serif" ss:Size="10.0" ss:Bold="1" ss:Color="#000000"/>
</Style>
<Style ss:ID="27">
<Alignment ss:Horizontal="Center" ss:Vertical="Top" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Bottom"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="DiagonalLeft"/>
</Borders>
<Font ss:FontName="serif" ss:Size="10.0" ss:Bold="1" ss:Color="#000000"/>
<Interior ss:Color="#c0c0c0" ss:Pattern="Solid"/>
</Style>
<Style ss:ID="21">
<Alignment ss:Horizontal="Left" ss:Vertical="Top" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Bottom"/>
<Border ss:Position="Top"/>
<Border ss:Position="Left"/>
<Border ss:Position="Right"/>
<Border ss:Position="DiagonalLeft"/>
</Borders>
<Font ss:FontName="serif" ss:Size="10.0" ss:Bold="1" ss:Color="#000000"/>
</Style>
<Style ss:ID="23">
<Alignment ss:Horizontal="Left" ss:Vertical="Top" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Bottom"/>
<Border ss:Position="Top"/>
<Border ss:Position="Left"/>
<Border ss:Position="Right"/>
<Border ss:Position="DiagonalLeft"/>
</Borders>
<Font ss:FontName="serif" ss:Size="10.0" ss:Bold="1" ss:Color="#000000"/>
</Style>
<Style ss:ID="34">
<Alignment ss:Horizontal="Right" ss:Vertical="Top" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="DiagonalLeft"/>
</Borders>
<Font ss:FontName="serif" ss:Size="10.0" ss:Color="#000000"/>
<NumberFormat ss:Format="#,##0.00"/>
</Style>
<Style ss:ID="26">
<Alignment ss:Horizontal="Left" ss:Vertical="Top" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="DiagonalLeft"/>
</Borders>
<Font ss:FontName="serif" ss:Size="10.0" ss:Bold="1" ss:Color="#000000"/>
</Style>
<Style ss:ID="1">
<NumberFormat ss:Format="yyyy-M-d HH:mm:ss AM/PM"/>
</Style>
<Style ss:ID="22">
<Alignment ss:Horizontal="Center" ss:Vertical="Top" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Bottom"/>
<Border ss:Position="Top"/>
<Border ss:Position="Left"/>
<Border ss:Position="Right"/>
<Border ss:Position="DiagonalLeft"/>
</Borders>
<Font ss:FontName="serif" ss:Size="16.0" ss:Bold="1" ss:Color="#000000"/>
</Style>
<Style ss:ID="31">
<Alignment ss:Horizontal="Center" ss:Vertical="Top" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Bottom"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="DiagonalLeft"/>
</Borders>
<Font ss:FontName="serif" ss:Size="10.0" ss:Color="#000000"/>
</Style>
<Style ss:ID="25">
<Alignment ss:Horizontal="Left" ss:Vertical="Top" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Bottom"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="DiagonalLeft"/>
</Borders>
<Font ss:FontName="serif" ss:Size="10.0" ss:Bold="1" ss:Color="#000000"/>
</Style>
<Style ss:ID="39">
<Alignment ss:Horizontal="Left" ss:Vertical="Top" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="Top"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="DiagonalLeft"/>
</Borders>
<Font ss:FontName="serif" ss:Size="10.0" ss:Color="#000000"/>
</Style>
<Style ss:ID="32">
<Alignment ss:Horizontal="Center" ss:Vertical="Top" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="DiagonalLeft"/>
</Borders>
<Font ss:FontName="serif" ss:Size="10.0" ss:Color="#000000"/>
</Style>
<Style ss:ID="20">
<Alignment ss:Horizontal="Left" ss:Vertical="Top" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Bottom"/>
<Border ss:Position="Top"/>
<Border ss:Position="Left"/>
<Border ss:Position="Right"/>
<Border ss:Position="DiagonalLeft"/>
</Borders>
<Font ss:FontName="serif" ss:Size="10.0" ss:Color="#000000"/>
</Style>
<Style ss:ID="28">
<Alignment ss:Horizontal="Center" ss:Vertical="Top" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="DiagonalLeft"/>
</Borders>
<Font ss:FontName="serif" ss:Size="10.0" ss:Bold="1" ss:Color="#000000"/>
<Interior ss:Color="#c0c0c0" ss:Pattern="Solid"/>
</Style>
<Style ss:ID="24">
<Alignment ss:Horizontal="Right" ss:Vertical="Top" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Bottom"/>
<Border ss:Position="Top"/>
<Border ss:Position="Left"/>
<Border ss:Position="Right"/>
<Border ss:Position="DiagonalLeft"/>
</Borders>
<Font ss:FontName="serif" ss:Size="10.0" ss:Bold="1" ss:Color="#000000"/>
</Style>
<Style ss:ID="38">
<Alignment ss:Horizontal="Left" ss:Vertical="Top" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Bottom"/>
<Border ss:Position="Top"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="DiagonalLeft"/>
</Borders>
<Font ss:FontName="serif" ss:Size="10.0" ss:Color="#000000"/>
</Style>
<Style ss:ID="36">
<Alignment ss:Horizontal="Right" ss:Vertical="Top" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="DiagonalLeft"/>
</Borders>
<Font ss:FontName="serif" ss:Size="10.0" ss:Color="#000000"/>
</Style>
<Style ss:ID="35">
<Alignment ss:Horizontal="Right" ss:Vertical="Top" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Bottom"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="DiagonalLeft"/>
</Borders>
<Font ss:FontName="serif" ss:Size="10.0" ss:Color="#000000"/>
</Style>
<Style ss:ID="33">
<Alignment ss:Horizontal="Right" ss:Vertical="Top" ss:WrapText="1"/>
<Borders>
<Border ss:Position="Bottom"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" ss:Color="#000000"/>
<Border ss:Position="DiagonalLeft"/>
</Borders>
<Font ss:FontName="serif" ss:Size="10.0" ss:Color="#000000"/>
<NumberFormat ss:Format="#,##0.00"/>
</Style>
</Styles>
<Names>
<NamedRange ss:Name="__bookmark_1" ss:RefersTo="Report!R1C1:R38C21"/>
</Names>
<Worksheet ss:Name="Report">
<ss:Table>
<ss:Column ss:Width="69.376" ss:AutoFitWidth="0"/>
<ss:Column ss:Width="31.36" ss:AutoFitWidth="0"/>
<ss:Column ss:Width="38.016" ss:AutoFitWidth="0"/>
<ss:Column ss:Width="62.72" ss:AutoFitWidth="0"/>
<ss:Column ss:Width="40.192" ss:AutoFitWidth="0"/>
<ss:Column ss:Width="1.92" ss:AutoFitWidth="0"/>
<ss:Column ss:Width="38.4" ss:AutoFitWidth="0"/>
<ss:Column ss:Width="28.672" ss:AutoFitWidth="0"/>
<ss:Column ss:Width="11.648" ss:AutoFitWidth="0"/>
<ss:Column ss:Width="40.32" ss:AutoFitWidth="0"/>
<ss:Column ss:Width="13.44" ss:AutoFitWidth="0"/>
<ss:Column ss:Width="26.88" ss:AutoFitWidth="0"/>
<ss:Column ss:Width="46.464" ss:AutoFitWidth="0"/>
<ss:Column ss:Width="54.272" ss:AutoFitWidth="0"/>
<ss:Column ss:Width="15.104" ss:AutoFitWidth="0"/>
<ss:Column ss:Width="73.344" ss:AutoFitWidth="0"/>
<ss:Column ss:Width="12.288" ss:AutoFitWidth="0"/>
<ss:Column ss:Width="61.056" ss:AutoFitWidth="0"/>
<ss:Column ss:Width="39.68" ss:AutoFitWidth="0"/>
<ss:Column ss:Width="22.656" ss:AutoFitWidth="0"/>
<ss:Column ss:Width="68.608" ss:AutoFitWidth="0"/>
<ss:Column ss:Width="9.472" ss:AutoFitWidth="0"/>
<Row ss:AutoFitHeight="0" ss:Height="18.75">
<Cell ss:Index="1" ss:StyleID="21" ss:MergeAcross="20"/>
<Cell ss:Index="22" ss:StyleID="20" ss:MergeDown="37"/>
</Row>
<Row ss:AutoFitHeight="1">
<Cell ss:Index="1" ss:StyleID="22" ss:MergeAcross="20">
<Data x:Ticked="1" ss:Type="String">交易确认表</Data>
</Cell>
</Row>
<Row ss:AutoFitHeight="1">
<Cell ss:Index="1" ss:StyleID="23">
<Data x:Ticked="1" ss:Type="String">开始日期:</Data>
</Cell>
<Cell ss:Index="2" ss:StyleID="23" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">2012-09-10</Data>
</Cell>
<Cell ss:Index="4" ss:StyleID="23" ss:MergeAcross="2">
<Data x:Ticked="1" ss:Type="String">结束日期:</Data>
</Cell>
<Cell ss:Index="7" ss:StyleID="23" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">2012-09-10</Data>
</Cell>
<Cell ss:Index="9" ss:StyleID="21" ss:MergeAcross="7"/>
<Cell ss:Index="17" ss:StyleID="24" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">制表单位:</Data>
</Cell>
<Cell ss:Index="19" ss:StyleID="23" ss:MergeAcross="2">
<Data x:Ticked="1" ss:Type="String">银河证券</Data>
</Cell>
</Row>
<Row ss:AutoFitHeight="1">
<Cell ss:Index="1" ss:StyleID="26" ss:MergeAcross="20">
<Data x:Ticked="1" ss:Type="String">父产品名称: 880004_880004</Data>
</Cell>
</Row>
<Row ss:AutoFitHeight="1">
<Cell ss:Index="1" ss:StyleID="28">
<Data x:Ticked="1" ss:Type="String">客户名称</Data>
</Cell>
<Cell ss:Index="2" ss:StyleID="28" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">产品名称</Data>
</Cell>
<Cell ss:Index="4" ss:StyleID="28" ss:MergeAcross="2">
<Data x:Ticked="1" ss:Type="String">证件号码</Data>
</Cell>
<Cell ss:Index="7" ss:StyleID="28" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">确认日期</Data>
</Cell>
<Cell ss:Index="9" ss:StyleID="28" ss:MergeAcross="2">
<Data x:Ticked="1" ss:Type="String">业务类型</Data>
</Cell>
<Cell ss:Index="12" ss:StyleID="28" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">申请金额</Data>
</Cell>
<Cell ss:Index="14" ss:StyleID="28" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">申请份额</Data>
</Cell>
<Cell ss:Index="16" ss:StyleID="28">
<Data x:Ticked="1" ss:Type="String">确认净额</Data>
</Cell>
<Cell ss:Index="17" ss:StyleID="28" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">确认份额</Data>
</Cell>
<Cell ss:Index="19" ss:StyleID="28" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">手续费</Data>
</Cell>
<Cell ss:Index="21" ss:StyleID="28">
<Data x:Ticked="1" ss:Type="String">单位净值</Data>
</Cell>
</Row>
<Row ss:AutoFitHeight="1">
<Cell ss:Index="1" ss:StyleID="30">
<Data x:Ticked="1" ss:Type="String">test13</Data>
</Cell>
<Cell ss:Index="2" ss:StyleID="30" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">880004</Data>
</Cell>
<Cell ss:Index="4" ss:StyleID="30" ss:MergeAcross="2">
<Data x:Ticked="1" ss:Type="String">11111111</Data>
</Cell>
<Cell ss:Index="7" ss:StyleID="32" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">20120910</Data>
</Cell>
<Cell ss:Index="9" ss:StyleID="30" ss:MergeAcross="2">
<Data x:Ticked="1" ss:Type="String">42-强行赎回</Data>
</Cell>
<Cell ss:Index="12" ss:StyleID="34" ss:MergeAcross="1">
<Data ss:Type="Number">0</Data>
</Cell>
<Cell ss:Index="14" ss:StyleID="34" ss:MergeAcross="1">
<Data ss:Type="Number">985</Data>
</Cell>
<Cell ss:Index="16" ss:StyleID="34">
<Data ss:Type="Number">977.12</Data>
</Cell>
<Cell ss:Index="17" ss:StyleID="34" ss:MergeAcross="1">
<Data ss:Type="Number">985.00</Data>
</Cell>
<Cell ss:Index="19" ss:StyleID="34" ss:MergeAcross="1">
<Data ss:Type="Number">7.88</Data>
</Cell>
<Cell ss:Index="21" ss:StyleID="36">
<Data x:Ticked="1" ss:Type="String">1.0000</Data>
</Cell>
</Row>
<Row ss:AutoFitHeight="1">
<Cell ss:Index="1" ss:StyleID="30">
<Data x:Ticked="1" ss:Type="String">test13</Data>
</Cell>
<Cell ss:Index="2" ss:StyleID="30" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">880004</Data>
</Cell>
<Cell ss:Index="4" ss:StyleID="30" ss:MergeAcross="2">
<Data x:Ticked="1" ss:Type="String">11111111</Data>
</Cell>
<Cell ss:Index="7" ss:StyleID="32" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">20120910</Data>
</Cell>
<Cell ss:Index="9" ss:StyleID="30" ss:MergeAcross="2">
<Data x:Ticked="1" ss:Type="String">22-申购</Data>
</Cell>
<Cell ss:Index="12" ss:StyleID="34" ss:MergeAcross="1">
<Data ss:Type="Number">1000</Data>
</Cell>
<Cell ss:Index="14" ss:StyleID="34" ss:MergeAcross="1">
<Data ss:Type="Number">0</Data>
</Cell>
<Cell ss:Index="16" ss:StyleID="34">
<Data ss:Type="Number">985</Data>
</Cell>
<Cell ss:Index="17" ss:StyleID="34" ss:MergeAcross="1">
<Data ss:Type="Number">985.00</Data>
</Cell>
<Cell ss:Index="19" ss:StyleID="34" ss:MergeAcross="1">
<Data ss:Type="Number">15.00</Data>
</Cell>
<Cell ss:Index="21" ss:StyleID="36">
<Data x:Ticked="1" ss:Type="String">1.0000</Data>
</Cell>
</Row>
<Row ss:AutoFitHeight="1">
<Cell ss:Index="1" ss:StyleID="32" ss:MergeAcross="10">
<Data x:Ticked="1" ss:Type="String">基金小计</Data>
</Cell>
<Cell ss:Index="12" ss:StyleID="34" ss:MergeAcross="1">
<Data ss:Type="Number">1000.0</Data>
</Cell>
<Cell ss:Index="14" ss:StyleID="34" ss:MergeAcross="1">
<Data ss:Type="Number">985.0</Data>
</Cell>
<Cell ss:Index="16" ss:StyleID="34">
<Data ss:Type="Number">1962.12</Data>
</Cell>
<Cell ss:Index="17" ss:StyleID="34" ss:MergeAcross="1">
<Data ss:Type="Number">1970.0</Data>
</Cell>
<Cell ss:Index="19" ss:StyleID="34" ss:MergeAcross="1">
<Data ss:Type="Number">22.88</Data>
</Cell>
<Cell ss:Index="21" ss:StyleID="37"/>
</Row>
<Row ss:AutoFitHeight="1">
<Cell ss:Index="1" ss:StyleID="29" ss:MergeAcross="20">
<Data x:Ticked="1" ss:Type="String">*本材料需管理人加盖管理人的印鉴确认方具有效力</Data>
</Cell>
</Row>
<Row ss:AutoFitHeight="1">
<Cell ss:Index="1" ss:StyleID="38" ss:MergeAcross="20">
<Data x:Ticked="1" ss:Type="String">**除非管理人提出,否则视为基金管理人对本材料无异议</Data>
</Cell>
</Row>
<Row ss:AutoFitHeight="1">
<Cell ss:Index="1" ss:StyleID="38" ss:MergeAcross="20">
<Data x:Ticked="1" ss:Type="String">***请管理人盖章确认后回转一份至fundservice@csc.com.cn,并可作为向托管人出具汇款指令的附件</Data>
</Cell>
</Row>
<Row ss:AutoFitHeight="1">
<Cell ss:Index="1" ss:StyleID="38" ss:MergeAcross="20">
<Data x:Ticked="1" ss:Type="String">****为了不影响客户的资金到账时间及减少与代销机构间的资金交收纠纷,请管理人在确认日的两个工作日内将相应的款项从托管户划至本基金的募集清算账户</Data>
</Cell>
</Row>
<Row ss:AutoFitHeight="1">
<Cell ss:Index="1" ss:StyleID="39" ss:MergeAcross="20">
<Data x:Ticked="1" ss:Type="String">*****本管理人已完成本基金所有认购申购客户端确认回访工作,客户认购真实有效!</Data>
</Cell>
</Row>
<Row ss:AutoFitHeight="0" ss:Height="18.75">
<Cell ss:Index="1" ss:StyleID="21" ss:MergeAcross="20"/>
</Row>
<Row ss:AutoFitHeight="1">
<Cell ss:Index="1" ss:StyleID="22" ss:MergeAcross="20">
<Data x:Ticked="1" ss:Type="String">交易确认表</Data>
</Cell>
</Row>
<Row ss:AutoFitHeight="1">
<Cell ss:Index="1" ss:StyleID="23">
<Data x:Ticked="1" ss:Type="String">开始日期:</Data>
</Cell>
<Cell ss:Index="2" ss:StyleID="23" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">2012-09-10</Data>
</Cell>
<Cell ss:Index="4" ss:StyleID="23" ss:MergeAcross="2">
<Data x:Ticked="1" ss:Type="String">结束日期:</Data>
</Cell>
<Cell ss:Index="7" ss:StyleID="23" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">2012-09-10</Data>
</Cell>
<Cell ss:Index="9" ss:StyleID="21" ss:MergeAcross="7"/>
<Cell ss:Index="17" ss:StyleID="24" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">制表单位:</Data>
</Cell>
<Cell ss:Index="19" ss:StyleID="23" ss:MergeAcross="2">
<Data x:Ticked="1" ss:Type="String">银河证券</Data>
</Cell>
</Row>
<Row ss:AutoFitHeight="1">
<Cell ss:Index="1" ss:StyleID="26" ss:MergeAcross="20">
<Data x:Ticked="1" ss:Type="String">父产品名称: 880005_880005</Data>
</Cell>
</Row>
<Row ss:AutoFitHeight="1">
<Cell ss:Index="1" ss:StyleID="28">
<Data x:Ticked="1" ss:Type="String">客户名称</Data>
</Cell>
<Cell ss:Index="2" ss:StyleID="28" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">产品名称</Data>
</Cell>
<Cell ss:Index="4" ss:StyleID="28" ss:MergeAcross="2">
<Data x:Ticked="1" ss:Type="String">证件号码</Data>
</Cell>
<Cell ss:Index="7" ss:StyleID="28" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">确认日期</Data>
</Cell>
<Cell ss:Index="9" ss:StyleID="28" ss:MergeAcross="2">
<Data x:Ticked="1" ss:Type="String">业务类型</Data>
</Cell>
<Cell ss:Index="12" ss:StyleID="28" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">申请金额</Data>
</Cell>
<Cell ss:Index="14" ss:StyleID="28" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">申请份额</Data>
</Cell>
<Cell ss:Index="16" ss:StyleID="28">
<Data x:Ticked="1" ss:Type="String">确认净额</Data>
</Cell>
<Cell ss:Index="17" ss:StyleID="28" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">确认份额</Data>
</Cell>
<Cell ss:Index="19" ss:StyleID="28" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">手续费</Data>
</Cell>
<Cell ss:Index="21" ss:StyleID="28">
<Data x:Ticked="1" ss:Type="String">单位净值</Data>
</Cell>
</Row>
<Row ss:AutoFitHeight="1">
<Cell ss:Index="1" ss:StyleID="30">
<Data x:Ticked="1" ss:Type="String">test51</Data>
</Cell>
<Cell ss:Index="2" ss:StyleID="30" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">880005</Data>
</Cell>
<Cell ss:Index="4" ss:StyleID="30" ss:MergeAcross="2">
<Data x:Ticked="1" ss:Type="String">530101198604280050</Data>
</Cell>
<Cell ss:Index="7" ss:StyleID="32" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">20120910</Data>
</Cell>
<Cell ss:Index="9" ss:StyleID="30" ss:MergeAcross="2">
<Data x:Ticked="1" ss:Type="String">22-申购</Data>
</Cell>
<Cell ss:Index="12" ss:StyleID="34" ss:MergeAcross="1">
<Data ss:Type="Number">5000</Data>
</Cell>
<Cell ss:Index="14" ss:StyleID="34" ss:MergeAcross="1">
<Data ss:Type="Number">0</Data>
</Cell>
<Cell ss:Index="16" ss:StyleID="34">
<Data ss:Type="Number">4950</Data>
</Cell>
<Cell ss:Index="17" ss:StyleID="34" ss:MergeAcross="1">
<Data ss:Type="Number">4950.00</Data>
</Cell>
<Cell ss:Index="19" ss:StyleID="34" ss:MergeAcross="1">
<Data ss:Type="Number">50.00</Data>
</Cell>
<Cell ss:Index="21" ss:StyleID="36">
<Data x:Ticked="1" ss:Type="String">1.0000</Data>
</Cell>
</Row>
<Row ss:AutoFitHeight="1">
<Cell ss:Index="1" ss:StyleID="32" ss:MergeAcross="10">
<Data x:Ticked="1" ss:Type="String">基金小计</Data>
</Cell>
<Cell ss:Index="12" ss:StyleID="34" ss:MergeAcross="1">
<Data ss:Type="Number">5000.0</Data>
</Cell>
<Cell ss:Index="14" ss:StyleID="34" ss:MergeAcross="1">
<Data ss:Type="Number">0.0</Data>
</Cell>
<Cell ss:Index="16" ss:StyleID="34">
<Data ss:Type="Number">4950.0</Data>
</Cell>
<Cell ss:Index="17" ss:StyleID="34" ss:MergeAcross="1">
<Data ss:Type="Number">4950.0</Data>
</Cell>
<Cell ss:Index="19" ss:StyleID="34" ss:MergeAcross="1">
<Data ss:Type="Number">50.0</Data>
</Cell>
<Cell ss:Index="21" ss:StyleID="37"/>
</Row>
<Row ss:AutoFitHeight="1">
<Cell ss:Index="1" ss:StyleID="29" ss:MergeAcross="20">
<Data x:Ticked="1" ss:Type="String">*本材料需管理人加盖管理人的印鉴确认方具有效力</Data>
</Cell>
</Row>
<Row ss:AutoFitHeight="1">
<Cell ss:Index="1" ss:StyleID="38" ss:MergeAcross="20">
<Data x:Ticked="1" ss:Type="String">**除非管理人提出,否则视为基金管理人对本材料无异议</Data>
</Cell>
</Row>
<Row ss:AutoFitHeight="1">
<Cell ss:Index="1" ss:StyleID="38" ss:MergeAcross="20">
<Data x:Ticked="1" ss:Type="String">***请管理人盖章确认后回转一份至fundservice@csc.com.cn,并可作为向托管人出具汇款指令的附件</Data>
</Cell>
</Row>
<Row ss:AutoFitHeight="1">
<Cell ss:Index="1" ss:StyleID="38" ss:MergeAcross="20">
<Data x:Ticked="1" ss:Type="String">****为了不影响客户的资金到账时间及减少与代销机构间的资金交收纠纷,请管理人在确认日的两个工作日内将相应的款项从托管户划至本基金的募集清算账户</Data>
</Cell>
</Row>
<Row ss:AutoFitHeight="1">
<Cell ss:Index="1" ss:StyleID="39" ss:MergeAcross="20">
<Data x:Ticked="1" ss:Type="String">*****本管理人已完成本基金所有认购申购客户端确认回访工作,客户认购真实有效!</Data>
</Cell>
</Row>
<Row ss:AutoFitHeight="0" ss:Height="18.75">
<Cell ss:Index="1" ss:StyleID="21" ss:MergeAcross="20"/>
</Row>
<Row ss:AutoFitHeight="1">
<Cell ss:Index="1" ss:StyleID="22" ss:MergeAcross="20">
<Data x:Ticked="1" ss:Type="String">交易确认表</Data>
</Cell>
</Row>
<Row ss:AutoFitHeight="1">
<Cell ss:Index="1" ss:StyleID="23">
<Data x:Ticked="1" ss:Type="String">开始日期:</Data>
</Cell>
<Cell ss:Index="2" ss:StyleID="23" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">2012-09-10</Data>
</Cell>
<Cell ss:Index="4" ss:StyleID="23" ss:MergeAcross="2">
<Data x:Ticked="1" ss:Type="String">结束日期:</Data>
</Cell>
<Cell ss:Index="7" ss:StyleID="23" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">2012-09-10</Data>
</Cell>
<Cell ss:Index="9" ss:StyleID="21" ss:MergeAcross="7"/>
<Cell ss:Index="17" ss:StyleID="24" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">制表单位:</Data>
</Cell>
<Cell ss:Index="19" ss:StyleID="23" ss:MergeAcross="2">
<Data x:Ticked="1" ss:Type="String">银河证券</Data>
</Cell>
</Row>
<Row ss:AutoFitHeight="1">
<Cell ss:Index="1" ss:StyleID="26" ss:MergeAcross="20">
<Data x:Ticked="1" ss:Type="String">父产品名称: 880006_880006</Data>
</Cell>
</Row>
<Row ss:AutoFitHeight="1">
<Cell ss:Index="1" ss:StyleID="28">
<Data x:Ticked="1" ss:Type="String">客户名称</Data>
</Cell>
<Cell ss:Index="2" ss:StyleID="28" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">产品名称</Data>
</Cell>
<Cell ss:Index="4" ss:StyleID="28" ss:MergeAcross="2">
<Data x:Ticked="1" ss:Type="String">证件号码</Data>
</Cell>
<Cell ss:Index="7" ss:StyleID="28" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">确认日期</Data>
</Cell>
<Cell ss:Index="9" ss:StyleID="28" ss:MergeAcross="2">
<Data x:Ticked="1" ss:Type="String">业务类型</Data>
</Cell>
<Cell ss:Index="12" ss:StyleID="28" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">申请金额</Data>
</Cell>
<Cell ss:Index="14" ss:StyleID="28" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">申请份额</Data>
</Cell>
<Cell ss:Index="16" ss:StyleID="28">
<Data x:Ticked="1" ss:Type="String">确认净额</Data>
</Cell>
<Cell ss:Index="17" ss:StyleID="28" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">确认份额</Data>
</Cell>
<Cell ss:Index="19" ss:StyleID="28" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">手续费</Data>
</Cell>
<Cell ss:Index="21" ss:StyleID="28">
<Data x:Ticked="1" ss:Type="String">单位净值</Data>
</Cell>
</Row>
<Row ss:AutoFitHeight="1">
<Cell ss:Index="1" ss:StyleID="30">
<Data x:Ticked="1" ss:Type="String">test31</Data>
</Cell>
<Cell ss:Index="2" ss:StyleID="30" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">880006</Data>
</Cell>
<Cell ss:Index="4" ss:StyleID="30" ss:MergeAcross="2">
<Data x:Ticked="1" ss:Type="String">111111115</Data>
</Cell>
<Cell ss:Index="7" ss:StyleID="32" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">20120910</Data>
</Cell>
<Cell ss:Index="9" ss:StyleID="30" ss:MergeAcross="2">
<Data x:Ticked="1" ss:Type="String">24-赎回</Data>
</Cell>
<Cell ss:Index="12" ss:StyleID="34" ss:MergeAcross="1">
<Data ss:Type="Number">0</Data>
</Cell>
<Cell ss:Index="14" ss:StyleID="34" ss:MergeAcross="1">
<Data ss:Type="Number">985</Data>
</Cell>
<Cell ss:Index="16" ss:StyleID="34">
<Data ss:Type="Number">985</Data>
</Cell>
<Cell ss:Index="17" ss:StyleID="34" ss:MergeAcross="1">
<Data ss:Type="Number">985.00</Data>
</Cell>
<Cell ss:Index="19" ss:StyleID="34" ss:MergeAcross="1">
<Data ss:Type="Number">0.00</Data>
</Cell>
<Cell ss:Index="21" ss:StyleID="36">
<Data x:Ticked="1" ss:Type="String">1.0000</Data>
</Cell>
</Row>
<Row ss:AutoFitHeight="1">
<Cell ss:Index="1" ss:StyleID="30">
<Data x:Ticked="1" ss:Type="String">test31</Data>
</Cell>
<Cell ss:Index="2" ss:StyleID="30" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">880006</Data>
</Cell>
<Cell ss:Index="4" ss:StyleID="30" ss:MergeAcross="2">
<Data x:Ticked="1" ss:Type="String">111111115</Data>
</Cell>
<Cell ss:Index="7" ss:StyleID="32" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">20120910</Data>
</Cell>
<Cell ss:Index="9" ss:StyleID="30" ss:MergeAcross="2">
<Data x:Ticked="1" ss:Type="String">24-赎回</Data>
</Cell>
<Cell ss:Index="12" ss:StyleID="34" ss:MergeAcross="1">
<Data ss:Type="Number">0</Data>
</Cell>
<Cell ss:Index="14" ss:StyleID="34" ss:MergeAcross="1">
<Data ss:Type="Number">985</Data>
</Cell>
<Cell ss:Index="16" ss:StyleID="34">
<Data ss:Type="Number">985</Data>
</Cell>
<Cell ss:Index="17" ss:StyleID="34" ss:MergeAcross="1">
<Data ss:Type="Number">985.00</Data>
</Cell>
<Cell ss:Index="19" ss:StyleID="34" ss:MergeAcross="1">
<Data ss:Type="Number">0.00</Data>
</Cell>
<Cell ss:Index="21" ss:StyleID="36">
<Data x:Ticked="1" ss:Type="String">1.0000</Data>
</Cell>
</Row>
<Row ss:AutoFitHeight="1">
<Cell ss:Index="1" ss:StyleID="32" ss:MergeAcross="10">
<Data x:Ticked="1" ss:Type="String">基金小计</Data>
</Cell>
<Cell ss:Index="12" ss:StyleID="34" ss:MergeAcross="1">
<Data ss:Type="Number">0.0</Data>
</Cell>
<Cell ss:Index="14" ss:StyleID="34" ss:MergeAcross="1">
<Data ss:Type="Number">1970.0</Data>
</Cell>
<Cell ss:Index="16" ss:StyleID="34">
<Data ss:Type="Number">1970.0</Data>
</Cell>
<Cell ss:Index="17" ss:StyleID="34" ss:MergeAcross="1">
<Data ss:Type="Number">1970.0</Data>
</Cell>
<Cell ss:Index="19" ss:StyleID="34" ss:MergeAcross="1">
<Data ss:Type="Number">0.0</Data>
</Cell>
<Cell ss:Index="21" ss:StyleID="37"/>
</Row>
<Row ss:AutoFitHeight="1">
<Cell ss:Index="1" ss:StyleID="29" ss:MergeAcross="20">
<Data x:Ticked="1" ss:Type="String">*本材料需管理人加盖管理人的印鉴确认方具有效力</Data>
</Cell>
</Row>
<Row ss:AutoFitHeight="1">
<Cell ss:Index="1" ss:StyleID="38" ss:MergeAcross="20">
<Data x:Ticked="1" ss:Type="String">**除非管理人提出,否则视为基金管理人对本材料无异议</Data>
</Cell>
</Row>
<Row ss:AutoFitHeight="1">
<Cell ss:Index="1" ss:StyleID="38" ss:MergeAcross="20">
<Data x:Ticked="1" ss:Type="String">***请管理人盖章确认后回转一份至fundservice@csc.com.cn,并可作为向托管人出具汇款指令的附件</Data>
</Cell>
</Row>
<Row ss:AutoFitHeight="1">
<Cell ss:Index="1" ss:StyleID="38" ss:MergeAcross="20">
<Data x:Ticked="1" ss:Type="String">****为了不影响客户的资金到账时间及减少与代销机构间的资金交收纠纷,请管理人在确认日的两个工作日内将相应的款项从托管户划至本基金的募集清算账户</Data>
</Cell>
</Row>
<Row ss:AutoFitHeight="1">
<Cell ss:Index="1" ss:StyleID="39" ss:MergeAcross="20">
<Data x:Ticked="1" ss:Type="String">*****本管理人已完成本基金所有认购申购客户端确认回访工作,客户认购真实有效!</Data>
</Cell>
</Row>
<Row ss:AutoFitHeight="1">
<Cell ss:Index="1" ss:StyleID="24" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">操作员:</Data>
</Cell>
<Cell ss:Index="3" ss:StyleID="23" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">系统管理员</Data>
</Cell>
<Cell ss:Index="5" ss:StyleID="24">
<Data x:Ticked="1" ss:Type="String">第</Data>
</Cell>
<Cell ss:Index="6" ss:StyleID="40" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">1</Data>
</Cell>
<Cell ss:Index="8" ss:StyleID="23" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">页/共</Data>
</Cell>
<Cell ss:Index="10" ss:StyleID="40">
<Data x:Ticked="1" ss:Type="String">1</Data>
</Cell>
<Cell ss:Index="11" ss:StyleID="23" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">页</Data>
</Cell>
<Cell ss:Index="13" ss:StyleID="24" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">打印时间:</Data>
</Cell>
<Cell ss:Index="15" ss:StyleID="23" ss:MergeAcross="2">
<Data x:Ticked="1" ss:Type="String">2019年2月18日 下午3:43</Data>
</Cell>
<Cell ss:Index="18" ss:StyleID="23" ss:MergeAcross="1">
<Data x:Ticked="1" ss:Type="String">复核:</Data>
</Cell>
<Cell ss:Index="20" ss:StyleID="20" ss:MergeAcross="2"/>
</Row>
</ss:Table>
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
<PageSetup>
<PageMargins x:Bottom="0.25" x:Left="0.25" x:Right="0.25" x:Top="0.25"/>
<Layout x:Orientation="Landscape"/>
</PageSetup>
<Print>
<PaperSizeIndex>9</PaperSizeIndex>
</Print>
</WorksheetOptions>
</Worksheet>
</Workbook>
刚开始真的一头雾水,没有任何头绪,后来通过查找相关资料以及咨询前辈,终于找到了实现方法
1.首先通过dom4j解析xml文件,将其内的style格式以及table内的相关数据存入实体类中
实体类包括一下三个:
Column(存放列信息)、Style(存放格式信息)、Information(存放table表中的数据信息)
2. 接下来先读取Column类中的column相关样式信息,并且设置列的宽度等数据;
3. 然后读取information类中的数据并且写入Excel中;
4. 接下来读取style类中的样式信息并通过POI写入格式;
接下来是相关代码,一共五个类以及一个xml文件(其中存放相关的包依赖,因为该程序是一个maven项目)
Style类:
package com.jzcf;
import java.util.List;
public class Style {
private int id;
private Alignment alignment;
private List<Border> borders;
private Font font;
private Interior interior;
private NumberFormat numberFormat;
public Style() {
}
public NumberFormat getNumberFormat() {
return numberFormat;
}
public void setNumberFormat(NumberFormat numberFormat) {
this.numberFormat = numberFormat;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public Alignment getAlignment() {
return alignment;
}
public void setAlignment(Alignment alignment) {
this.alignment = alignment;
}
public List<Border> getBorders() {
return borders;
}
public void setBorders(List<Border> borders) {
this.borders = borders;
}
public Font getFont() {
return font;
}
public void setFont(Font font) {
this.font = font;
}
public Interior getInterior() {
return interior;
}
public void setInterior(Interior interior) {
this.interior = interior;
}
public Style(int id, Alignment alignment, List<Border> borders, Font font, Interior interior) {
this.id = id;
this.alignment = alignment;
this.borders= borders;
this.font = font;
this.interior = interior;
}
public Style(int id, NumberFormat numberFormat) {
this.id = id;
this.numberFormat = numberFormat;
}
public static class Alignment {
private String horizontal;
private String vertical;
private String wrapText;
public Alignment(){
}
public Alignment(String horizontal, String vertical, String wrapText) {
this.horizontal = horizontal;
this.vertical = vertical;
this.wrapText = wrapText;
}
public String getHorizontal() {
return horizontal;
}
public void setHorizontal(String horizontal) {
this.horizontal = horizontal;
}
public String getVertical() {
return vertical;
}
public void setVertical(String vertical) {
this.vertical = vertical;
}
public String getWrapText() {
return wrapText;
}
public void setWrapText(String wrapText) {
this.wrapText = wrapText;
}
}
public static class Border {
private String position;
private String linestyle;
private int weight;
private String color;
public Border() {
}
public Border(String position, String linestyle, int weight, String color) {
this.position = position;
this.linestyle = linestyle;
this.weight = weight;
this.color = color;
}
public String getPosition() {
return position;
}
public void setPosition(String position) {
this.position = position;
}
public String getLinestyle() {
return linestyle;
}
public void setLinestyle(String linestyle) {
this.linestyle = linestyle;
}
public int getWeight() {
return weight;
}
public void setWeight(int weight) {
this.weight = weight;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
}
public static class Font {
private String fontName;
private double size;
private int bold;
private String color;
public Font() {
}
public Font(String fontName, double size, int bold, String color) {
this.fontName = fontName;
this.size = size;
this.bold = bold;
this.color = color;
}
public String getFontName() {
return fontName;
}
public void setFontName(String fontName) {
this.fontName = fontName;
}
public double getSize() {
return size;
}
public void setSize(double size) {
this.size = size;
}
public int getBold() {
return bold;
}
public void setBold(int bold) {
this.bold = bold;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
}
public static class Interior {
private String color;
private String pattern;
public Interior() {
}
public Interior(String color, String pattern) {
this.color = color;
this.pattern = pattern;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public String getPattern() {
return pattern;
}
public void setPattern(String pattern) {
this.pattern = pattern;
}
}
public static class NumberFormat {
private String format;
public NumberFormat() {
}
public String getFormat() {
return format;
}
public void setFormat(String format) {
this.format = format;
}
public NumberFormat(String format) {
this.format = format;
}
}
}
Column类:
package com.jzcf;
public class Column {
private double width;
private int autofitwidth=0;
public Column() {
}
public double getWidth() {
return width;
}
public void setWidth(double width) {
this.width = width;
}
public Column(double width, int autofitwidth) {
this.width = width;
this.autofitwidth = autofitwidth;
}
}
Information类:
package com.jzcf;
import java.util.List;
public class Information {
private String name;
private List<Row> row;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Information() {
}
public List<Row> getRow() {
return row;
}
public void setRow(List<Row> row) {
this.row = row;
}
public Information(String name, List<Row> row) {
this.name = name;
this.row = row;
}
public static class Row {
private int autofitheight;
private double height;
private List<Cell> cell;
public Row() {
}
public Row(int autofitheight, double height, List<Cell> cell) {
this.autofitheight = autofitheight;
this.height = height;
this.cell = cell;
}
public int getAutofitheight() {
return autofitheight;
}
public void setAutofitheight(int autofitheight) {
this.autofitheight = autofitheight;
}
public double getHeight() {
return height;
}
public void setHeight(double height) {
this.height = height;
}
public List<Cell> getCell() {
return cell;
}
public void setCell(List<Cell> cell) {
this.cell = cell;
}
public static class Cell {
private int index;
private int styleID;
private int MergeAcross;
private int MergeDown;
private Data data;
public Cell() {
}
public Cell(int index, int styleID, int mergeAcross, int mergeDown, Data data) {
this.index = index;
this.styleID = styleID;
MergeAcross = mergeAcross;
MergeDown = mergeDown;
this.data = data;
}
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
public int getStyleID() {
return styleID;
}
public void setStyleID(int styleID) {
this.styleID = styleID;
}
public int getMergeAcross() {
return MergeAcross;
}
public void setMergeAcross(int mergeAcross) {
MergeAcross = mergeAcross;
}
public int getMergeDown() {
return MergeDown;
}
public void setMergeDown(int mergeDown) {
MergeDown = mergeDown;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public static class Data {
private int ticked;
private String type;
private String dat;//用于存放字段数据
public int getTicked() {
return ticked;
}
public void setTicked(int ticked) {
this.ticked = ticked;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getDat() {
return dat;
}
public void setDat(String dat) {
this.dat = dat;
}
public Data() {
}
public Data(int ticked, String type, String dat) {
this.ticked = ticked;
this.type = type;
this.dat = dat;
}
}
}
}
}
XmlReader类(用于解析xml文件):
package com.jzcf;
import java.util.*;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import java.util.List;
public class XmlReader {
public static Map<Integer, Style> getStyle(Document document) {//获取样式
Map<Integer, Style> styleMap = new LinkedHashMap<Integer, Style>();//创建一个LinkedHashMap用于存放style,按照id查找
Style style = null; //新建一个Style类用于存放节点数据
Style.NumberFormat numberFormat = new Style.NumberFormat();
Element root = document.getRootElement();//获取根节点
Element styles = root.element("Styles");//获取根节点下的Styles节点
List lstyle = styles.elements("Style");//获取Styles下的Style节点
Iterator<?> it = lstyle.iterator();
Element e = (Element) it.next();
while (it.hasNext()) {
style = new Style();//新建一个Style类用于存放节点数据
e = (Element) it.next();
int id = Integer.parseInt(e.attributeValue("ID"));
style.setId(id);//设置style的id
if (id == 1) {//当id为1时,设置为另一中构造方法
/* Element enumberFormat = e.element("NumberFormat");//获取Style下的NumberFormat节点
numberFormat.setFormat(enumberFormat.attributeValue("Format"));
style.setNumberFormat(numberFormat);*/
continue;
}
Style.Alignment alignment = new Style.Alignment();
Element ealignment = e.element("Alignment");//获取Style下的Alignment节点
//设置aligment的相关属性,并且设置style的aliment属性
alignment.setHorizontal(ealignment.attributeValue("Horizontal"));
alignment.setVertical(ealignment.attributeValue("Vertical"));
alignment.setWrapText(ealignment.attributeValue("WrapText"));
style.setAlignment(alignment);
Element Borders = e.element("Borders");//获取Style下的Borders节点
List Border = Borders.elements("Border");//获取Borders下的Border节点
Iterator<?> bdIt = Border.iterator();//用迭代器遍历Border节点
//利用List来存取borders下的多个border并放入style
List<Style.Border> lborders = new ArrayList<Style.Border>();
while (bdIt.hasNext()) {
Element bd = (Element) bdIt.next();
Style.Border border = new Style.Border();
border.setPosition(bd.attributeValue("Position"));
if (bd.attribute("LineStyle") != null) {
border.setLinestyle(bd.attributeValue("LineStyle"));
int weight = Integer.parseInt(bd.attributeValue("Weight"));
border.setWeight(weight);
border.setColor(bd.attributeValue("Color"));
}
lborders.add(border);
}
style.setBorders(lborders);
for (int i = 0; i < style.getBorders().size(); i++) {
// System.out.println(style.getBorders().get(i).getPosition());
}
//设置font的相关属性,并且设置style的font属性
Style.Font font = new Style.Font();
Element efont = e.element("Font");
font.setFontName(efont.attributeValue("FontName"));
double size = Double.parseDouble(efont.attributeValue("Size"));
font.setSize(size);
if (efont.attribute("Bold") != null) {
int bold = Integer.parseInt(efont.attributeValue("Bold"));
font.setBold(bold);
}
font.setColor(efont.attributeValue("Color"));
style.setFont(font);
//设置Interior的相关属性,并且设置style的interior属性
Style.Interior interior = new Style.Interior();
if (e.element("Interior") != null) {
Element einterior = e.element("Interior");
interior.setColor(einterior.attributeValue("Color"));
interior.setPattern(einterior.attributeValue("Pattern"));
}
style.setInterior(interior);
if (e.element("NumberFormat") != null) {
//设置NumberFormat的相关属性,并且设置style的NumberFormat属性
Element enumberFormat = e.element("NumberFormat");//获取Style下的Alignment节点
numberFormat.setFormat(enumberFormat.attributeValue("Format"));
style.setNumberFormat(numberFormat);
}
styleMap.put(id, style);
}
Element Names = root.element("Names");//获取根节点下的Names节点
Element NamedRange = Names.element("NamedRange");//获取根节点下的NamedRange节点
String name = NamedRange.attributeValue("Name");//获取ss:Name
String namedRange = NamedRange.attributeValue("RefersTo");//获取ss:RefersTo
return styleMap;
}
public static List<Column> getColumn(Document document){
Element root = document.getRootElement();
Element worksheet = root.element("Worksheet");//读取根节点下的Worksheet节点
String name = worksheet.attributeValue("Name");
Element table = worksheet.element("Table");//读取Worksheet下的ss:Table节点
List column = table.elements("Column");//读取ss:Table下的所有ss:Column节点
List<Column> columns = new ArrayList<Column>();
for (Iterator<?> it = column.iterator(); it.hasNext(); ) {
Column column1 = new Column();//通过创建column来存取column里的值
Element eColumn = (Element) it.next();
double width = Double.parseDouble(eColumn.attributeValue("Width"));
column1.setWidth(width);
columns.add(column1);
}
return columns;
}
public static Information getData(Document document) {//获取具体数据
Element root = document.getRootElement();
Element worksheet = root.element("Worksheet");//读取根节点下的Worksheet节点
Element table = worksheet.element("Table");//读取Worksheet下的ss:Table节点
Information information = new Information();
information.setName(worksheet.attributeValue("Name"));
List row = table.elements("Row");//读取Worksheet下的Row节点
List<Information.Row> lrow = new ArrayList<Information.Row>();
for (Iterator<?> it = row.iterator(); it.hasNext(); ) {
//设置row对象属性并存放入list,存入information
Information.Row row1 = new Information.Row();
Element eRow = (Element) it.next();
int autofitheight = Integer.parseInt(eRow.attributeValue("AutoFitHeight"));
row1.setAutofitheight(autofitheight);
if (eRow.attributeValue("Height")!= null) {
double height = Double.parseDouble(eRow.attributeValue("Height"));
row1.setHeight(height);
}
lrow.add(row1);//将一个个row对象存放入list lrow中
List<Information.Row.Cell> lcell = new ArrayList<Information.Row.Cell>();//list用于存放cell
List cell = eRow.elements("Cell");//读取Row下的Cell节点
for (Iterator<?> it1 = cell.iterator(); it1.hasNext(); ) {
Element eCell = (Element) it1.next();
//将cell节点相关数据存入row
Information.Row.Cell cell1 = new Information.Row.Cell();
int index = Integer.parseInt(eCell.attributeValue("Index"));
cell1.setIndex(index);
int styleid = Integer.parseInt(eCell.attributeValue("StyleID"));
cell1.setStyleID(styleid);
if (eCell.attributeValue("MergeAcross") != null) {
int mergeacross = Integer.parseInt(eCell.attributeValue("MergeAcross"));
cell1.setMergeAcross(mergeacross);
}
if (eCell.attributeValue("MergeDown") != null) {
int mergedown = Integer.parseInt(eCell.attributeValue("MergeDown"));
cell1.setMergeDown(mergedown);
}
lcell.add(cell1);//将一个个cell添加入listlcell中
if(eCell.element("Data")!=null) {
Element data = eCell.element("Data");//读取Cell下的Data节点
//将data节点相关数据存入cell1
Information.Row.Cell.Data data1 = new Information.Row.Cell.Data();
if (data.attributeValue("Ticked")!= null) {
int ticked = Integer.parseInt(data.attributeValue("Ticked"));
data1.setTicked(ticked);
}
data1.setType(data.attributeValue("Type"));
data1.setDat(data.getText());
cell1.setData(data1);
}
}
row1.setCell(lcell);
}
information.setRow(lrow);//将lrow这个list存放为information的row属性中
return information;
}
}
ExcelAnalysis类(用于写入excle文件):
package com.jzcf;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.*;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.io.SAXReader;
import java.util.*;
import java.util.List;
import java.util.ArrayList;
import org.apache.poi.ss.usermodel.IndexedColors;
import java.io.File;
import java.io.FileOutputStream;
import java.util.Map;
import java.util.Set;
public class ExcelAnalysis {
/**
* 注意:同一行上的只能创建同一个行对象row 否则赋值的内容会被覆盖。
*/
public static void main(String[] args) throws DocumentException {
File inputFile = new File("D:\\Work\\a.xml");
SAXReader reader = new SAXReader();
Document document = reader.read(inputFile);
List<Column> columnList = XmlReader.getColumn(document);//读取列的相关信息
Map<Integer, Style> styleMap = XmlReader.getStyle(document);//读取style相关信息
Information information = XmlReader.getData(document);
//1.创建一个webbook,对应一个Excel文件
HSSFWorkbook wb = new HSSFWorkbook();
//2.在建立的工作簿中添加一个sheet,对应Excell文件中的工作簿,并设置工作簿名称
HSSFSheet sheet = wb.createSheet(information.getName());
for (int i = 0; i < columnList.size(); i++) {//读取column对象里的值设置列宽
sheet.setColumnWidth(i, (int) columnList.get(i).getWidth() * 42);
}
//读取information下的row节点设置行高为自动调整
HSSFRow row = sheet.createRow(0);
row.setHeight((short) 380);//目的是想把行高设置成31px
int rownum = information.getRow().size();//行的总数
CellRangeAddress region1 = new CellRangeAddress(0, 0, (short) 0, (short) 20);//合并单元格
CellRangeAddress region2 = new CellRangeAddress(0, 37, (short) 21, (short) 21);//合并单元格
sheet.addMergedRegion(region1);
sheet.addMergedRegion(region2);
for (int i = 1; i < rownum; i++) {
Row row1 = sheet.createRow(i);
if (i == 1 || i == 14 || i == 26) {
row1.setHeight((short) 480);
}
//建立单元格
int cellnum = information.getRow().get(i).getCell().size();//每一行单元格的总数
List<Integer> lindex = new ArrayList<Integer>();
for (int j = 0; j < cellnum; j++) {//将索引index放入一个list中
int index = information.getRow().get(i).getCell().get(j).getIndex();//获取该单元格起始列数
lindex.add(index);
}
for (int j = 0; j < cellnum; j++) {
int index = information.getRow().get(i).getCell().get(j).getIndex();//获取该单元格起始列数
int mergeAcross = index - 1;
if (information.getRow().get(i).getCell().get(j).getMergeAcross() != 0) {
mergeAcross += information.getRow().get(i).getCell().get(j).getMergeAcross();//获取该单元格结束列数
CellRangeAddress r1 = new CellRangeAddress(i, i, (short) index - 1, (short) mergeAcross);//合并单元格
sheet.addMergedRegion(r1);
}
if (information.getRow().get(i).getCell().get(j).getData() != null) {//设置数据相关的格式
HSSFCell cell = sheet.getRow(i).createCell(lindex.get(j) - 1);
String data = information.getRow().get(i).getCell().get(j).getData().getDat();//获取相应序列的data
cell.setCellValue(data);
int styleID = information.getRow().get(i).getCell().get(j).getStyleID();//获取每一个单元格相应的styleid
Set<Map.Entry<Integer, Style>> entrySet = styleMap.entrySet();
//遍历Set集合
Iterator<Map.Entry<Integer, Style>> it1 = entrySet.iterator();
while (it1.hasNext()) {
//得到每一对对应关系
Map.Entry<Integer, Style> entry = it1.next();
//通过每一对对应关系获取对应的key
int key = entry.getKey();
if (styleID == key) {
//通过每一对对应关系获取对应的value
HSSFFont font = wb.createFont();
Style value = entry.getValue();
HSSFCellStyle style = wb.createCellStyle();
//首先设置共有的属性部分
style.setVerticalAlignment(VerticalAlignment.TOP);
style.setWrapText(true);
String horizontal = value.getAlignment().getHorizontal();
if (horizontal.equals("Left")) {
style.setAlignment(HorizontalAlignment.LEFT);
} else if (horizontal.equals("Center")) {
style.setAlignment(HorizontalAlignment.CENTER);
} else {
style.setAlignment(HorizontalAlignment.RIGHT);
}
for (int k = 0; k < value.getBorders().size(); k++) {//设置边框样式
if (value.getBorders().get(k).getLinestyle() != null) {
if (k == 0) {
style.setBorderBottom(BorderStyle.THIN);
} else if (k == 1) {
style.setBorderTop(BorderStyle.THIN);
} else if (k == 2) {
style.setBorderLeft(BorderStyle.THIN);
} else if (k == 3) {
style.setBorderRight(BorderStyle.THIN);
if (information.getRow().get(i).getCell().get(j).getMergeAcross() != 0) {
mergeAcross = information.getRow().get(i).getCell().get(j).getMergeAcross() + index - 1;//获取该单元格结束列数
CellRangeAddress r1 = new CellRangeAddress(i, i, (short) index - 1, (short) mergeAcross);//
RegionUtil.setBorderTop(BorderStyle.THIN, r1, sheet);
RegionUtil.setBorderBottom(BorderStyle.THIN, r1, sheet);
RegionUtil.setBorderLeft(BorderStyle.THIN, r1, sheet);
RegionUtil.setBorderRight(BorderStyle.THIN, r1, sheet);
}
}
}
}
cell.setCellStyle(style);
if (value.getInterior().getPattern() != null) {
style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); //填充单元格
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
}
font.setFontName("serif");//设置字体
if (value.getFont().getSize() == 16) {
font.setFontHeightInPoints((short) 16);//设置字号
} else {
font.setFontHeightInPoints((short) 10);//设置字号
}
if (value.getFont().getBold() == 1) {
font.setBold(true);
}
font.setColor(IndexedColors.BLACK.getIndex());
style.setFont(font);
}
}
}
}
}
FileOutputStream fileOut;
try {
fileOut = new FileOutputStream("D:/Work/c.xls");
wb.write(fileOut);
fileOut.close();
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("写出成功!");
}
}
包依赖:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.jzcf</groupId>
<artifactId>xmlwork</artifactId>
<version>1.0-SNAPSHOT</version>
<name>xmlwork</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<kotlin.version>1.2.71</kotlin.version>
</properties>
<dependencies>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>1.3.02</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.6.2-jaxb-1.0.6</version>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.5</version>
</dependency>
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-examples</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-excelant</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-scratchpad</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>stax</groupId>
<artifactId>stax-api</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test</artifactId>
<version>${kotlin.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
<configuration>
<jvmTarget>1.8</jvmTarget>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>testCompile</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
以上就是我本次程序的实现过程及代码,后续会放一个打包好的项目文件,有需要的朋友可以自取
内容总结
以上是互联网集市为您收集整理的基于DOM4j和POI实现的XML文件转换为XLS(即标准EXCEL)的JAVA程序全部内容,希望文章能够帮你解决基于DOM4j和POI实现的XML文件转换为XLS(即标准EXCEL)的JAVA程序所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。