读书人

poi 生成excel表格一般步骤

发布时间: 2012-12-21 12:03:49 作者: rapoo

poi 生成excel报表一般步骤

//表题

//表头

//数据

//合并区域

//是否显示网格线

//行号

//外边框加粗

//内边框普通

//设置打印区域

//打印设置

?

private static void createCell(Workbook wb, Row row, int column, short halign, short valign,String text){        Cell cell = row.createCell(column);        cell.setCellValue(text);        CellStyle cellStyle = wb.createCellStyle();        cellStyle.setAlignment(halign);        cellStyle.setVerticalAlignment(valign);                cellStyle.setBorderBottom(CellStyle.BORDER_THIN);        cellStyle.setBorderLeft(CellStyle.BORDER_THIN);        cellStyle.setBorderRight(CellStyle.BORDER_THIN);        cellStyle.setBorderTop(CellStyle.BORDER_THIN);        cell.setCellStyle(cellStyle);    }private static void createCell(Workbook wb, Row row, int column, short halign, short valign,RichTextString richText){        Cell cell = row.createCell(column);        cell.setCellValue(richText);        CellStyle cellStyle = wb.createCellStyle();        cellStyle.setAlignment(halign);        cellStyle.setVerticalAlignment(valign);        cell.setCellStyle(cellStyle);        cellStyle.setBorderBottom(CellStyle.BORDER_THIN);        cellStyle.setBorderLeft(CellStyle.BORDER_THIN);        cellStyle.setBorderRight(CellStyle.BORDER_THIN);        cellStyle.setBorderTop(CellStyle.BORDER_THIN);        cell.setCellStyle(cellStyle);    }

?

读书人网 >行业软件

热点推荐