java excel 多列排序_java poi处理excel多sheet并实现排序

需求:有一个数据字典全量汇总表,其中第一个sheet为目录,包括编号和表名,第二个以后为表的明细。其中sheet名就是表名但无序,sheet内字段序号无序有空行

现在要求将其中101,104,107,111表中的格式列和字段名称以及表名取出,生成批量语句,要求按给的编号有序输出,字段出要有序并排除窄。

输出结果如下:

insert into t_export(export_id,owner,table_name,col_name,format) values(101,'T_A','scott','id','20180308001');

insert into t_export(export_id,owner,table_name,col_name,format) values(101,'T_A','scott','sal','2000');

insert into t_export(export_id,owner,table_name,col_name,format) values(101,'T_A','scott','20','张三');

insert into t_export(export_id,owner,table_name,col_name,format) values(101,'T_A','scott','remark','hello');

insert into t_export(export_id,owner,table_name,col_name,format) values(101,'T_A','scott','birthday','40479');

insert into t_export(export_id,owner,table_name,col_name,format) values(101,'T_A','scott','age','20');

.

.

.

至111

excel如下:

9abc0b4e398ff25ef4ac6a2d97096976.png

3c927280987b93a434fd83d7002d7b25.png

下载poi包poi-3.17.jar并引入eclipse的java工程,仅需要RowInfo.java,ShowExcel.java

0bf56bc05273713c4e11144c59534982.png

RowInfo.java:

package pu;

public class RowInfo implements Comparable{//实现字段排序

private int rownumb;

private int expId;

private String tableName;

private String columnName;

private String formatInfo;

public RowInfo(int rownumb,int expId, String tableName, String columnName,String formatInfo) {

super();

this.rownumb=rownumb;

this.expId = expId;

this

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值