zoukankan      html  css  js  c++  java
  • excel控件只为简单写入数据表--github找到ExcelUtil笔记

    github地址

    https://github.com/SargerasWang/ExcelUtil

    文档地址

    https://sargeraswang.com/blog/2018/11/27/excelutil-1-dot-2-1-doc/

    本文只记录个人使用–写入excel

    1、导入maven依赖

    <dependency>
        <groupId>com.sargeraswang.util</groupId>
        <artifactId>excel-util</artifactId>
        <version>1.2.1</version>
    </dependency>
    

    官网1.2.4在maven中央仓库好像没有

    2、准备实体类

    public class Propmanger {
    
        private String proOrgCode;
    
        private String cityOrgCode;
    
        @ExcelCell(index = 0)
        private String provinceName;
    
        @ExcelCell(index = 1)
        private String cityName;
    
        //setter and getter 省略...
    }
    

    3、到出逻辑

    	    List<Propmanger> propmangers = propertyMangerService.seleceAll();
            System.out.println(propmangers.size());
            Map<String,String> map = new LinkedHashMap<>();
            map.put("provinceName","省");
            map.put("cityName","市");
            File f=new File("test.xls");
            OutputStream out =new FileOutputStream(f);
    
            ExcelUtil.exportExcel(map, propmangers, out);
            out.close();
    

    4、结果

    在这里插入图片描述

  • 相关阅读:
    Nginx配置文件的路径
    有关Tomcat 8.5版本文件上传后无权限访问的问题
    常见HTTP状态码列表
    服务器BMC(带外)
    CDN问题
    PECE
    linux系统概述
    干货--整蛊你的舍友
    arp请求与回复
    huawei oceanstor
  • 原文地址:https://www.cnblogs.com/zhangguangxiang/p/14232551.html
Copyright © 2011-2022 走看看