poi操纵excel样例好似api

public static void main(String[] args) throws IOException { try{ HSSFWorkbook wb = new HSSFWorkbook(); HSSFSheet sheet = wb.createSheet("new sheet"); HSSFCellStyle style = wb.createCellStyle(); //样式对象 style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);//垂直 style.setAlignment(HSSFCellStyle.ALIGN_CENTER);//水平 HSSFRow row = sheet.createRow((short) 0); HSSFRow row2 = sheet.createRow((short) 1); sheet.addMergedRegion(new Region(0,(short)0,1,(short)0)); HSSFCell ce=row.createCell((short)0); ce.setEncoding(HSSFCell.ENCODING_UTF_16);//中文处理 ce.setCellValue("项目\\日期"); //表格的第一行第一列显示的数据 ce.setCellStyle(style); //样式,居中 int num=0; for(int i=0;i

你可能感兴趣的:(Excel)