JAVA使用POI操作Excel入门程序

此页面是否是列表页或首页?未找到合适正文内容。

JAVA使用POI操作Excel入门程序

标签:工作createwritenesstyle多行bleworkheight

jar 包地址:

  链接: https://pan.baidu.com/s/1gfOVslH 密码: 44wu

1 /**
2 * 创建一个工作薄
3 * @throws IOException
4 */
5 @Test
6 public void createWorkbook() throws IOException {
7 Workbook wb = new HSSFWorkbook() ;
8 FileOutputStream out = new FileOutputStream(\”G:\\\\工作薄.xls\”) ;
9 wb.write(out);
10 out.close();
11 }

1 /**
2 * 创建一个Sheet页
3 * @throws IOException
4 */
5 @Test
6 public void createSheet() throws IOException {
7 Workbook wb = new HSSFWorkbook() ;
8 FileOutputStream out = new FileOutputStream(\”G:\\\\工作薄.xls\”) ;
9 wb.createSheet(\”第一个Sheet页\”) ;
10 wb.createSheet(\”第二个Sheet页\”) ;
11 wb.write(out);
12 out.close();
13 }

1 /**
2 * 创建Row(行) 和 Cell(列) 并在单元格中写入数据
3 * @throws IOException
4 */
5 @Test
6 public void createRowAndCell() throws IOException {
7 Workbook wb = new HSSFWorkbook() ;
8 FileOutputStream out = new FileOutputStream(\”G:\\\\工作薄.xls\”) ;
9 Sheet>) ;
10
11 // 创建Row
12 Row>// 创建第一行,可以创建多行

作者: liuzhihao

为您推荐

返回顶部