<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>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ```java @Test public void easyExcel() throws IOException { //1. 示例數據 List<Student> students = new ArrayList<>(); Student student01 = new Student("張三", 25, "男生"); Student student02 = new Student("王五", 29, "男生"); students.add(student01); students.add(student02); //2. 創建文檔 SXSSFWorkbook workbook = new SXSSFWorkbook(); //3. 創建一個sheet(表格),參數為表格名稱 SXSSFSheet sheet = workbook.createSheet("表格1"); //4. 生成表頭 String[] titles = new String[]{"姓名", "年齡", "性別"}; //生成行,行數從0開始,表頭就是第0行 SXSSFRow titleRow = sheet.createRow(0); for (int i = 0; i < titles.length; i++) { //生成列,列從第0列開始 SXSSFCell cell = titleRow.createCell(i); //往表格列填值 cell.setCellValue(titles[i]); } //5. 將數據寫入表格 for (int i = 0; i < students.size(); i++) { Student student = students.get(i); //第0行已經被表頭占用,所以這里從第1行開始 SXSSFRow row = sheet.createRow(i + 1); //生成3列 SXSSFCell nameCell = row.createCell(0); SXSSFCell ageCell = row.createCell(1); SXSSFCell genderCell = row.createCell(2); //往表格列填值 nameCell.setCellValue(student.getName()); ageCell.setCellValue(student.getAge()); genderCell.setCellValue(student.getGender()); } //6. 輸出到磁盤文件中 File excelFile = new File("e:/write/001.xlsx"); FileOutputStream out = new FileOutputStream(excelFile); workbook.write(out); //這里使用的是SXSSF,會產生臨時文件,輸出到磁盤后刪除臨時文件 workbook.dispose(); workbook.close(); out.close(); } ``` 效果如下: ![](https://img.kancloud.cn/ff/8e/ff8e73e3a5b6c0513605ee018e08ba24_1813x569.png)
                  <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>

                              哎呀哎呀视频在线观看