poi操作excel技巧

poi操作excel技巧

ID:14386278

大小:191.00 KB

页数:29页

时间:2018-07-28

poi操作excel技巧_第1页
poi操作excel技巧_第2页
poi操作excel技巧_第3页
poi操作excel技巧_第4页
poi操作excel技巧_第5页
资源描述:

《poi操作excel技巧》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库

1、POI操作EXCEL技巧Java代码1.1.创建工作簿 (WORKBOOK)     2.    3.    HSSFWorkbook wb = new HSSFWorkbook();     4.    5.    FileOutputStream fileOut = new FileOutputStream("workbook.xls");     6.    7.    wb.write(fileOut);     8.    9.    fileOut.close();     10.    11.2.创建工作表(SHEET)     12.    13.    HSSFWorkb

2、ook wb = new HSSFWorkbook();     14.    15.    HSSFSheet sheet1 = wb.createSheet("new sheet");     16.    17.    HSSFSheet sheet2 = wb.createSheet("second sheet");     18.    19.    FileOutputStream fileOut = new FileOutputStream("workbook.xls");     20.    21.    wb.write(fileOut);     22.    23.

3、    fileOut.close();     24.    25.3.创建单元格(CELL)     26.    27.    HSSFWorkbook wb = new HSSFWorkbook();     28.    29.    HSSFSheet sheet = wb.createSheet("new sheet");     30.    31.    // Create a row and put some cells in it. Rows are 0 based.     32.    33.    HSSFRow row = sheet.createRow((s

4、hort)0);     34.    35.    // Create a cell and put a value in it.     36.    37.    HSSFCell cell = row.createCell((short)0);     38.    1.    cell.setCellValue(1);     2.    3.    // Or do it on one line.     4.    5.    row.createCell((short)1).setCellValue(1.2);     6.    7.    row.createCell(

5、(short)2).setCellValue("This is a string");     8.    9.    row.createCell((short)3).setCellValue(true);     10.    11.    // Write the output to a file     12.    13.    FileOutputStream fileOut = new FileOutputStream("workbook.xls");     14.    15.    wb.write(fileOut);     16.    17.    fileOut

6、.close();     18.    19.4.创建指定单元格式的单元格     20.    21.    HSSFWorkbook wb = new HSSFWorkbook();     22.    23.    HSSFSheet sheet = wb.createSheet("new sheet");     24.    25.    // Create a row and put some cells in it. Rows are 0 based.     26.    27.    HSSFRow row = sheet.createRow((short)0);  

7、   28.    29.    // Create a cell and put a date value in it.  The first cell is not styled     30.    31.    // as a date.     32.    33.    HSSFCell cell = row.createCell((short)0);     34.    35.    cell.setCe

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。