//注意再合并单元格的时候,
sheet1.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex + surveySearches.size()-1, 3, 3));
//如果不能确定rowIndex 和 rowIndex + surveySearches.size()-1 是否相同,那么需要以下方法
// 合并单元格
private void addMergedRegion(XSSFSheet sheet1, int rowIndex, int rowEnd, int firstCol, int lastCol){
if (rowIndex != rowEnd){
sheet1.addMergedRegion(new CellRangeAddress(rowIndex, rowEnd, firstCol, lastCol));
}
}
//如果不判断
//会出现以下错误:java.lang.IllegalArgumentException: Merged region A9 must contain 2 or more cells