Java导出excel cell.setCellValue() 用什么方法设置单元格的值?
参考代码 :
public static void createColHeader(HSSFSheet sheet, CellStyle cellStyle,String[] columHeader) {if (sheet != null) { sheet.setDefaultColumnWidth(20); HSSFRow row = sheet.createRow(0); for (int i = 0; i < columHeader.length; i++) { HSSFCell cell = row.createCell(i); cell.setCellValue(columHeader[i]); if (cellStyle != null) { cell.setCellStyle(cellStyle); } } freezePane(sheet,0,1,0,1); }}
java怎么用poi设置excel单元格边框?
setBorder.setBorderBottom(HSSFCellStyle.BORDER_THIN); //下边框
setBorder.setBorderLeft(HSSFCellStyle.BORDER_THIN);//左边框
setBorder.setBorderTop(HSSFCellStyle.BORDER_THIN);//上边框
setBorder.setBorderRight(HSSFCellStyle.BORDER_THIN);//右边框
广告 您可能关注的内容 |