private void caeateJobSheet(HSSFWorkbook workbook, HSSFSheet sheet)
throws Exception {
// 设置表头样式
HSSFCellStyle headStyle = workbook.createCellStyle();
HSSFFont headFont = workbook.createFont();
headFont.setFontHeightInPoints((short) 12);// 字号
headFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);// 加粗
headStyle.setFont(headFont);
headStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);// 左右居中
headStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);// 上下居中
headStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
headStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
headStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
headStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
headStyle.setTopBorderColor(HSSFColor.BLACK.index);
headStyle.setLeftBorderColor(HSSFColor.BLACK.index);
headStyle.setBottomBorderColor(HSSFColor.BLACK.index);
headStyle.setRightBorderColor(HSSFColor.BLACK.index);
// 创建行
HSSFRow row = sheet.createRow(0); //第一行
HSSFCell cell_inst_no = row.createCell(0);
cell_inst_no.setCellStyle(headStyle);
cell_inst_no.setCellValue("学号");
sheet.setColumnWidth(0, 7000);
}
图为下载的模板,想让学号一列为文本类型,应该怎样设置