HSSFRow row = sheet.createRow(i);
for (int j = 0; j < headerRow.size(); j++) {
HashMap map=(HashMap) headerRow.get(j);
short rowspan=Short.valueOf( map.get("rowspan")+"");
short rowend=(short)(rowstart+rowspan-1);
HSSFCell cell = row.createCell((short)rowstart);
//导出前先设置,而且值设置在第一个框中
cell.setCellValue(new String(String.valueOf(map.get("value")).getBytes(),"UTF-8"));
cell.setEncoding(HSSFCell.ENCODING_UTF_16);//设置单元格编码防止乱码
//四个参数分别是:起始行,起始列,结束行,结束列
sheet.addMergedRegion(new Region(colstart, rowstart, colend,rowend ));
// cell.setCellStyle(HSSFCellStyle.)
rowstart=(short)(rowend+1);
}
colstart=colend+1;
}