读书人

POI学习札记(三)

发布时间: 2012-11-10 10:48:50 作者: rapoo

POI学习笔记(三)

14. 自定义颜色

????? HSSF:

?

?

? 备注:只有在打印预览的时候页脚才显示出来。

?20. 选中一个Sheet

public void shiftRow() throws Exception{Workbook wb = new HSSFWorkbook();        Sheet sheet = wb.createSheet("row sheet");        for(int i=0;i<20;i++){        Row row=sheet.createRow(i);        Cell cell=row.createCell(0);        cell.setCellValue(""+i);        }        // Shift rows 6 - 11 on the spreadsheet to the top (rows 0 - 5)        //把第6-11行向上移动5行        sheet.shiftRows(5, 10,-5);        FileOutputStream fileOut = new FileOutputStream("workbook.xls");    wb.write(fileOut);    fileOut.close();}

?POI学习笔记四将会介绍poi更高级的一些知识点。

读书人网 >软件架构设计

热点推荐