作者:乔山办公网日期:
返回目录:excel表格制作
完整的抄例子就是这样的。样式自己加上就行了。知
public static void main(String[] args) throws IOException {
String excelPath="d:/test.xls";//excel输出路径道
File excel=new File(excelPath);
OutputStream out=new FileOutputStream(excel);
HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet sheet = workbook.createSheet("标签名");
HSSFRow firstHeaderRow=sheet.createRow(0);// 第一行
sheet.addMergedRegion(new CellRangeAddress(0,0,0,8));
HSSFCell yearCell=firstHeaderRow.createCell(0);
yearCell.setCellValue("标题");
workbook.write(out);
out.flush();
out.close();
}