jxl 依据xml映射配置 导入导出excel (1)

前端之家收集整理的这篇文章主要介绍了jxl 依据xml映射配置 导入导出excel (1)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

表映射配置类

publicclassExcelToTableConfig{
privateintstartRow;
privateintmaxSheetRows;//excel单sheet最大记录数
privateStringtableName;
privateList<Column>columnList;
privateStringchineseName;

publicintgetStartRow(){
returnstartRow;
}

publicvoidsetStartRow(intstartRow){
this.startRow=startRow;
}

publicintgetMaxSheetRows(){
returnmaxSheetRows;
}

publicvoidsetMaxSheetRows(intmaxSheetRows){
this.maxSheetRows=maxSheetRows;
}

publicStringgetTableName(){
returntableName;
}

publicvoidsetTableName(StringtableName){
this.tableName=tableName;
}

publicList<Column>getColumnList(){
returncolumnList;
}

publicvoidsetColumnList(List<Column>columnList){
this.columnList=columnList;
}

publicStringgetChineseName(){
returnchineseName;
}

publicvoidsetChineseName(StringchineseName){
this.chineseName=chineseName;
}
}

列映射配置类

publicclassColumn{
privateintindex;
privateStringfieldName;
privateStringcolName;
privateStringcolType;
privateStringisHidden;
privateStringisWhere;
privateStringchineseName;
privateintlength;
privateStringreadOnly;

publicintgetIndex(){
returnindex;
}

publicvoidsetIndex(intindex){
this.index=index;
}

publicStringgetFieldName(){
returnfieldName;
}

publicvoidsetFieldName(StringfieldName){
this.fieldName=fieldName;
}

publicStringgetColName(){
returncolName;
}

publicvoidsetColName(StringcolName){
this.colName=colName;
}

publicStringgetColType(){
returncolType;
}

publicvoidsetColType(StringcolType){
this.colType=colType;
}

publicStringgetIsHidden(){
returnisHidden;
}

publicvoidsetIsHidden(StringisHidden){
this.isHidden=isHidden;
}

publicStringgetIsWhere(){
returnisWhere;
}

publicvoidsetIsWhere(StringisWhere){
this.isWhere=isWhere;
}

publicStringgetChineseName(){
returnchineseName;
}

publicvoidsetChineseName(StringchineseName){
this.chineseName=chineseName;
}

publicintgetLength(){
returnlength;
}

publicvoidsetLength(intlength){
this.length=length;
}

publicStringgetReadOnly(){
returnreadOnly;
}

publicvoidsetReadOnly(StringreadOnly){
this.readOnly=readOnly;
}
}

xml配置

<?xmlversion="1.0"encoding="UTF-8"?>
<tabletableName="ytby_hd_act_order"startRow="1"chineseName="奖品记录">
<columnindex="0"colName="ID"chineseName="内码"length="12"colType="long"isHidden="Yes"isWhere="Yes"></column>
<columnindex="1"colName="PRIZE_CODE"chineseName="兑奖码"length="16"colType="String"isHidden="No"isWhere="No"></column>
</table>

猜你在找的XML相关文章