下面是一段簡單的示例配置git
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:excelbatis="http://www.taobao.com/excelbatis/orm" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.taobao.com/excelbatis/orm http://www.taobao.com/excelbatis/orm.xsd" default-autowire="byName"> <excelbatis:processor id="processor" readEntityType="com.excel.orm.demo.PersonInfo"> <excelbatis:columnAttrs> <excelbatis:columnAttr columnName="name" columnField="name"/> <excelbatis:columnAttr columnName="age" columnField="age"/> <excelbatis:columnAttr columnName="birthday" columnField="birthday" builtInConvertor="dateConvertor"/> </excelbatis:columnAttrs> </excelbatis:processor> </beans>
下面分紅幾步來講:github
xmlns:excelbatis="http://www.taobao.com/excelbatis/orm"
http://www.taobao.com/excelbatis/orm http://www.taobao.com/excelbatis/orm.xsd
<excelbatis:processor id="processor" readEntityType="com.excel.orm.demo.PersonInfo">
配置每一列:spring
依賴你前面定義的processor的bean而後調用com.excel.orm.processor.ExcelBatisProcessor#parse方法來解析excel文件到實體List,調用com.excel.orm.processor.ExcelBatisProcessor#write方法將實體列表寫入excel文件apache