<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                **模式一:map數據,手動封裝ExcelExportEntity集合** 現在要導出格式如下: ![](https://img.kancloud.cn/b1/23/b1230f1abe83b3341377ba5a28325107_451x157.png) --------- 數據格式如下: ~~~ List<Map<String,Object>> dataList = new ArrayList<Map<String,Object>>(); Map<String,Object> map1 = new HashMap<>(); map1.put("name","小明"); map1.put("age","21"); map1.put("degree","36"); map1.put("link_name","小八"); map1.put("link_age","33"); dataList.add(map1); Map<String,Object> map2 = new HashMap<>(); map2.put("name","小王"); map2.put("age","24"); map2.put("degree","37"); map2.put("link_name","小六"); map2.put("link_age","26"); dataList.add(map2); ~~~ 配置ExcelExportEntity集合如下: ~~~ List<ExcelExportEntity> entityList = new ArrayList<>(); //一般表頭使用這種兩個參數的構造器 ExcelExportEntity e1 = new ExcelExportEntity("姓名","name"); ExcelExportEntity e2 = new ExcelExportEntity("年齡","age"); ExcelExportEntity e3 = new ExcelExportEntity("體溫","degree"); entityList.add(e1); entityList.add(e2); entityList.add(e3); //需要被設置成子表頭的使用這種三個參數的構造器,設置colspan為true ExcelExportEntity e5 = new ExcelExportEntity("姓名","link_name",true); ExcelExportEntity e6 = new ExcelExportEntity("年齡","link_age", true); entityList.add(e5); entityList.add(e6); //合并表頭也需要設置colspan為true ExcelExportEntity e4 = new ExcelExportEntity("緊急聯系人","linkman",true); List<String> sub = new ArrayList<>(); sub.add("link_name"); sub.add("link_age"); //還需要設置一個子表頭key的集合 e4.setSubColumnList(sub); entityList.add(e4); ~~~ 調用ExcelExportUtil.exportExcel方法生成workbook ~~~ Workbook wb = ExcelExportUtil.exportExcel(new ExportParams(null, "sheetName"),entityList,dataList); ~~~ ==================================---=============================== **模式二:實體類,基于注解,添加excel注解groupName屬性** 現在要導出格式如下: ![](https://img.kancloud.cn/f7/a7/f7a7b133565fd1580f3bcbcafce877a8_541x198.png) ~~~ public class SysUser { @Excel(name = "登錄賬號", width = 15, groupName = "基本信息") private String username; @Excel(name = "真實姓名", width = 15, groupName = "基本信息") private String realname; @Excel(name = "頭像", width = 15) private String avatar; @Excel(name = "性別", width = 15) private String sex; .....省略后續getset ~~~ 數據如下: ~~~ List<SysUser> ls = new ArrayList<SysUser>(); SysUser s1 = new SysUser(); s1.setUsername("zhangsan"); s1.setRealname("張三"); s1.setAvatar("大頭貼"); s1.setSex("男"); ls.add(s1); SysUser s2 = new SysUser(); s2.setUsername("lisi"); s2.setRealname("李四"); s2.setAvatar("短寸頭"); s2.setSex("男"); ls.add(s2); SysUser s3 = new SysUser(); s3.setUsername("wangwu"); s3.setRealname("王舞"); s3.setAvatar("洗剪吹"); s3.setSex("女"); ls.add(s3); ~~~ 導出Workbook 方法: ~~~ Workbook wb = ExcelExportUtil.exportExcel(new ExportParams(null, "sheetName"),SysUser.class,ls); ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看