public static void exportMain(String templatePath){

        //获取模板
        File file = new File(templatePath);

        InputStream is = null;

        XSSFWorkbook wb = null;

        XSSFSheet sheet = null;

        InputStream exportInput = null;

        try {

            is = new FileInputStream(file);// 将excel文件转为输入流

            wb = new XSSFWorkbook(is);// 创建个workbook,

            // 获取第一个sheet
            sheet = wb.getSheetAt(0);

            //存储表头合并部分
            Map<String,String> newBtMap = new HashMap<>();
            //获取合并部分
            for (int i=0;i<sheet.getNumMergedRegions();i++){
                CellRangeAddress region = sheet.getMergedRegion(i);
                int firstRow = region.getFirstRow();
                int firstColumn = region.getFirstColumn();
                int lastColumn = region.getLastColumn();
                int lastRow = region.getLastRow();
                //锁定表头且是列合并的,只是列合并的不管
                if (firstRow <3 || firstRow>5 || (lastColumn-firstColumn==0 && lastRow-firstRow>0)){
                    continue;
                }

                Row row = sheet.getRow(firstRow);
                Cell cell = row.getCell(firstColumn);
                String newBtName = cell.toString().trim();
                System.out.println("开始列:"+ firstColumn +",结束列:"+ lastColumn +",开始行:"+firstRow+",结束列:"+ lastRow+",值:"+newBtName);
                if (StringUtils.isEmpty(newBtName)){
                    continue;
                }
                for (int j=firstColumn;j<=lastColumn;j++){
                    String oldBtName = newBtMap.get(String.valueOf(j));
                    String newScBtName = "";
                    if (!StringUtils.isEmpty(oldBtName)){
                        newScBtName = oldBtName.trim() + "-";
                    }
                    newScBtName += newBtName ;
                    newBtMap.put(String.valueOf(j),newScBtName.replaceAll("\\s*|\r|\n|\t",""));
                }
            }

            System.out.println("合并表头:"+ JSONObject.toJSONString(newBtMap));

//            //例子是第四行开始表头
//            XSSFRow row3 = sheet.getRow(3);
//
//            //获取总列数
//            int cellNum = row3.getLastCellNum();
//
//            //获取第四行的列
//            for (int i=0;i<cellNum;i++){
//                XSSFCell cell = row3.getCell(i);
//                System.out.println("第4行第"+(i+1)+"列:"+cell.toString());
//            }

        }catch (Exception e){
            e.printStackTrace();
        }
    }