<address id="ousso"></address>
<form id="ousso"><track id="ousso"><big id="ousso"></big></track></form>
  1. java如何使用poi對Execl簡單寫操作

    時間:2025-12-26 21:16:18 java語言

    java如何使用poi對Execl簡單寫操作

      如何進行Java使用poi對Execl簡單寫操作呢?下面是小編給大家提供的代碼,大家可以參考閱讀,更多詳情請關注應屆畢業生考試網。

      java使用poi對Execl簡單寫操作

      public class WriteExecl {

      public void writeExeclTest() throws Exception{

      OutputStream os = new FileOutputStream("F:/execl/writeTest2.xlsx");

      /pic/pic/p>

      Workbook wb = new XSSFWorkbook(); /pic/p>

      CellStyle cellStyle = wb.createCellStyle(); /pic/p>

      cellStyle.setBorderLeft(CellStyle.BORDER_THIN); /pic/p>

      cellStyle.setBorderRight(CellStyle.BORDER_THIN);/pic/p>

      cellStyle.setBorderTop(CellStyle.BORDER_THIN);/pic/p>

      cellStyle.setBorderBottom(CellStyle.BORDER_THIN);/pic/p>

      cellStyle.setAlignment(CellStyle.ALIGN_CENTER); /pic/p>

      cellStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER); /pic/p>

      cellStyle.setBottomBorderColor(IndexedColors.RED.getIndex()); /pic/p>

      cellStyle.setFillForegroundColor(IndexedColors.DARK_YELLOW.getIndex()); /pic/p>

      cellStyle.setFillPattern(CellStyle.SOLID_FOREGROUND); /pic/p>

      Sheet sheet = wb.createSheet("第一個sheet"); /pic/p>

      sheet.setDefaultColumnWidth(1000); /pic/p>

      sheet.setDefaultRowHeight((short) 800); /pic/p>

      Row row = sheet.createRow(0); /pic/p>

      row.createCell(0, Cell.CELL_TYPE_BLANK); /pic/p>

      row.createCell(1, Cell.CELL_TYPE_BOOLEAN).setCellValue(true); /pic/p>

      row.createCell(2, Cell.CELL_TYPE_FORMULA).setCellValue(3.141592653); /pic/p>

      row.createCell(3, Cell.CELL_TYPE_NUMERIC).setCellValue(0); /pic/p>

      row.createCell(4, Cell.CELL_TYPE_STRING).setCellValue("String..."); /pic/p>

      row.setRowStyle(cellStyle); /pic/p>

      wb.write(os); /pic/p>

      os.close(); /pic/p>

      }

      }

    【java如何使用poi對Execl簡單寫操作】相關文章:

    如何使用java12-19

    如何使用java多線程10-09

    如何正確使用Java數組10-04

    淺談如何使用java多線程08-04

    Java中如何使用嵌入MySQL08-27

    如何使用一個java11-28

    Java入門教程:如何使用一個Java02-18

    如何使用php操作redis隊列實例08-24

    如何使用Ghost備份操作系統01-31

    <address id="ousso"></address>
    <form id="ousso"><track id="ousso"><big id="ousso"></big></track></form>
    1. 日日做夜狠狠爱欧美黑人