Example usage for org.apache.poi.ss.util CellRangeAddress CellRangeAddress

List of usage examples for org.apache.poi.ss.util CellRangeAddress CellRangeAddress

Introduction

In this page you can find the example usage for org.apache.poi.ss.util CellRangeAddress CellRangeAddress.

Prototype

public CellRangeAddress(int firstRow, int lastRow, int firstCol, int lastCol) 

Source Link

Document

Creates new cell range.

Usage

From source file:com.selfsoft.business.service.impl.TbBusinessBalanceServiceImpl.java

public void printTbBusinessBalanceTemplate(OutputStream os, String tpl, Long id, String companyName) {
    // ??/*  w  ww.jav  a  2 s  . co  m*/
    TbBusinessBalance tbBusinessBalance = this.findById(id);
    // ?
    TbFixEntrust tbFixEntrust = tbFixEntrustService.findById(tbBusinessBalance.getTbFixEntrust().getId());
    // ?
    TbCustomer tbCustomer = tbCustomerService.findById(tbFixEntrust.getTbCustomer().getId());
    // ?
    TbCarInfo tbCarInfo = tbCarInfoService.findById(tbFixEntrust.getTbCarInfo().getId());
    // ??
    TmCompany tmCompany = tmCompanyService.acquireUniqueTmCompany();

    // ?
    List<TbFixEntrustContent> tbFixEntrustContentList = tbFixEntrustContentService
            .findTbFixEnTrustContentListByTbFixEntrustId(tbFixEntrust.getId());

    List<TbFixEntrustContent> tbFixEntrustContentListPage = new ArrayList<TbFixEntrustContent>();

    List<TbFixEntrustContent> tbFixEntrustContentListTemp = new ArrayList<TbFixEntrustContent>();

    List<TbFixEntrustContent> tbFixEntrustContentListAdd = new ArrayList<TbFixEntrustContent>();

    if (null != tbFixEntrustContentList && tbFixEntrustContentList.size() > 0) {

        for (int i = 0; i < tbFixEntrustContentList.size(); i++) {

            boolean flag = false;

            if (tbFixEntrustContentListTemp.size() == 0) {

                tbFixEntrustContentListTemp.add(tbFixEntrustContentList.get(i));

            } else {
                if (tbFixEntrustContentListTemp.size() > 1) {

                    for (TbFixEntrustContent _tbFixEntrustContent : tbFixEntrustContentListTemp) {

                        if (_tbFixEntrustContent.getStationName()
                                .equals(tbFixEntrustContentList.get(i).getStationName())
                                && _tbFixEntrustContent.getTbWorkingInfo().getId()
                                        .equals(tbFixEntrustContentList.get(i).getTbWorkingInfo().getId())
                                && _tbFixEntrustContent.getFreesymbol()
                                        .equals(tbFixEntrustContentList.get(i).getFreesymbol())

                        ) {

                            flag = true;

                            break;

                        }

                    }

                }

            }

            if (flag) {

                continue;

            } else {

                tbFixEntrustContentListTemp.add(tbFixEntrustContentList.get(i));

            }

            TbFixEntrustContent temp = tbFixEntrustContentList.get(i);

            BigDecimal d = new BigDecimal(temp.getFixHourAll());

            BigDecimal d2 = new BigDecimal(temp.getFixHour());

            for (int j = i + 1; j < tbFixEntrustContentList.size(); j++) {

                if (temp.getStationName().equals(tbFixEntrustContentList.get(j).getStationName())
                        && temp.getTbWorkingInfo().getId()
                                .equals(tbFixEntrustContentList.get(j).getTbWorkingInfo().getId())
                        && temp.getFreesymbol().equals(tbFixEntrustContentList.get(j).getFreesymbol())) {

                    d = d.add(new BigDecimal(tbFixEntrustContentList.get(j).getFixHourAll()));

                    d2 = d2.add(new BigDecimal(tbFixEntrustContentList.get(j).getFixHour()));

                }

            }

            temp.setFixHourAll(d.doubleValue());

            temp.setFixHour(d2.doubleValue());

            if (!temp.getFreesymbol().equals(1d) || !temp.getFixHourAll().equals(0d)) {

                tbFixEntrustContentListAdd.add(temp);

            }

        }

    }

    // ??
    List<TbMaintianVo> maintianvos = tbMaintainPartContentService
            .getTbMaintianDetailVosByEntrustId(tbFixEntrust.getId(), Constants.BALANCE_ALL);
    // ?
    List<TmStockOutDetVo> tmStockOutDetVos = tmStockOutService
            .getSellDetailByEntrustCode(tbFixEntrust.getEntrustCode(), Constants.BALANCE_ALL);
    // 
    List<TbBusinessBalanceItem> tbBusinessBalanceItemList = tbBusinessBalanceItemService
            .findGroupTbBusinessBalanceItemListByTbBusinessBalanceId(tbBusinessBalance.getId());

    // ???
    if (null == maintianvos) {
        maintianvos = new ArrayList<TbMaintianVo>();
    }

    if (null != tmStockOutDetVos && tmStockOutDetVos.size() > 0) {

        for (TmStockOutDetVo tmStockOutDetVo : tmStockOutDetVos) {

            TbMaintianVo tbMaintianVo = new TbMaintianVo();

            tbMaintianVo.setPartId(tmStockOutDetVo.getPartinfoId());

            tbMaintianVo.setHouseName(tmStockOutDetVo.getHouseName());

            tbMaintianVo.setPartCode(tmStockOutDetVo.getPartCode());

            tbMaintianVo.setPartName(tmStockOutDetVo.getPartName());

            tbMaintianVo.setUnitName(tmStockOutDetVo.getUnitName());

            tbMaintianVo.setPrice(tmStockOutDetVo.getPrice());

            tbMaintianVo.setPartQuantity(tmStockOutDetVo.getQuantity());

            tbMaintianVo.setTotal(tmStockOutDetVo.getTotal());

            tbMaintianVo.setIsFree(tmStockOutDetVo.getIsFree());

            tbMaintianVo.setProjectType(tmStockOutDetVo.getProjectType());

            tbMaintianVo.setZl(tmStockOutDetVo.getZl());

            tbMaintianVo.setXmlx(tmStockOutDetVo.getXmlx());

            maintianvos.add(tbMaintianVo);
        }

    }

    /**
     * add by ccr 2010-12-18
     */
    List<TbMaintianVo> maintianvosTemp = new ArrayList<TbMaintianVo>();

    List<TbMaintianVo> maintianvosAdd = new ArrayList<TbMaintianVo>();

    if (maintianvos.size() > 0) {

        for (int i = 0; i < maintianvos.size(); i++) {

            boolean flag = false;

            if (maintianvosTemp.size() == 0) {

                maintianvosTemp.add(maintianvos.get(i));

            } else {

                if (maintianvosTemp.size() > 1) {

                    int l = 0;

                    for (TbMaintianVo _tbMaintianVo : maintianvosTemp) {

                        if (_tbMaintianVo.getPartId().equals(maintianvos.get(i).getPartId())
                                && _tbMaintianVo.getIsFree().equals(maintianvos.get(i).getIsFree())
                                && _tbMaintianVo.getPrice().equals(maintianvos.get(i).getPrice())) {

                            // maintianvosTemp.set(l, maintianvos.get(i));

                            flag = true;

                            break;

                        }

                        l++;

                    }

                }

            }

            if (flag) {

                continue;

            } else {

                maintianvosTemp.add(maintianvos.get(i));

            }

            TbMaintianVo temp = maintianvos.get(i);

            BigDecimal d1 = new BigDecimal(temp.getPartQuantity());

            BigDecimal d2 = new BigDecimal(temp.getTotal());

            for (int j = i + 1; j < maintianvos.size(); j++) {

                if (temp.getPartId().equals(maintianvos.get(j).getPartId())
                        && temp.getIsFree().equals(maintianvos.get(j).getIsFree())
                        && temp.getPrice().equals(maintianvos.get(j).getPrice())) {

                    temp.setPrice(maintianvos.get(j).getPrice());

                    d1 = d1.add(new BigDecimal(maintianvos.get(j).getPartQuantity()));

                    d2 = d2.add(new BigDecimal(maintianvos.get(j).getTotal()));

                }

            }

            temp.setPartQuantity(d1.doubleValue());

            temp.setTotal(d2.doubleValue());

            if (!temp.getIsFree().equals(1L) || !temp.getPartQuantity().equals(0d)) {

                /*
                 * temp.setPrice(new BigDecimal(temp.getTotal()).divide(new
                 * BigDecimal(temp.getPartQuantity()),2,
                 * BigDecimal.ROUND_HALF_UP).setScale(2,
                 * BigDecimal.ROUND_HALF_UP).doubleValue());
                 */

                maintianvosAdd.add(temp);

            }

        }

    }

    int fixSize = (tbFixEntrustContentListAdd == null ? 0 : tbFixEntrustContentListAdd.size());

    int partSize = (maintianvosAdd == null ? 0 : maintianvosAdd.size());

    try {
        HSSFWorkbook workbook = new HSSFWorkbook(this.getClass().getResourceAsStream(tpl));

        HSSFSheet sheet = workbook.getSheetAt(0);

        HSSFCellStyle style = workbook.createCellStyle();

        style.setWrapText(true);

        style.setAlignment(HSSFCellStyle.ALIGN_LEFT);

        style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

        HSSFFont font = workbook.createFont();

        font.setFontName("");

        font.setFontHeightInPoints((short) 9);

        style.setFont(font);

        HSSFCellStyle styleRight = workbook.createCellStyle();

        styleRight.setWrapText(true);

        styleRight.setAlignment(HSSFCellStyle.ALIGN_RIGHT);

        styleRight.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

        styleRight.setFont(font);

        HSSFCellStyle styleBorderThinAll = workbook.createCellStyle();

        styleBorderThinAll.setBorderLeft(HSSFCellStyle.BORDER_THIN);

        styleBorderThinAll.setBorderRight(HSSFCellStyle.BORDER_THIN);

        styleBorderThinAll.setBorderTop(HSSFCellStyle.BORDER_THIN);

        styleBorderThinAll.setBorderBottom(HSSFCellStyle.BORDER_THIN);

        styleBorderThinAll.setWrapText(true);

        styleBorderThinAll.setAlignment(HSSFCellStyle.ALIGN_LEFT);

        styleBorderThinAll.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

        styleBorderThinAll.setFont(font);

        HSSFCellStyle styleBorderThickLeft = workbook.createCellStyle();

        styleBorderThickLeft.setBorderLeft(HSSFCellStyle.BORDER_THICK);

        styleBorderThickLeft.setBorderRight(HSSFCellStyle.BORDER_THIN);

        styleBorderThickLeft.setBorderTop(HSSFCellStyle.BORDER_THIN);

        styleBorderThickLeft.setBorderBottom(HSSFCellStyle.BORDER_THIN);

        styleBorderThickLeft.setWrapText(true);

        styleBorderThickLeft.setAlignment(HSSFCellStyle.ALIGN_LEFT);

        styleBorderThickLeft.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

        styleBorderThickLeft.setFont(font);

        HSSFCellStyle styleBorderThickRight = workbook.createCellStyle();

        styleBorderThickRight.setBorderRight(HSSFCellStyle.BORDER_THICK);

        styleBorderThickRight.setBorderLeft(HSSFCellStyle.BORDER_THIN);

        styleBorderThickRight.setBorderTop(HSSFCellStyle.BORDER_THIN);

        styleBorderThickRight.setBorderBottom(HSSFCellStyle.BORDER_THIN);

        styleBorderThickRight.setWrapText(true);

        styleBorderThickRight.setAlignment(HSSFCellStyle.ALIGN_LEFT);

        styleBorderThickRight.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

        styleBorderThickRight.setFont(font);

        HSSFCellStyle styleBorderThinAllCenter = workbook.createCellStyle();

        styleBorderThinAllCenter.setBorderLeft(HSSFCellStyle.BORDER_THIN);

        styleBorderThinAllCenter.setBorderRight(HSSFCellStyle.BORDER_THIN);

        styleBorderThinAllCenter.setBorderTop(HSSFCellStyle.BORDER_THIN);

        styleBorderThinAllCenter.setBorderBottom(HSSFCellStyle.BORDER_THIN);

        styleBorderThinAllCenter.setWrapText(true);

        styleBorderThinAllCenter.setAlignment(HSSFCellStyle.ALIGN_CENTER);

        styleBorderThinAllCenter.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

        styleBorderThinAllCenter.setFont(font);

        HSSFCellStyle styleBorderThickLeftCenter = workbook.createCellStyle();

        styleBorderThickLeftCenter.setBorderLeft(HSSFCellStyle.BORDER_THICK);

        styleBorderThickLeftCenter.setBorderRight(HSSFCellStyle.BORDER_THIN);

        styleBorderThickLeftCenter.setBorderTop(HSSFCellStyle.BORDER_THIN);

        styleBorderThickLeftCenter.setBorderBottom(HSSFCellStyle.BORDER_THIN);

        styleBorderThickLeftCenter.setWrapText(true);

        styleBorderThickLeftCenter.setAlignment(HSSFCellStyle.ALIGN_CENTER);

        styleBorderThickLeftCenter.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

        styleBorderThickLeftCenter.setFont(font);

        HSSFCellStyle styleBorderThickRightCenter = workbook.createCellStyle();

        styleBorderThickRightCenter.setBorderRight(HSSFCellStyle.BORDER_THICK);

        styleBorderThickRightCenter.setBorderLeft(HSSFCellStyle.BORDER_THIN);

        styleBorderThickRightCenter.setBorderTop(HSSFCellStyle.BORDER_THIN);

        styleBorderThickRightCenter.setBorderBottom(HSSFCellStyle.BORDER_THIN);

        styleBorderThickRightCenter.setWrapText(true);

        styleBorderThickRightCenter.setAlignment(HSSFCellStyle.ALIGN_CENTER);

        styleBorderThickRightCenter.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

        styleBorderThickRightCenter.setFont(font);

        HSSFCellStyle styleCenter = workbook.createCellStyle();

        styleCenter.setWrapText(true);

        styleCenter.setAlignment(HSSFCellStyle.ALIGN_CENTER);

        styleCenter.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

        styleCenter.setFont(font);

        HSSFRow row = null;

        HSSFCell cell = null;

        row = sheet.getRow(2);

        cell = row.getCell(4);

        // cell.setCellStyle(style);

        if ("dfbz".equals(companyName)) {
            cell.setCellValue(Constants.getCompanyMap().get("dfbzCode"));
        } else if ("xtl".equals(companyName)) {

            cell.setCellValue(Constants.getCompanyMap().get("xtlCode"));
        }

        row = sheet.getRow(2);

        cell = row.getCell(17);

        if ("xtl".equals(companyName)) {
            cell.setCellValue(/* tmCompany.getCompanyName() */"?");
        } else {
            cell.setCellValue(tmCompany.getCompanyName());
        }

        row = sheet.getRow(2);

        cell = row.getCell(33);

        cell.setCellValue(tmCompany.getCompanyPhone() == null ? "" : tmCompany.getCompanyPhone());

        row = sheet.getRow(4);

        cell = row.getCell(4);

        if ("xtl".equals(companyName)) {
            cell.setCellValue("");
        } else {

            cell.setCellValue(tmCompany.getCompanyZipCode() == null ? "" : tmCompany.getCompanyZipCode());
        }

        row = sheet.getRow(4);

        cell = row.getCell(17);

        cell.setCellValue(tmCompany.getCompanyAddress() == null ? "" : tmCompany.getCompanyAddress());

        row = sheet.getRow(4);

        cell = row.getCell(33);

        cell.setCellValue(tmCompany.getCompanyFax() == null ? "" : tmCompany.getCompanyFax());

        row = sheet.getRow(10);

        cell = row.getCell(2);

        // cell.setCellStyle(style);

        String entrustCode = tbFixEntrust.getEntrustCode();

        String[] es = entrustCode.split("-");

        String newCode = "RO" + es[0].substring(2, 6) + es[1];

        cell.setCellValue(newCode);

        row = sheet.getRow(10);

        cell = row.getCell(24);

        // cell.setCellStyle(style);

        cell.setCellValue((tbFixEntrust.getTmUser().getUserRealName() == null
                || "".equals(tbFixEntrust.getTmUser().getUserRealName()))
                        ? tbFixEntrust.getTmUser().getUserName()
                        : tbFixEntrust.getTmUser().getUserRealName());

        row = sheet.getRow(10);

        cell = row.getCell(40);

        // cell.setCellStyle(styleCenter);

        cell.setCellValue(
                CommonMethod.parseDateToString(tbBusinessBalance.getBananceDate(), "yyyy-MM-dd HH:mm"));

        row = sheet.getRow(8);

        cell = row.getCell(40);

        // cell.setCellStyle(styleCenter);

        cell.setCellValue(CommonMethod.parseDateToString(tbFixEntrust.getFixDate(), "yyyy-MM-dd HH:mm"));

        row = sheet.getRow(12);

        cell = row.getCell(4);

        cell.setCellValue(tbCustomer.getCustomerName());

        row = sheet.getRow(12);

        cell = row.getCell(24);

        cell.setCellValue(tbCarInfo.getLicenseCode());

        row = sheet.getRow(12);

        cell = row.getCell(41);

        cell.setCellValue(tbCarInfo.getTmCarModelType().getModelName());

        row = sheet.getRow(14);

        cell = row.getCell(4);

        cell.setCellValue(tbCustomer.getTelephone() == null ? "" : tbCustomer.getTelephone());

        row = sheet.getRow(18);

        cell = row.getCell(12);

        cell.setCellValue(tbCustomer.getTelephone() == null ? "" : tbCustomer.getTelephone());

        row = sheet.getRow(14);

        cell = row.getCell(24);

        cell.setCellValue(tbCarInfo.getChassisCode());

        row = sheet.getRow(16);

        cell = row.getCell(4);

        cell.setCellValue(tbCustomer.getAddress() == null ? "" : tbCustomer.getAddress());

        row = sheet.getRow(16);

        cell = row.getCell(24);

        cell.setCellValue(CommonMethod.parseDateToString(tbCarInfo.getPurchaseDate(), "yyyy-MM-dd"));

        row = sheet.getRow(16);

        cell = row.getCell(41);

        if ("xtl".equals(companyName)) {

            cell.setCellValue(
                    tbFixEntrust.getEnterStationKilo() == null ? ""
                            : new BigDecimal(tbFixEntrust.getEnterStationKilo())
                                    .divide(new BigDecimal("1.00"), 0, BigDecimal.ROUND_HALF_UP).toString()
                                    + " Km");
        }

        else {

            cell.setCellValue(
                    tbFixEntrust.getEnterStationKilo() == null ? ""
                            : new BigDecimal(tbFixEntrust.getEnterStationKilo())
                                    .divide(new BigDecimal("1.00"), 0, BigDecimal.ROUND_HALF_UP).toString()
                                    + "   Km");

        }

        row = sheet.getRow(18);

        cell = row.getCell(4);

        cell.setCellValue(tbCustomer.getContractPerson() == null ? "" : tbCustomer.getContractPerson());

        row = sheet.getRow(18);

        cell = row.getCell(24);

        cell.setCellValue(tbCarInfo.getEngineCode() == null ? "" : tbCarInfo.getEngineCode());

        row = sheet.getRow(18);

        cell = row.getCell(41);

        cell.setCellValue(tbCarInfo.getColor() == null ? "" : tbCarInfo.getColor());

        /*
         * if (null != tbBusinessBalanceItemList &&
         * tbBusinessBalanceItemList.size() > 0) {
         * 
         * for (TbBusinessBalanceItem tbBusinessBalanceItem :
         * tbBusinessBalanceItemList) {
         * 
         * if ("XLCLF".equals(tbBusinessBalanceItem .getBalanceItemCode()))
         * {
         * 
         * row = sheet.getRow(77);
         * 
         * cell = row.getCell(24);
         * 
         * cell.setCellValue(new BigDecimal(tbBusinessBalanceItem
         * .getBalanceItemTotal()).divide( new BigDecimal("1.00"), 2,
         * BigDecimal.ROUND_HALF_UP).toString());
         * 
         * continue; }
         * 
         * if ("XLGSF".equals(tbBusinessBalanceItem .getBalanceItemCode()))
         * {
         * 
         * row = sheet.getRow(75);
         * 
         * cell = row.getCell(24);
         * 
         * cell.setCellValue(new BigDecimal(tbBusinessBalanceItem
         * .getBalanceItemTotal()).divide( new BigDecimal("1.00"), 2,
         * BigDecimal.ROUND_HALF_UP).toString());
         * 
         * continue; }
         * 
         * if ("ZJE" .equals(tbBusinessBalanceItem.getBalanceItemCode())) {
         * 
         * row = sheet.getRow(81);
         * 
         * cell = row.getCell(24);
         * 
         * cell.setCellValue(new BigDecimal(tbBusinessBalanceItem
         * .getBalanceItemTotal()).divide( new BigDecimal("1.00"), 2,
         * BigDecimal.ROUND_HALF_UP).toString());
         * 
         * continue; }
         * 
         * }
         * 
         * row = sheet.getRow(79);
         * 
         * cell = row.getCell(24);
         * 
         * cell.setCellValue("0.00");
         * 
         * }
         */
        BigDecimal d_f_w = new BigDecimal("0.00");

        BigDecimal d_f_p = new BigDecimal("0.00");

        BigDecimal d_f_i = new BigDecimal("0.00");

        BigDecimal d_f_c = new BigDecimal("0.00");

        if (fixSize > 0) {

            for (int i = 0; i < fixSize; i++) {

                TbFixEntrustContent t = tbFixEntrustContentListAdd.get(i);

                if ("W".equals(t.getZl())) {

                    d_f_w = d_f_w.add(new BigDecimal(t.getFixHourAll()));

                }

                else if ("P".equals(t.getZl())) {

                    d_f_p = d_f_p.add(new BigDecimal(t.getFixHourAll()));

                }

                else if ("I".equals(t.getZl())) {

                    d_f_i = d_f_i.add(new BigDecimal(t.getFixHourAll()));

                }

                else if ("C".equals(t.getZl())) {

                    d_f_c = d_f_c.add(new BigDecimal(t.getFixHourAll()));

                }
            }

        }

        BigDecimal d_p_w = new BigDecimal("0.00");

        BigDecimal d_p_p = new BigDecimal("0.00");

        BigDecimal d_p_i = new BigDecimal("0.00");

        BigDecimal d_p_c = new BigDecimal("0.00");

        if (partSize > 0) {

            for (int i = 0; i < partSize; i++) {

                TbMaintianVo t = maintianvosAdd.get(i);

                if ("W".equals(t.getZl())) {

                    d_p_w = d_p_w.add(new BigDecimal(t.getTotal()));

                }

                else if ("P".equals(t.getZl())) {

                    d_p_p = d_p_p.add(new BigDecimal(t.getTotal()));

                }

                else if ("I".equals(t.getZl())) {

                    d_p_i = d_p_i.add(new BigDecimal(t.getTotal()));

                }

                else if ("C".equals(t.getZl())) {

                    d_p_c = d_p_c.add(new BigDecimal(t.getTotal()));

                }

            }

        }

        row = sheet.getRow(75);

        cell = row.getCell(6);

        cell.setCellValue(d_f_w.divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

        row = sheet.getRow(77);

        cell = row.getCell(6);

        cell.setCellValue(d_p_w.divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

        row = sheet.getRow(79);

        cell = row.getCell(6);

        cell.setCellValue("0.00");

        row = sheet.getRow(81);

        cell = row.getCell(6);

        cell.setCellValue(
                d_f_w.add(d_p_w).divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

        row = sheet.getRow(75);

        cell = row.getCell(12);

        cell.setCellValue(d_f_p.divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

        row = sheet.getRow(77);

        cell = row.getCell(12);

        cell.setCellValue(d_p_p.divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

        row = sheet.getRow(79);

        cell = row.getCell(12);

        cell.setCellValue("0.00");

        row = sheet.getRow(81);

        cell = row.getCell(12);

        cell.setCellValue(
                d_f_p.add(d_p_p).divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

        row = sheet.getRow(75);

        cell = row.getCell(18);

        cell.setCellValue(d_f_i.divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

        row = sheet.getRow(77);

        cell = row.getCell(18);

        cell.setCellValue(d_p_i.divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

        row = sheet.getRow(79);

        cell = row.getCell(18);

        cell.setCellValue("0.00");

        row = sheet.getRow(81);

        cell = row.getCell(18);

        cell.setCellValue(
                d_f_i.add(d_p_i).divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

        row = sheet.getRow(75);

        cell = row.getCell(24);

        cell.setCellValue(d_f_c.divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

        row = sheet.getRow(77);

        cell = row.getCell(24);

        cell.setCellValue(d_p_c.divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

        row = sheet.getRow(79);

        cell = row.getCell(24);

        cell.setCellValue("0.00");

        row = sheet.getRow(81);

        cell = row.getCell(24);

        cell.setCellValue(
                d_f_c.add(d_p_c).divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

        Double wt = tbBusinessBalance.getWorkingHourTotalAll() == null ? 0d
                : tbBusinessBalance.getWorkingHourTotalAll();

        Double wf = tbBusinessBalance.getWorkingHourFavourRate() == null ? 0d
                : tbBusinessBalance.getWorkingHourFavourRate();

        Double pt = tbBusinessBalance.getFixPartTotalAll() == null ? 0d
                : tbBusinessBalance.getFixPartTotalAll();

        Double pf = tbBusinessBalance.getFixPartFavourRate() == null ? 0d
                : tbBusinessBalance.getFixPartFavourRate();

        Double st = tbBusinessBalance.getSolePartTotalAll() == null ? 0d
                : tbBusinessBalance.getSolePartTotalAll();

        Double sf = tbBusinessBalance.getSolePartFavourRate() == null ? 0d
                : tbBusinessBalance.getSolePartFavourRate();

        BigDecimal fixF = new BigDecimal(wt).divide(new BigDecimal(1 - wf), 2, BigDecimal.ROUND_HALF_UP)
                .multiply(new BigDecimal(wf));

        BigDecimal partF = new BigDecimal(pt).divide(new BigDecimal(1 - pf), 2, BigDecimal.ROUND_HALF_UP)
                .multiply(new BigDecimal(pf));

        BigDecimal soleF = new BigDecimal(st).divide(new BigDecimal(1 - sf), 2, BigDecimal.ROUND_HALF_UP)
                .multiply(new BigDecimal(sf));

        row = sheet.getRow(83);

        cell = row.getCell(4);

        // cell.setCellStyle(styleCenter);

        cell.setCellValue(fixF.add(partF).add(soleF).divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP)
                .toString());

        row = sheet.getRow(83);

        cell = row.getCell(14);

        // cell.setCellStyle(styleCenter);

        cell.setCellValue(new BigDecimal(tbBusinessBalance.getPayedAmount())
                .divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

        row = sheet.getRow(68);

        cell = row.getCell(40);

        // cell.setCellStyle(styleCenter);

        cell.setCellValue(CommonMethod
                .parseDateToString(tbBusinessBalance.getTbFixEntrust().getRemindMaintainDate(), "yyyy-MM-dd"));

        row = sheet.getRow(70);

        cell = row.getCell(40);

        // cell.setCellStyle(styleCenter);

        cell.setCellValue(tbBusinessBalance.getTbFixEntrust().getRemindMaintainKilo() == null ? ""
                : new BigDecimal(tbBusinessBalance.getTbFixEntrust().getRemindMaintainKilo())
                        .divide(new BigDecimal("1.00"), 0, BigDecimal.ROUND_HALF_UP) + "");

        row = sheet.getRow(77);

        cell = row.getCell(30);

        // cell.setCellStyle(styleCenter);

        cell.setCellValue(tbBusinessBalance.getTbFixEntrust().getRemark());

        ByteArrayOutputStream byteArrayOutImgLion = new ByteArrayOutputStream();

        String pic = "";

        if ("dfbz".equals(companyName)) {
            pic = "/lion_jsd.png";
        } else if ("xtl".equals(companyName)) {

            pic = "/xtl_jsd.png";
        }

        BufferedImage bufferImgLion = ImageIO.read(this.getClass().getResourceAsStream(pic));

        ImageIO.write(bufferImgLion, "png", byteArrayOutImgLion);

        HSSFPatriarch patriarch = sheet.createDrawingPatriarch();

        HSSFClientAnchor anchorLion = new HSSFClientAnchor(0, 0, 1023, 200, (short) 41, 0, (short) 46, 7);

        patriarch.createPicture(anchorLion,
                workbook.addPicture(byteArrayOutImgLion.toByteArray(), HSSFWorkbook.PICTURE_TYPE_PNG));

        /*
         * int maxSize = 19;
         * 
         * int maxFixSize = (fixSize > 19 ? 19 : fixSize);
         * 
         * int maxPartSize = maxSize - maxFixSize > partSize ? partSize :
         * maxSize - maxFixSize;
         * 
         * int partStartRow = (fixSize == 0 ? 21 : 21 + maxFixSize * 2 + 4);
         * 
         * int partStartRowClone = ((fixSize - maxFixSize) == 0 ? 21 : 21 +
         * (fixSize - maxFixSize) * 2 + 4);
         * 
         * int minBlank = 9;
         * 
         * if ((fixSize + partSize) > 17) {
         * 
         * HSSFSheet sheetClone = workbook.cloneSheet(0);
         * 
         * HSSFRow rowClone = sheetClone.getRow(87);
         * 
         * HSSFCell cellClone = rowClone.getCell(34);
         * 
         * cellClone.setCellValue("2  2  ");
         * 
         * HSSFPatriarch patriarchClone = sheetClone
         * .createDrawingPatriarch();
         * 
         * HSSFClientAnchor anchorLionClone = new HSSFClientAnchor(0, 0,
         * 1023, 200, (short) 41, 0, (short) 47, 8);
         * 
         * patriarchClone.createPicture(anchorLionClone, workbook
         * .addPicture(byteArrayOutImgLion.toByteArray(),
         * HSSFWorkbook.PICTURE_TYPE_PNG));
         * 
         * if ((fixSize - maxFixSize) > 0) {
         * 
         * 
         * sheetClone.addMergedRegion(new Region(21, (short) 0, 21, (short)
         * 49));
         * 
         * sheetClone.addMergedRegion(new Region(21, (short) 0, 21, (short)
         * 0));
         * 
         * 
         * sheetClone.addMergedRegion(new CellRangeAddress(21, 21, 0, 49));
         * 
         * rowClone = sheetClone.getRow(21);
         * 
         * cellClone = rowClone.getCell(0);
         * 
         * // cellClone.setCellStyle(style);
         * 
         * cellClone.setCellValue("");
         * 
         * cellClone.setCellStyle(styleBorderThickLeft);
         * 
         * rowClone = sheetClone.getRow(21);
         * 
         * cellClone = rowClone.getCell(0);
         * 
         * cellClone.setCellStyle(styleBorderThickLeft);
         * 
         * rowClone = sheetClone.getRow(24);
         * 
         * cellClone = rowClone.getCell(0);
         * 
         * cellClone.setCellStyle(styleBorderThickLeftCenter);
         * 
         * rowClone = sheetClone.getRow(23);
         * 
         * cellClone = rowClone.getCell(0);
         * 
         * // cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellStyle(styleBorderThickLeftCenter);
         * 
         * cellClone.setCellValue("??");
         * 
         * cellClone = rowClone.getCell(2);
         * 
         * cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue("?");
         * 
         * cellClone = rowClone.getCell(10);
         * 
         * cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue("");
         * 
         * cellClone = rowClone.getCell(21);
         * 
         * cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue("?");
         * 
         * cellClone = rowClone.getCell(24);
         * 
         * cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue("");
         * 
         * cellClone = rowClone.getCell(30);
         * 
         * cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue("");
         * 
         * cellClone = rowClone.getCell(34);
         * 
         * cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue("?");
         * 
         * cellClone = rowClone.getCell(40);
         * 
         * cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue("");
         * 
         * cellClone = rowClone.getCell(44);
         * 
         * cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue("");
         * 
         * for (int i = 0; i < (fixSize - maxFixSize); i++) {
         * 
         * TbFixEntrustContent tbFixEntrustContent =
         * tbFixEntrustContentListAdd .get(i + maxFixSize);
         * 
         * rowClone = sheetClone.getRow(25 + i * 2);
         * 
         * cellClone = rowClone.getCell(0);
         * 
         * // cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue(i + 1);
         * 
         * cellClone = rowClone.getCell(2);
         * 
         * // cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue(tbFixEntrustContent .getStationCode());
         * 
         * cellClone = rowClone.getCell(10);
         * 
         * // cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue(tbFixEntrustContent .getStationName());
         * 
         * cellClone = rowClone.getCell(21);
         * 
         * // cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue(tbFixEntrustContent.getZl());
         * 
         * cellClone = rowClone.getCell(24);
         * 
         * // cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue(tbFixEntrustContent .getProjectType());
         * 
         * cellClone = rowClone.getCell(30);
         * 
         * // cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue(new BigDecimal(
         * tbFixEntrustContent.getFixHour()).divide( new BigDecimal("1.00"),
         * 2, BigDecimal.ROUND_HALF_UP).toString());
         * 
         * cellClone = rowClone.getCell(34);
         * 
         * // cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue(new BigDecimal(
         * tbFixEntrustContent.getWorkingHourPrice()) .divide(new
         * BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());
         * 
         * cellClone = rowClone.getCell(40);
         * 
         * // cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue(new BigDecimal(tbBusinessBalance
         * .getWorkingHourFavourRate()).divide( new BigDecimal("1.00"), 2,
         * BigDecimal.ROUND_HALF_UP).toString());
         * 
         * cellClone = rowClone.getCell(44);
         * 
         * // cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue(new BigDecimal(
         * tbFixEntrustContent.getFixHourAll()).divide( new
         * BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString()); }
         * 
         * }
         * 
         * if ((partSize - maxPartSize) > 0) {
         * 
         * 
         * sheetClone.addMergedRegion(new Region(partStartRowClone, (short)
         * 0, partStartRowClone, (short) 49));
         * 
         * sheetClone.addMergedRegion(new Region(partStartRowClone, (short)
         * 0, partStartRowClone, (short) 49));
         * 
         * 
         * sheetClone.addMergedRegion(new CellRangeAddress(
         * partStartRowClone, partStartRowClone, 0, 49));
         * 
         * rowClone = sheetClone.getRow(partStartRowClone);
         * 
         * cellClone = rowClone.getCell(0);
         * 
         * // cellClone.setCellStyle(style);
         * 
         * cellClone.setCellStyle(styleBorderThickLeft);
         * 
         * cellClone.setCellValue("");
         * 
         * rowClone = sheetClone.getRow(partStartRowClone + 1);
         * 
         * cellClone = rowClone.getCell(0);
         * 
         * cellClone.setCellStyle(styleBorderThickLeft);
         * 
         * rowClone = sheetClone.getRow(partStartRowClone + 2 + 1);
         * 
         * cellClone = rowClone.getCell(0);
         * 
         * cellClone.setCellStyle(styleBorderThickLeftCenter);
         * 
         * rowClone = sheetClone.getRow(partStartRowClone + 2);
         * 
         * cellClone = rowClone.getCell(0);
         * 
         * // cellClone.setCellStyle(styleCenter);
         * cellClone.setCellStyle(styleBorderThickLeftCenter);
         * 
         * cellClone.setCellValue("??");
         * 
         * cellClone = rowClone.getCell(2);
         * 
         * cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue("?");
         * 
         * cellClone = rowClone.getCell(10);
         * 
         * cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue("??");
         * 
         * cellClone = rowClone.getCell(21);
         * 
         * cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue("?");
         * 
         * cellClone = rowClone.getCell(24);
         * 
         * cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue("");
         * 
         * cellClone = rowClone.getCell(30);
         * 
         * cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue("?");
         * 
         * cellClone = rowClone.getCell(34);
         * 
         * cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue("?");
         * 
         * cellClone = rowClone.getCell(40);
         * 
         * cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue("");
         * 
         * cellClone = rowClone.getCell(44);
         * 
         * cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue("");
         * 
         * for (int i = 0; i < (partSize - maxPartSize); i++) {
         * 
         * TbMaintianVo tbMaintianVo = maintianvosAdd.get(i + maxPartSize);
         * 
         * rowClone = sheetClone.getRow(partStartRowClone + 4 + i 2);
         * 
         * if(null == rowClone) break;
         * 
         * cellClone = rowClone.getCell(0);
         * 
         * // cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue(i + 1);
         * 
         * cellClone = rowClone.getCell(2);
         * 
         * // cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue(tbMaintianVo.getPartCode());
         * 
         * cellClone = rowClone.getCell(10);
         * 
         * // cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue(tbMaintianVo.getPartName());
         * 
         * cellClone = rowClone.getCell(21);
         * 
         * // cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue(tbMaintianVo.getZl());
         * 
         * cellClone = rowClone.getCell(24);
         * 
         * // cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue(tbMaintianVo.getProjectType());
         * 
         * cellClone = rowClone.getCell(30);
         * 
         * cellClone.setCellStyle(styleRight);
         * 
         * cellClone.setCellValue(new BigDecimal(tbMaintianVo
         * .getPartQuantity()).divide( new BigDecimal("1.00"), 2,
         * BigDecimal.ROUND_HALF_UP).toString());
         * 
         * cellClone = rowClone.getCell(34);
         * 
         * // cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue(new BigDecimal(tbMaintianVo
         * .getPrice()).divide(new BigDecimal("1.00"), 2,
         * BigDecimal.ROUND_HALF_UP).toString());
         * 
         * cellClone = rowClone.getCell(40);
         * 
         * // .setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue(new BigDecimal(tbBusinessBalance
         * .getFixPartFavourRate()).divide( new BigDecimal("1.00"), 2,
         * BigDecimal.ROUND_HALF_UP).toString());
         * 
         * cellClone = rowClone.getCell(44);
         * 
         * // cellClone.setCellStyle(styleCenter);
         * 
         * cellClone .setCellValue(new BigDecimal(tbMaintianVo
         * .getPartQuantity()) .multiply( new BigDecimal(tbMaintianVo
         * .getPrice())) .divide(new BigDecimal("1.00"), 2,
         * BigDecimal.ROUND_HALF_UP) .toString()); }
         * 
         * }
         * 
         * int attachStartRowClone = 21;
         * 
         * if ((fixSize - maxFixSize + partSize - maxPartSize) <= 17) {
         * 
         * if ((fixSize - maxFixSize) != 0 && (partSize - maxPartSize) == 0
         * && (fixSize - maxFixSize) < 18) {
         * 
         * attachStartRowClone = 21 + 2 + 2 + (fixSize - maxFixSize) * 2;
         * 
         * }
         * 
         * if ((partSize - maxPartSize) != 0 && (fixSize - maxFixSize) == 0
         * && (partSize - maxPartSize) < 18) {
         * 
         * attachStartRowClone = 21 + 2 + 2 + 2 + (partSize - maxPartSize) *
         * 2; }
         * 
         * if ((fixSize - maxFixSize) != 0 && (partSize - maxPartSize) != 0
         * && (fixSize - maxFixSize + partSize - maxPartSize < 18)) {
         * 
         * attachStartRowClone = 21 + 2 + 2 + 2 + 2 + (fixSize - maxFixSize)
         * * 2 + (partSize - maxPartSize) * 2;
         * 
         * }
         * 
         * 
         * sheetClone.addMergedRegion(new Region(attachStartRowClone,
         * (short) 0, attachStartRowClone, (short) 49));
         * 
         * sheetClone.addMergedRegion(new Region(attachStartRowClone,
         * (short) 0, attachStartRowClone, (short) 49));
         * 
         * 
         * sheetClone.addMergedRegion(new CellRangeAddress(
         * attachStartRowClone, attachStartRowClone, 0, 49));
         * 
         * rowClone = sheetClone.getRow(attachStartRowClone);
         * 
         * cellClone = rowClone.getCell(0);
         * 
         * // cellClone.setCellStyle(style);
         * 
         * cellClone.setCellStyle(styleBorderThickLeft);
         * 
         * cellClone.setCellValue("");
         * 
         * rowClone = sheetClone.getRow(attachStartRowClone + 1);
         * 
         * cellClone = rowClone.getCell(0);
         * 
         * cellClone.setCellStyle(styleBorderThickLeft);
         * 
         * rowClone = sheetClone.getRow(attachStartRowClone + 2 + 1);
         * 
         * cellClone = rowClone.getCell(0);
         * 
         * cellClone.setCellStyle(styleBorderThickLeftCenter);
         * 
         * rowClone = sheetClone.getRow(attachStartRowClone + 2);
         * 
         * cellClone = rowClone.getCell(0);
         * 
         * cellClone.setCellStyle(styleBorderThickLeftCenter);
         * 
         * cellClone.setCellValue("??");
         * 
         * if ("dfbz".equals(companyName)) {
         * 
         * cellClone = rowClone.getCell(10);
         * 
         * cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue("??");
         * 
         * cellClone = rowClone.getCell(21);
         * 
         * cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue("?");
         * 
         * cellClone = rowClone.getCell(24);
         * 
         * cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue("");
         * 
         * cellClone = rowClone.getCell(30);
         * 
         * cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue("?");
         * 
         * cellClone = rowClone.getCell(34);
         * 
         * cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue("?");
         * 
         * cellClone = rowClone.getCell(40);
         * 
         * cellClone.setCellStyle(styleCenter);
         * 
         * } else if ("xtl".equals(companyName)) {
         * 
         * 
         * sheetClone.addMergedRegion(new Region(attachStartRowClone + 2,
         * (short) 2, attachStartRowClone + 2, (short) 39));
         * 
         * sheetClone.addMergedRegion(new Region(attachStartRowClone + 2,
         * (short) 2, attachStartRowClone + 2, (short) 39));
         * 
         * 
         * sheetClone.addMergedRegion(new CellRangeAddress(
         * attachStartRowClone + 2, attachStartRowClone + 2, 2, 39));
         * 
         * cellClone = rowClone.getCell(2);
         * 
         * cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue("");
         * 
         * }
         * 
         * cellClone = rowClone.getCell(40);
         * 
         * cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue("");
         * 
         * cellClone = rowClone.getCell(44);
         * 
         * cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellValue("");
         * 
         * rowClone = sheetClone.getRow(attachStartRowClone + 4);
         * 
         * cellClone = rowClone.getCell(0);
         * 
         * // cellClone.setCellStyle(styleCenter);
         * 
         * cellClone.setCellStyle(styleBorderThickLeftCenter);
         * 
         * cellClone.setCellValue("1");
         * 
         * rowClone = sheetClone.getRow(attachStartRowClone + 4 + 1);
         * 
         * cellClone = rowClone.getCell(0);
         * 
         * cellClone.setCellStyle(styleBorderThickLeftCenter);
         * 
         * 
         * sheetClone.addMergedRegion(new Region(attachStartRowClone + 6,
         * (short) 0, 66, (short) 49));
         * 
         * sheetClone.addMergedRegion(new Region(attachStartRowClone + 6,
         * (short) 0, 66, (short) 49));
         * 
         * 
         * sheetClone.addMergedRegion(new CellRangeAddress(
         * attachStartRowClone + 6, 66, 0, 49));
         * 
         * }
         * 
         * } else {
         * 
         * row = sheet.getRow(87);
         * 
         * cell = row.getCell(34);
         * 
         * cell.setCellValue(" 1   1  ");
         * 
         * }
         * 
         * if (fixSize > 0) {
         * 
         * 
         * sheet.addMergedRegion(new Region(21, (short) 0, 21, (short) 49));
         * 
         * sheet.addMergedRegion(new Region(21, (short) 0, 21, (short) 49));
         * 
         * 
         * sheet.addMergedRegion(new CellRangeAddress(21, 21, 0, 49));
         * 
         * row = sheet.getRow(21);
         * 
         * cell = row.getCell(0);
         * 
         * // cell.setCellStyle(style);
         * 
         * cell.setCellValue("");
         * 
         * cell.setCellStyle(styleBorderThickLeft);
         * 
         * row = sheet.getRow(22);
         * 
         * cell = row.getCell(0);
         * 
         * cell.setCellStyle(styleBorderThickLeft);
         * 
         * row = sheet.getRow(24);
         * 
         * cell = row.getCell(0);
         * 
         * cell.setCellStyle(styleBorderThickLeft);
         * 
         * row = sheet.getRow(23);
         * 
         * cell = row.getCell(0);
         * 
         * // cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue("??");
         * 
         * cell.setCellStyle(styleBorderThickLeftCenter);
         * 
         * cell = row.getCell(2);
         * 
         * cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue("?");
         * 
         * cell = row.getCell(10);
         * 
         * cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue("");
         * 
         * cell = row.getCell(21);
         * 
         * cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue("?");
         * 
         * cell = row.getCell(24);
         * 
         * cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue("");
         * 
         * cell = row.getCell(30);
         * 
         * cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue("");
         * 
         * cell = row.getCell(34);
         * 
         * cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue("?");
         * 
         * cell = row.getCell(40);
         * 
         * cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue("");
         * 
         * cell = row.getCell(44);
         * 
         * cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue("");
         * 
         * for (int i = 0; i < maxFixSize; i++) {
         * 
         * TbFixEntrustContent tbFixEntrustContent =
         * tbFixEntrustContentListAdd .get(i);
         * 
         * row = sheet.getRow(25 + i * 2);
         * 
         * cell = row.getCell(0);
         * 
         * // cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue(i + 1);
         * 
         * cell = row.getCell(2);
         * 
         * // cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue(tbFixEntrustContent.getStationCode());
         * 
         * cell = row.getCell(10);
         * 
         * // cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue(tbFixEntrustContent.getStationName());
         * 
         * cell = row.getCell(21);
         * 
         * // cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue(tbFixEntrustContent.getZl());
         * 
         * cell = row.getCell(24);
         * 
         * // cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue(tbFixEntrustContent.getProjectType());
         * 
         * cell = row.getCell(30);
         * 
         * // cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue(new BigDecimal(tbFixEntrustContent
         * .getFixHour()).divide(new BigDecimal("1.00"), 2,
         * BigDecimal.ROUND_HALF_UP).toString());
         * 
         * cell = row.getCell(34);
         * 
         * // cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue(new BigDecimal(tbFixEntrustContent
         * .getWorkingHourPrice()) .divide(new BigDecimal("1.00"), 2,
         * BigDecimal.ROUND_HALF_UP).toString());
         * 
         * cell = row.getCell(40);
         * 
         * // cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue(new BigDecimal((1 - tbBusinessBalance
         * .getWorkingHourFavourRate()) * 100) .divide(new
         * BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());
         * 
         * cell = row.getCell(44);
         * 
         * // cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue(new BigDecimal(tbFixEntrustContent
         * .getFixHourAll()).divide(new BigDecimal("1.00"), 2,
         * BigDecimal.ROUND_HALF_UP).toString()); }
         * 
         * }
         * 
         * if ((fixSize <= maxSize - 1) && partSize > 0) {
         * 
         * 
         * sheet.addMergedRegion(new Region(partStartRow, (short) 0,
         * partStartRow, (short) 49));
         * 
         * sheet.addMergedRegion(new Region(partStartRow, (short) 0,
         * partStartRow, (short) 49));
         * 
         * 
         * sheet.addMergedRegion(new CellRangeAddress(partStartRow,
         * partStartRow, 0, 49));
         * 
         * row = sheet.getRow(partStartRow);
         * 
         * cell = row.getCell(0);
         * 
         * // cell.setCellStyle(style);
         * 
         * cell.setCellValue("");
         * 
         * cell.setCellStyle(styleBorderThickLeft);
         * 
         * row = sheet.getRow(partStartRow + 1);
         * 
         * cell = row.getCell(0);
         * 
         * cell.setCellStyle(styleBorderThickLeft);
         * 
         * row = sheet.getRow(partStartRow + 2 + 1);
         * 
         * cell = row.getCell(0);
         * 
         * cell.setCellStyle(styleBorderThickLeftCenter);
         * 
         * row = sheet.getRow(partStartRow + 2);
         * 
         * cell = row.getCell(0);
         * 
         * cell.setCellStyle(styleBorderThickLeftCenter);
         * 
         * cell.setCellValue("??");
         * 
         * cell = row.getCell(2);
         * 
         * cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue("?");
         * 
         * cell = row.getCell(10);
         * 
         * cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue("??");
         * 
         * cell = row.getCell(21);
         * 
         * cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue("?");
         * 
         * cell = row.getCell(24);
         * 
         * cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue("");
         * 
         * cell = row.getCell(30);
         * 
         * cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue("?");
         * 
         * cell = row.getCell(34);
         * 
         * cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue("?");
         * 
         * cell = row.getCell(40);
         * 
         * cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue("");
         * 
         * cell = row.getCell(44);
         * 
         * cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue("");
         * 
         * if (partSize > 0) {
         * 
         * for (int i = 0; i < maxPartSize; i++) {
         * 
         * TbMaintianVo tbMaintianVo = maintianvosAdd.get(i);
         * 
         * row = sheet.getRow(partStartRow + 4 + i * 2);
         * 
         * cell = row.getCell(0);
         * 
         * // cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue(i + 1);
         * 
         * cell = row.getCell(2);
         * 
         * // cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue(tbMaintianVo.getPartCode());
         * 
         * cell = row.getCell(10);
         * 
         * // cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue(tbMaintianVo.getPartName());
         * 
         * cell = row.getCell(21);
         * 
         * // cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue(tbMaintianVo.getZl());
         * 
         * cell = row.getCell(24);
         * 
         * // cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue(tbMaintianVo.getProjectType());
         * 
         * cell = row.getCell(30);
         * 
         * cell.setCellStyle(styleRight);
         * 
         * cell.setCellValue(new BigDecimal(tbMaintianVo
         * .getPartQuantity()).divide( new BigDecimal("1.00"), 2,
         * BigDecimal.ROUND_HALF_UP).toString());
         * 
         * cell = row.getCell(34);
         * 
         * // cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue(new BigDecimal(tbMaintianVo
         * .getPrice()).divide(new BigDecimal("1.00"), 2,
         * BigDecimal.ROUND_HALF_UP).toString());
         * 
         * cell = row.getCell(40);
         * 
         * // cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue(new BigDecimal((1 - tbBusinessBalance
         * .getFixPartFavourRate()) * 100).divide( new BigDecimal("1.00"),
         * 2, BigDecimal.ROUND_HALF_UP).toString());
         * 
         * cell = row.getCell(44);
         * 
         * // cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue(new BigDecimal(tbMaintianVo .getPartQuantity())
         * .multiply( new BigDecimal(tbMaintianVo.getPrice())) .divide(new
         * BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString()); }
         * 
         * }
         * 
         * }
         * 
         * int attachStartRow = 21;
         * 
         * if ((fixSize + partSize) <= 17) {
         * 
         * if (fixSize != 0 && partSize == 0 && fixSize < 18) {
         * 
         * attachStartRow = 19 + 2 + 2 + 2 + fixSize * 2;
         * 
         * }
         * 
         * if (partSize != 0 && fixSize == 0 && partSize < 18) {
         * 
         * attachStartRow = 19 + 2 + 2 + 2 + partSize * 2; }
         * 
         * if (fixSize != 0 && partSize != 0 && (fixSize + partSize < 18)) {
         * 
         * attachStartRow = 19 + 2 + 2 + 2 + 2 + 2 + fixSize * 2 + partSize
         * * 2;
         * 
         * }
         * 
         * 
         * sheet.addMergedRegion(new Region(attachStartRow, (short) 0,
         * attachStartRow, (short) 49));
         * 
         * sheet.addMergedRegion(new Region(attachStartRow, (short) 0,
         * attachStartRow, (short) 49));
         * 
         * 
         * sheet.addMergedRegion(new CellRangeAddress(attachStartRow,
         * attachStartRow, 0, 49));
         * 
         * row = sheet.getRow(attachStartRow);
         * 
         * cell = row.getCell(0);
         * 
         * // cell.setCellStyle(style);
         * 
         * cell.setCellStyle(styleBorderThickLeft);
         * 
         * cell.setCellValue("");
         * 
         * row = sheet.getRow(attachStartRow + 1);
         * 
         * cell = row.getCell(0);
         * 
         * cell.setCellStyle(styleBorderThickLeft);
         * 
         * row = sheet.getRow(attachStartRow + 2 + 1);
         * 
         * cell = row.getCell(0);
         * 
         * cell.setCellStyle(styleBorderThickLeftCenter);
         * 
         * row = sheet.getRow(attachStartRow + 2);
         * 
         * cell = row.getCell(0);
         * 
         * // cell.setCellStyle(styleCenter);
         * cell.setCellStyle(styleBorderThickLeftCenter);
         * 
         * cell.setCellValue("??");
         * 
         * if ("dfbz".equals(companyName)) {
         * 
         * cell = row.getCell(10);
         * 
         * cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue("??");
         * 
         * cell = row.getCell(21);
         * 
         * cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue("?");
         * 
         * cell = row.getCell(24);
         * 
         * cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue("");
         * 
         * cell = row.getCell(30);
         * 
         * cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue("?");
         * 
         * cell = row.getCell(34);
         * 
         * cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue("?");
         * 
         * cell = row.getCell(40);
         * 
         * cell.setCellStyle(styleCenter);
         * 
         * } else if ("xtl".equals(companyName)) {
         * 
         * 
         * sheet.addMergedRegion(new Region(attachStartRow + 2, (short) 2,
         * attachStartRow + 2, (short) 39));
         * 
         * sheet.addMergedRegion(new Region(attachStartRow + 2, (short) 2,
         * attachStartRow + 2, (short) 39));
         * 
         * 
         * sheet.addMergedRegion(new CellRangeAddress( attachStartRow + 2,
         * attachStartRow + 2, 2, 39));
         * 
         * cell = row.getCell(2);
         * 
         * cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue("");
         * 
         * }
         * 
         * 
         * sheet.addMergedRegion(new Region(attachStartRow + 2, (short) 2,
         * attachStartRow + 2, (short) 39));
         * 
         * sheet.addMergedRegion(new Region(attachStartRow + 2, (short) 2,
         * attachStartRow + 2, (short) 39));
         * 
         * cell = row.getCell(2);
         * 
         * cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue("");
         * 
         * 
         * cell = row.getCell(40);
         * 
         * cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue("");
         * 
         * cell = row.getCell(44);
         * 
         * cell.setCellStyle(styleCenter);
         * 
         * cell.setCellValue("");
         * 
         * row = sheet.getRow(attachStartRow + 4);
         * 
         * cell = row.getCell(0);
         * 
         * // cell.setCellStyle(styleCenter);
         * cell.setCellStyle(styleBorderThickLeftCenter);
         * 
         * cell.setCellValue("1");
         * 
         * row = sheet.getRow(attachStartRow + 4 + 1);
         * 
         * cell = row.getCell(0);
         * 
         * cell.setCellStyle(styleBorderThickLeftCenter);
         * 
         * if ("xtl".equals(companyName)) {
         * 
         * 
         * sheet.addMergedRegion(new Region(attachStartRow + 6, (short) 0,
         * 66, (short) 49));
         * 
         * sheet.addMergedRegion(new Region(attachStartRow + 6, (short) 0,
         * 66, (short) 49));
         * 
         * if (attachStartRow + 6 < 66) {
         * 
         * sheet.addMergedRegion(new CellRangeAddress( attachStartRow + 6,
         * 66, 0, 49)); }
         * 
         * } }
         */

        int pageSize = 0;

        if ((fixSize > 0 && partSize == 0) || (partSize > 0 && fixSize == 0)) {

            if ((fixSize + partSize) <= 18) {

                pageSize = 1;

            }

            else {

                pageSize = (fixSize + partSize - 19) / 21 + 2;

            }

            for (int p = pageSize - 1; p >= 0; p--) {

                int maxSize = (p == pageSize - 1) ? (fixSize + partSize - p * 21) : 21;

                int startRow = 21;

                if (p == 0) {

                    sheet = workbook.getSheetAt(0);

                    for (int k = 1; k <= pageSize / 2; k++) {

                        workbook.setSheetOrder(workbook.getSheetName(k), pageSize - k);

                    }

                    for (int k = 1; k < pageSize; k++) {

                        workbook.setSheetName(k, "" + (k + 1) + "");

                    }

                    workbook.setSheetName(0, "" + 1 + "");

                } else {
                    sheet = workbook.cloneSheet(0);

                    //this.clearSheet(sheet, 21, 0, 66, 49);
                }

                if (fixSize > 0) {

                    sheet.addMergedRegion(new CellRangeAddress(21, 21, 0, 49));

                    row = sheet.getRow(21);

                    cell = row.getCell(0);

                    cell.setCellValue("");

                    cell.setCellStyle(styleBorderThickLeft);

                    row = sheet.getRow(22);

                    cell = row.getCell(0);

                    cell.setCellStyle(styleBorderThickLeft);

                    row = sheet.getRow(24);

                    cell = row.getCell(0);

                    cell.setCellStyle(styleBorderThickLeft);

                    row = sheet.getRow(23);

                    cell = row.getCell(0);

                    cell.setCellValue("??");

                    cell.setCellStyle(styleBorderThickLeftCenter);

                    cell = row.getCell(2);

                    cell.setCellStyle(styleCenter);

                    cell.setCellValue("?");

                    cell = row.getCell(10);

                    cell.setCellStyle(styleCenter);

                    cell.setCellValue("");

                    cell = row.getCell(21);

                    cell.setCellStyle(styleCenter);

                    cell.setCellValue("?");

                    cell = row.getCell(24);

                    cell.setCellStyle(styleCenter);

                    cell.setCellValue("");

                    cell = row.getCell(30);

                    cell.setCellStyle(styleCenter);

                    cell.setCellValue("");

                    cell = row.getCell(34);

                    cell.setCellStyle(styleCenter);

                    cell.setCellValue("?");

                    cell = row.getCell(40);

                    cell.setCellStyle(styleCenter);

                    cell.setCellValue("");

                    cell = row.getCell(44);

                    cell.setCellStyle(styleCenter);

                    cell.setCellValue("");

                    for (int i = 0; i < maxSize; i++) {

                        TbFixEntrustContent tbFixEntrustContent = tbFixEntrustContentListAdd.get(p * 21 + i);

                        row = sheet.getRow(25 + i * 2);

                        cell = row.getCell(0);

                        // cell.setCellStyle(styleCenter);

                        cell.setCellValue(p * 21 + i + 1);

                        cell = row.getCell(2);

                        // cell.setCellStyle(styleCenter);

                        cell.setCellValue(tbFixEntrustContent.getStationCode());

                        cell = row.getCell(10);

                        // cell.setCellStyle(styleCenter);

                        cell.setCellValue(tbFixEntrustContent.getStationName());

                        cell = row.getCell(21);

                        // cell.setCellStyle(styleCenter);

                        cell.setCellValue(tbFixEntrustContent.getZl());

                        cell = row.getCell(24);

                        // cell.setCellStyle(styleCenter);

                        cell.setCellValue(tbFixEntrustContent.getProjectType());

                        cell = row.getCell(30);

                        // cell.setCellStyle(styleCenter);

                        cell.setCellValue(new BigDecimal(tbFixEntrustContent.getFixHour())
                                .divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

                        cell = row.getCell(34);

                        // cell.setCellStyle(styleCenter);

                        cell.setCellValue(new BigDecimal(tbFixEntrustContent.getWorkingHourPrice())
                                .divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

                        cell = row.getCell(40);

                        // cell.setCellStyle(styleCenter);

                        cell.setCellValue(
                                new BigDecimal((1 - tbBusinessBalance.getWorkingHourFavourRate()) * 100)
                                        .divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP)
                                        .toString());

                        cell = row.getCell(44);

                        // cell.setCellStyle(styleCenter);

                        cell.setCellValue(new BigDecimal(tbFixEntrustContent.getFixHourAll())
                                .divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());
                    }

                }

                else if (partSize > 0) {

                    sheet.addMergedRegion(new CellRangeAddress(startRow, startRow, 0, 49));

                    row = sheet.getRow(startRow);

                    cell = row.getCell(0);

                    // cell.setCellStyle(style);

                    cell.setCellValue("");

                    cell.setCellStyle(styleBorderThickLeft);

                    row = sheet.getRow(startRow + 1);

                    cell = row.getCell(0);

                    cell.setCellStyle(styleBorderThickLeft);

                    row = sheet.getRow(startRow + 2 + 1);

                    cell = row.getCell(0);

                    cell.setCellStyle(styleBorderThickLeftCenter);

                    row = sheet.getRow(startRow + 2);

                    cell = row.getCell(0);

                    cell.setCellStyle(styleBorderThickLeftCenter);

                    cell.setCellValue("??");

                    cell = row.getCell(2);

                    cell.setCellStyle(styleCenter);

                    cell.setCellValue("?");

                    cell = row.getCell(10);

                    cell.setCellStyle(styleCenter);

                    cell.setCellValue("??");

                    cell = row.getCell(21);

                    cell.setCellStyle(styleCenter);

                    cell.setCellValue("?");

                    cell = row.getCell(24);

                    cell.setCellStyle(styleCenter);

                    cell.setCellValue("");

                    cell = row.getCell(30);

                    cell.setCellStyle(styleCenter);

                    cell.setCellValue("?");

                    cell = row.getCell(34);

                    cell.setCellStyle(styleCenter);

                    cell.setCellValue("?");

                    cell = row.getCell(40);

                    cell.setCellStyle(styleCenter);

                    cell.setCellValue("");

                    cell = row.getCell(44);

                    cell.setCellStyle(styleCenter);

                    cell.setCellValue("");

                    for (int i = 0; i < maxSize; i++) {

                        TbMaintianVo tbMaintianVo = maintianvosAdd.get(p * 21 + i);

                        row = sheet.getRow(startRow + 4 + i * 2);

                        cell = row.getCell(0);

                        // cell.setCellStyle(styleCenter);

                        cell.setCellValue(p * 21 + i + 1);

                        cell = row.getCell(2);

                        // cell.setCellStyle(styleCenter);

                        cell.setCellValue(tbMaintianVo.getPartCode());

                        cell = row.getCell(10);

                        // cell.setCellStyle(styleCenter);

                        cell.setCellValue(tbMaintianVo.getPartName());

                        cell = row.getCell(21);

                        // cell.setCellStyle(styleCenter);

                        cell.setCellValue(tbMaintianVo.getZl());

                        cell = row.getCell(24);

                        // cell.setCellStyle(styleCenter);

                        cell.setCellValue(tbMaintianVo.getProjectType());

                        cell = row.getCell(30);

                        cell.setCellStyle(styleRight);

                        cell.setCellValue(new BigDecimal(tbMaintianVo.getPartQuantity())
                                .divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

                        cell = row.getCell(34);

                        // cell.setCellStyle(styleCenter);

                        cell.setCellValue(new BigDecimal(tbMaintianVo.getPrice())
                                .divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

                        cell = row.getCell(40);

                        // cell.setCellStyle(styleCenter);

                        cell.setCellValue(new BigDecimal((1 - tbBusinessBalance.getFixPartFavourRate()) * 100)
                                .divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

                        cell = row.getCell(44);

                        // cell.setCellStyle(styleCenter);

                        cell.setCellValue(new BigDecimal(tbMaintianVo.getPartQuantity())
                                .multiply(new BigDecimal(tbMaintianVo.getPrice()))
                                .divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());
                    }

                }

                row = sheet.getRow(87);

                cell = row.getCell(34);

                cell.setCellValue(" " + (p + 1) + "    " + pageSize + "  ");

                if (p == pageSize - 1) {

                    int attachStartRow = 21 + 2 + 2 + (fixSize + partSize - (pageSize - 1) * 21) * 2;

                    sheet.addMergedRegion(new CellRangeAddress(attachStartRow, attachStartRow, 0, 49));

                    row = sheet.getRow(attachStartRow);

                    cell = row.getCell(0);

                    cell.setCellStyle(styleBorderThickLeft);

                    cell.setCellValue("");

                    row = sheet.getRow(attachStartRow + 1);

                    cell = row.getCell(0);

                    cell.setCellStyle(styleBorderThickLeft);

                    row = sheet.getRow(attachStartRow + 2 + 1);

                    cell = row.getCell(0);

                    cell.setCellStyle(styleBorderThickLeftCenter);

                    row = sheet.getRow(attachStartRow + 2);

                    cell = row.getCell(0);

                    // cell.setCellStyle(styleCenter);
                    cell.setCellStyle(styleBorderThickLeftCenter);

                    cell.setCellValue("??");

                    if ("dfbz".equals(companyName)) {

                        cell = row.getCell(10);

                        cell.setCellStyle(styleCenter);

                        cell.setCellValue("??");

                        cell = row.getCell(21);

                        cell.setCellStyle(styleCenter);

                        cell.setCellValue("?");

                        cell = row.getCell(24);

                        cell.setCellStyle(styleCenter);

                        cell.setCellValue("");

                        cell = row.getCell(30);

                        cell.setCellStyle(styleCenter);

                        cell.setCellValue("?");

                        cell = row.getCell(34);

                        cell.setCellStyle(styleCenter);

                        cell.setCellValue("?");

                        cell = row.getCell(40);

                        cell.setCellStyle(styleCenter);

                    } else if ("xtl".equals(companyName)) {

                        cell = row.getCell(2);

                        cell.setCellStyle(styleCenter);

                        cell.setCellValue("");

                    }

                    cell = row.getCell(40);

                    cell.setCellStyle(styleCenter);

                    cell.setCellValue("");

                    cell = row.getCell(44);

                    cell.setCellStyle(styleCenter);

                    cell.setCellValue("");

                    row = sheet.getRow(attachStartRow + 4);

                    cell = row.getCell(0);

                    // cell.setCellStyle(styleCenter);
                    cell.setCellStyle(styleBorderThickLeftCenter);

                    cell.setCellValue("1");

                    row = sheet.getRow(attachStartRow + 4 + 1);

                    cell = row.getCell(0);

                    cell.setCellStyle(styleBorderThickLeftCenter);

                    if ("xtl".equals(companyName)) {

                        if (attachStartRow + 6 < 66) {

                            sheet.addMergedRegion(new CellRangeAddress(attachStartRow + 6, 66, 0, 49));
                        }

                    }

                }

            }

        }

        if (fixSize > 0 && partSize > 0) {

            if ((fixSize + partSize) <= 16) {

                pageSize = 1;

            }

            else {

                pageSize = (fixSize + partSize - 17) / 19 + 2;

            }

            int fixPageSize = fixSize / pageSize;

            int partPageSize = partSize / pageSize;

            int fixLastPageSize = fixSize - (pageSize - 1) * fixPageSize;

            int partLastPageSize = partSize - (pageSize - 1) * partPageSize;

            if ((fixPageSize + partPageSize) < 19 && fixPageSize != 0) {

                //if(fixLastPageSize >= partSize){
                if (fixPageSize >= partPageSize) {

                    fixPageSize = (19 - partPageSize) > fixSize ? fixSize : (19 - partPageSize);

                }

                else {

                    partPageSize = (19 - fixPageSize) > partSize ? partSize : (19 - fixPageSize);

                }

            }

            fixLastPageSize = fixSize - (pageSize - 1) * fixPageSize;

            partLastPageSize = (partSize - (pageSize - 1) * partPageSize) < 0 ? 0
                    : (partSize - (pageSize - 1) * partPageSize);

            for (int p = pageSize - 1; p >= 0; p--) {

                int partStartRow = 21 + 2 + 2 + ((p == pageSize - 1) ? fixLastPageSize : fixPageSize) * 2;

                if (p == 0) {

                    sheet = workbook.getSheetAt(0);

                    if (pageSize > 1) {

                        for (int k = 1; k <= pageSize / 2; k++) {

                            workbook.setSheetOrder(workbook.getSheetName(k), pageSize - k);

                        }

                        for (int k = 1; k < pageSize; k++) {

                            workbook.setSheetName(k, "" + (k + 1) + "");

                        }
                    }

                    workbook.setSheetName(0, "" + 1 + "");

                } else {

                    sheet = workbook.cloneSheet(0);

                }

                if (fixSize > 0) {

                    sheet.addMergedRegion(new CellRangeAddress(21, 21, 0, 49));

                    row = sheet.getRow(21);

                    cell = row.getCell(0);

                    cell.setCellValue("");

                    cell.setCellStyle(styleBorderThickLeft);

                    row = sheet.getRow(22);

                    cell = row.getCell(0);

                    cell.setCellStyle(styleBorderThickLeft);

                    row = sheet.getRow(24);

                    cell = row.getCell(0);

                    cell.setCellStyle(styleBorderThickLeft);

                    row = sheet.getRow(23);

                    cell = row.getCell(0);

                    cell.setCellValue("??");

                    cell.setCellStyle(styleBorderThickLeftCenter);

                    cell = row.getCell(2);

                    cell.setCellStyle(styleCenter);

                    cell.setCellValue("?");

                    cell = row.getCell(10);

                    cell.setCellStyle(styleCenter);

                    cell.setCellValue("");

                    cell = row.getCell(21);

                    cell.setCellStyle(styleCenter);

                    cell.setCellValue("?");

                    cell = row.getCell(24);

                    cell.setCellStyle(styleCenter);

                    cell.setCellValue("");

                    cell = row.getCell(30);

                    cell.setCellStyle(styleCenter);

                    cell.setCellValue("");

                    cell = row.getCell(34);

                    cell.setCellStyle(styleCenter);

                    cell.setCellValue("?");

                    cell = row.getCell(40);

                    cell.setCellStyle(styleCenter);

                    cell.setCellValue("");

                    cell = row.getCell(44);

                    cell.setCellStyle(styleCenter);

                    cell.setCellValue("");

                    for (int i = 0; i < ((p == pageSize - 1) ? fixLastPageSize : fixPageSize); i++) {

                        TbFixEntrustContent tbFixEntrustContent = tbFixEntrustContentListAdd
                                .get(p * fixPageSize + i);

                        row = sheet.getRow(25 + i * 2);

                        cell = row.getCell(0);

                        // cell.setCellStyle(styleCenter);

                        cell.setCellValue(p * fixPageSize + i + 1);

                        cell = row.getCell(2);

                        // cell.setCellStyle(styleCenter);

                        cell.setCellValue(tbFixEntrustContent.getStationCode());

                        cell = row.getCell(10);

                        // cell.setCellStyle(styleCenter);

                        cell.setCellValue(tbFixEntrustContent.getStationName());

                        cell = row.getCell(21);

                        // cell.setCellStyle(styleCenter);

                        cell.setCellValue(tbFixEntrustContent.getZl());

                        cell = row.getCell(24);

                        // cell.setCellStyle(styleCenter);

                        cell.setCellValue(tbFixEntrustContent.getProjectType());

                        cell = row.getCell(30);

                        // cell.setCellStyle(styleCenter);

                        cell.setCellValue(new BigDecimal(tbFixEntrustContent.getFixHour())
                                .divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

                        cell = row.getCell(34);

                        // cell.setCellStyle(styleCenter);

                        cell.setCellValue(new BigDecimal(tbFixEntrustContent.getWorkingHourPrice())
                                .divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

                        cell = row.getCell(40);

                        // cell.setCellStyle(styleCenter);

                        cell.setCellValue(
                                new BigDecimal((1 - tbBusinessBalance.getWorkingHourFavourRate()) * 100)
                                        .divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP)
                                        .toString());

                        cell = row.getCell(44);

                        // cell.setCellStyle(styleCenter);

                        cell.setCellValue(new BigDecimal(tbFixEntrustContent.getFixHourAll())
                                .divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());
                    }

                }

                if (partSize > 0) {

                    sheet.addMergedRegion(new CellRangeAddress(partStartRow, partStartRow, 0, 49));

                    row = sheet.getRow(partStartRow);

                    cell = row.getCell(0);

                    // cell.setCellStyle(style);

                    cell.setCellValue("");

                    cell.setCellStyle(styleBorderThickLeft);

                    row = sheet.getRow(partStartRow + 1);

                    cell = row.getCell(0);

                    cell.setCellStyle(styleBorderThickLeft);

                    row = sheet.getRow(partStartRow + 2 + 1);

                    cell = row.getCell(0);

                    cell.setCellStyle(styleBorderThickLeftCenter);

                    row = sheet.getRow(partStartRow + 2);

                    cell = row.getCell(0);

                    cell.setCellStyle(styleBorderThickLeftCenter);

                    cell.setCellValue("??");

                    cell = row.getCell(2);

                    cell.setCellStyle(styleCenter);

                    cell.setCellValue("?");

                    cell = row.getCell(10);

                    cell.setCellStyle(styleCenter);

                    cell.setCellValue("??");

                    cell = row.getCell(21);

                    cell.setCellStyle(styleCenter);

                    cell.setCellValue("?");

                    cell = row.getCell(24);

                    cell.setCellStyle(styleCenter);

                    cell.setCellValue("");

                    cell = row.getCell(30);

                    cell.setCellStyle(styleCenter);

                    cell.setCellValue("?");

                    cell = row.getCell(34);

                    cell.setCellStyle(styleCenter);

                    cell.setCellValue("?");

                    cell = row.getCell(40);

                    cell.setCellStyle(styleCenter);

                    cell.setCellValue("");

                    cell = row.getCell(44);

                    cell.setCellStyle(styleCenter);

                    cell.setCellValue("");

                    for (int i = 0; i < ((p == pageSize - 1) ? partLastPageSize : partPageSize); i++) {

                        if (p * partPageSize + i > partSize - 1) {

                            break;
                        }

                        TbMaintianVo tbMaintianVo = maintianvosAdd.get(p * partPageSize + i);

                        row = sheet.getRow(partStartRow + 4 + i * 2);

                        cell = row.getCell(0);

                        // cell.setCellStyle(styleCenter);

                        cell.setCellValue(p * partPageSize + i + 1);

                        cell = row.getCell(2);

                        // cell.setCellStyle(styleCenter);

                        cell.setCellValue(tbMaintianVo.getPartCode());

                        cell = row.getCell(10);

                        // cell.setCellStyle(styleCenter);

                        cell.setCellValue(tbMaintianVo.getPartName());

                        cell = row.getCell(21);

                        // cell.setCellStyle(styleCenter);

                        cell.setCellValue(tbMaintianVo.getZl());

                        cell = row.getCell(24);

                        // cell.setCellStyle(styleCenter);

                        cell.setCellValue(tbMaintianVo.getProjectType());

                        cell = row.getCell(30);

                        cell.setCellStyle(styleRight);

                        cell.setCellValue(new BigDecimal(tbMaintianVo.getPartQuantity())
                                .divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

                        cell = row.getCell(34);

                        // cell.setCellStyle(styleCenter);

                        cell.setCellValue(new BigDecimal(tbMaintianVo.getPrice())
                                .divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

                        cell = row.getCell(40);

                        // cell.setCellStyle(styleCenter);

                        cell.setCellValue(new BigDecimal((1 - tbBusinessBalance.getFixPartFavourRate()) * 100)
                                .divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

                        cell = row.getCell(44);

                        // cell.setCellStyle(styleCenter);

                        cell.setCellValue(new BigDecimal(tbMaintianVo.getPartQuantity())
                                .multiply(new BigDecimal(tbMaintianVo.getPrice()))
                                .divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());
                    }

                }

                row = sheet.getRow(87);

                cell = row.getCell(34);

                cell.setCellValue(" " + (p + 1) + "    " + pageSize + "  ");

                if (p == pageSize - 1) {

                    int attachStartRow = 21 + 2 + 2 + 2 + 2 + (fixLastPageSize + partLastPageSize) * 2;

                    sheet.addMergedRegion(new CellRangeAddress(attachStartRow, attachStartRow, 0, 49));

                    row = sheet.getRow(attachStartRow);

                    cell = row.getCell(0);

                    cell.setCellStyle(styleBorderThickLeft);

                    cell.setCellValue("");

                    row = sheet.getRow(attachStartRow + 1);

                    cell = row.getCell(0);

                    cell.setCellStyle(styleBorderThickLeft);

                    row = sheet.getRow(attachStartRow + 2 + 1);

                    cell = row.getCell(0);

                    cell.setCellStyle(styleBorderThickLeftCenter);

                    row = sheet.getRow(attachStartRow + 2);

                    cell = row.getCell(0);

                    // cell.setCellStyle(styleCenter);
                    cell.setCellStyle(styleBorderThickLeftCenter);

                    cell.setCellValue("??");

                    if ("dfbz".equals(companyName)) {

                        cell = row.getCell(10);

                        cell.setCellStyle(styleCenter);

                        cell.setCellValue("??");

                        cell = row.getCell(21);

                        cell.setCellStyle(styleCenter);

                        cell.setCellValue("?");

                        cell = row.getCell(24);

                        cell.setCellStyle(styleCenter);

                        cell.setCellValue("");

                        cell = row.getCell(30);

                        cell.setCellStyle(styleCenter);

                        cell.setCellValue("?");

                        cell = row.getCell(34);

                        cell.setCellStyle(styleCenter);

                        cell.setCellValue("?");

                        cell = row.getCell(40);

                        cell.setCellStyle(styleCenter);

                    } else if ("xtl".equals(companyName)) {

                        cell = row.getCell(2);

                        cell.setCellStyle(styleCenter);

                        cell.setCellValue("");

                    }

                    cell = row.getCell(40);

                    cell.setCellStyle(styleCenter);

                    cell.setCellValue("");

                    cell = row.getCell(44);

                    cell.setCellStyle(styleCenter);

                    cell.setCellValue("");

                    row = sheet.getRow(attachStartRow + 4);

                    cell = row.getCell(0);

                    // cell.setCellStyle(styleCenter);
                    cell.setCellStyle(styleBorderThickLeftCenter);

                    cell.setCellValue("1");

                    row = sheet.getRow(attachStartRow + 4 + 1);

                    cell = row.getCell(0);

                    cell.setCellStyle(styleBorderThickLeftCenter);

                    if ("xtl".equals(companyName)) {

                        if (attachStartRow + 6 < 66) {

                            sheet.addMergedRegion(new CellRangeAddress(attachStartRow + 6, 66, 0, 49));
                        }

                    }

                }

            }

        }

        workbook.write(os);

    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    // 8 41

}

From source file:com.selfsoft.business.service.impl.TbBusinessSpecialBalanceServiceImpl.java

public void printTbBusinessBalanceTemplate(OutputStream os, String tpl, Long id, String companyName) {
    // ??/*from   w ww.  jav  a2 s  . c om*/
    TbBusinessSpecialBalance tbBusinessSpecialBalance = this.findById(id);
    // ?
    TbFixEntrust tbFixEntrust = null;
    if (null != tbBusinessSpecialBalance.getTbBusinessBalance()) {
        tbFixEntrust = tbFixEntrustService
                .findById(tbBusinessSpecialBalance.getTbBusinessBalance().getTbFixEntrust().getId());
    } else {
        tbFixEntrust = tbFixEntrustService.findById(tbBusinessSpecialBalance.getEntrustId());

    }
    // ?
    TbCustomer tbCustomer = tbCustomerService.findById(tbFixEntrust.getTbCustomer().getId());
    // ?
    TbCarInfo tbCarInfo = tbCarInfoService.findById(tbFixEntrust.getTbCarInfo().getId());
    // ??
    TmCompany tmCompany = tmCompanyService.acquireUniqueTmCompany();

    /*// ?
    List<TbFixEntrustContent> tbFixEntrustContentList = tbFixEntrustContentService
    .findTbFixEnTrustContentListByTbFixEntrustId(tbFixEntrust
          .getId());
            
    // ??
    List<TbMaintianVo> maintianvos = tbMaintainPartContentService
    .getTbMaintianDetailVosByEntrustId(tbFixEntrust.getId(),
          Constants.BALANCE_ALL);
    // ?
    List<TmStockOutDetVo> tmStockOutDetVos = tmStockOutService
    .getSellDetailByEntrustCode(tbFixEntrust.getEntrustCode(),
          Constants.BALANCE_ALL);*/
    // ?
    List<TbSpecialWorkingContent> tbSpecialWorkingContentList = tbSpecialWorkingContentService
            .findBySpecialId(id);
    // ??
    List<TbSpecialPartContent> tbSpecialPartContentList = tbSpecialPartContentService.findBySpecialId(id);

    // 
    /*List<TbBusinessBalanceItem> tbBusinessBalanceItemList = tbBusinessBalanceItemService
    .findGroupTbBusinessBalanceItemListByTbBusinessBalanceId(tbBusinessBalance
          .getId());*/
    List<TbBusinessSpecialBalanceItem> tbBusinessSpecialBalanceItemList = tbBusinessSpecialBalanceItemService
            .findBySpecialId(id);

    // ???
    /*if (null == maintianvos) {
       maintianvos = new ArrayList<TbMaintianVo>();
    }
            
    if (null != tmStockOutDetVos && tmStockOutDetVos.size() > 0) {
            
       for (TmStockOutDetVo tmStockOutDetVo : tmStockOutDetVos) {
            
    TbMaintianVo tbMaintianVo = new TbMaintianVo();
            
    tbMaintianVo.setPartId(tmStockOutDetVo.getPartinfoId());
            
    tbMaintianVo.setHouseName(tmStockOutDetVo.getHouseName());
            
    tbMaintianVo.setPartCode(tmStockOutDetVo.getPartCode());
            
    tbMaintianVo.setPartName(tmStockOutDetVo.getPartName());
            
    tbMaintianVo.setUnitName(tmStockOutDetVo.getUnitName());
            
    tbMaintianVo.setPrice(tmStockOutDetVo.getPrice());
            
    tbMaintianVo.setPartQuantity(tmStockOutDetVo.getQuantity());
            
    tbMaintianVo.setTotal(tmStockOutDetVo.getTotal());
            
    tbMaintianVo.setIsFree(tmStockOutDetVo.getIsFree());
            
    maintianvos.add(tbMaintianVo);
       }
            
    }*/

    int fixSize = (tbSpecialWorkingContentList == null ? 0 : tbSpecialWorkingContentList.size());

    int partSize = (tbSpecialPartContentList == null ? 0 : tbSpecialPartContentList.size());

    try {
        HSSFWorkbook workbook = new HSSFWorkbook(this.getClass().getResourceAsStream(tpl));

        HSSFSheet sheet = workbook.getSheetAt(0);

        HSSFCellStyle style = workbook.createCellStyle();

        style.setWrapText(true);

        style.setAlignment(HSSFCellStyle.ALIGN_LEFT);

        style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

        HSSFFont font = workbook.createFont();

        font.setFontName("");

        font.setFontHeightInPoints((short) 9);

        style.setFont(font);

        HSSFCellStyle styleBorderThinAll = workbook.createCellStyle();

        styleBorderThinAll.setBorderLeft(HSSFCellStyle.BORDER_THIN);

        styleBorderThinAll.setBorderRight(HSSFCellStyle.BORDER_THIN);

        styleBorderThinAll.setBorderTop(HSSFCellStyle.BORDER_THIN);

        styleBorderThinAll.setBorderBottom(HSSFCellStyle.BORDER_THIN);

        styleBorderThinAll.setWrapText(true);

        styleBorderThinAll.setAlignment(HSSFCellStyle.ALIGN_LEFT);

        styleBorderThinAll.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

        styleBorderThinAll.setFont(font);

        HSSFCellStyle styleBorderThickLeft = workbook.createCellStyle();

        styleBorderThickLeft.setBorderLeft(HSSFCellStyle.BORDER_THICK);

        styleBorderThickLeft.setBorderRight(HSSFCellStyle.BORDER_THIN);

        styleBorderThickLeft.setBorderTop(HSSFCellStyle.BORDER_THIN);

        styleBorderThickLeft.setBorderBottom(HSSFCellStyle.BORDER_THIN);

        styleBorderThickLeft.setWrapText(true);

        styleBorderThickLeft.setAlignment(HSSFCellStyle.ALIGN_LEFT);

        styleBorderThickLeft.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

        styleBorderThickLeft.setFont(font);

        HSSFCellStyle styleBorderThickRight = workbook.createCellStyle();

        styleBorderThickRight.setBorderRight(HSSFCellStyle.BORDER_THICK);

        styleBorderThickRight.setBorderLeft(HSSFCellStyle.BORDER_THIN);

        styleBorderThickRight.setBorderTop(HSSFCellStyle.BORDER_THIN);

        styleBorderThickRight.setBorderBottom(HSSFCellStyle.BORDER_THIN);

        styleBorderThickRight.setWrapText(true);

        styleBorderThickRight.setAlignment(HSSFCellStyle.ALIGN_LEFT);

        styleBorderThickRight.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

        styleBorderThickRight.setFont(font);

        HSSFCellStyle styleBorderThinAllCenter = workbook.createCellStyle();

        styleBorderThinAllCenter.setBorderLeft(HSSFCellStyle.BORDER_THIN);

        styleBorderThinAllCenter.setBorderRight(HSSFCellStyle.BORDER_THIN);

        styleBorderThinAllCenter.setBorderTop(HSSFCellStyle.BORDER_THIN);

        styleBorderThinAllCenter.setBorderBottom(HSSFCellStyle.BORDER_THIN);

        styleBorderThinAllCenter.setWrapText(true);

        styleBorderThinAllCenter.setAlignment(HSSFCellStyle.ALIGN_CENTER);

        styleBorderThinAllCenter.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

        styleBorderThinAllCenter.setFont(font);

        HSSFCellStyle styleBorderThickLeftCenter = workbook.createCellStyle();

        styleBorderThickLeftCenter.setBorderLeft(HSSFCellStyle.BORDER_THICK);

        styleBorderThickLeftCenter.setBorderRight(HSSFCellStyle.BORDER_THIN);

        styleBorderThickLeftCenter.setBorderTop(HSSFCellStyle.BORDER_THIN);

        styleBorderThickLeftCenter.setBorderBottom(HSSFCellStyle.BORDER_THIN);

        styleBorderThickLeftCenter.setWrapText(true);

        styleBorderThickLeftCenter.setAlignment(HSSFCellStyle.ALIGN_CENTER);

        styleBorderThickLeftCenter.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

        styleBorderThickLeftCenter.setFont(font);

        HSSFCellStyle styleBorderThickRightCenter = workbook.createCellStyle();

        styleBorderThickRightCenter.setBorderRight(HSSFCellStyle.BORDER_THICK);

        styleBorderThickRightCenter.setBorderLeft(HSSFCellStyle.BORDER_THIN);

        styleBorderThickRightCenter.setBorderTop(HSSFCellStyle.BORDER_THIN);

        styleBorderThickRightCenter.setBorderBottom(HSSFCellStyle.BORDER_THIN);

        styleBorderThickRightCenter.setWrapText(true);

        styleBorderThickRightCenter.setAlignment(HSSFCellStyle.ALIGN_CENTER);

        styleBorderThickRightCenter.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

        styleBorderThickRightCenter.setFont(font);

        HSSFCellStyle styleCenter = workbook.createCellStyle();

        styleCenter.setWrapText(true);

        styleCenter.setAlignment(HSSFCellStyle.ALIGN_CENTER);

        styleCenter.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

        styleCenter.setFont(font);

        HSSFRow row = null;

        HSSFCell cell = null;

        row = sheet.getRow(2);

        cell = row.getCell(4);

        // cell.setCellStyle(style);

        if ("dfbz".equals(companyName)) {
            cell.setCellValue(Constants.getCompanyMap().get("dfbzCode"));
        } else if ("xtl".equals(companyName)) {

            cell.setCellValue(Constants.getCompanyMap().get("xtlCode"));
        }

        row = sheet.getRow(2);

        cell = row.getCell(17);

        if ("xtl".equals(companyName)) {
            cell.setCellValue(/* tmCompany.getCompanyName() */"??");
        } else {
            cell.setCellValue(tmCompany.getCompanyName());
        }

        row = sheet.getRow(2);

        cell = row.getCell(33);

        cell.setCellValue(tmCompany.getCompanyPhone() == null ? "" : tmCompany.getCompanyPhone());

        row = sheet.getRow(4);

        cell = row.getCell(4);

        if ("xtl".equals(companyName)) {
            cell.setCellValue("");
        } else {

            cell.setCellValue(tmCompany.getCompanyZipCode() == null ? "" : tmCompany.getCompanyZipCode());
        }

        row = sheet.getRow(4);

        cell = row.getCell(17);

        cell.setCellValue(tmCompany.getCompanyAddress() == null ? "" : tmCompany.getCompanyAddress());

        row = sheet.getRow(4);

        cell = row.getCell(33);

        cell.setCellValue(tmCompany.getCompanyFax() == null ? "" : tmCompany.getCompanyFax());

        row = sheet.getRow(10);

        cell = row.getCell(2);

        // cell.setCellStyle(style);

        String entrustCode = tbFixEntrust.getEntrustCode();

        String[] es = entrustCode.split("-");

        String newCode = "RO" + es[0].substring(2, 6) + es[1];

        cell.setCellValue(newCode);

        row = sheet.getRow(10);

        cell = row.getCell(24);

        // cell.setCellStyle(style);

        cell.setCellValue((tbFixEntrust.getTmUser().getUserRealName() == null
                || "".equals(tbFixEntrust.getTmUser().getUserRealName()))
                        ? tbFixEntrust.getTmUser().getUserName()
                        : tbFixEntrust.getTmUser().getUserRealName());

        row = sheet.getRow(10);

        cell = row.getCell(40);

        // cell.setCellStyle(styleCenter);

        cell.setCellValue(
                CommonMethod.parseDateToString(tbBusinessSpecialBalance.getBananceDate(), "yyyy-MM-dd HH:mm"));

        row = sheet.getRow(8);

        cell = row.getCell(40);

        // cell.setCellStyle(styleCenter);

        cell.setCellValue(CommonMethod.parseDateToString(tbFixEntrust.getFixDate(), "yyyy-MM-dd HH:mm"));

        row = sheet.getRow(12);

        cell = row.getCell(4);

        cell.setCellValue(tbCustomer.getCustomerName());

        row = sheet.getRow(12);

        cell = row.getCell(24);

        cell.setCellValue(tbCarInfo.getLicenseCode());

        row = sheet.getRow(12);

        cell = row.getCell(41);

        cell.setCellValue(tbCarInfo.getTmCarModelType().getModelName());

        row = sheet.getRow(14);

        cell = row.getCell(4);

        cell.setCellValue(tbCustomer.getTelephone() == null ? "" : tbCustomer.getTelephone());

        row = sheet.getRow(18);

        cell = row.getCell(12);

        cell.setCellValue(tbCustomer.getTelephone() == null ? "" : tbCustomer.getTelephone());

        row = sheet.getRow(14);

        cell = row.getCell(24);

        cell.setCellValue(tbCarInfo.getChassisCode());

        row = sheet.getRow(16);

        cell = row.getCell(4);

        cell.setCellValue(tbCustomer.getAddress() == null ? "" : tbCustomer.getAddress());

        row = sheet.getRow(16);

        cell = row.getCell(24);

        cell.setCellValue(CommonMethod.parseDateToString(tbCarInfo.getPurchaseDate(), "yyyy-MM-dd"));

        row = sheet.getRow(16);

        cell = row.getCell(41);

        if ("xtl".equals(companyName)) {

            cell.setCellValue(
                    tbFixEntrust.getEnterStationKilo() == null ? ""
                            : new BigDecimal(tbFixEntrust.getEnterStationKilo())
                                    .divide(new BigDecimal("1.00"), 0, BigDecimal.ROUND_HALF_UP).toString()
                                    + " Km");
        }

        else {

            cell.setCellValue(
                    tbFixEntrust.getEnterStationKilo() == null ? ""
                            : new BigDecimal(tbFixEntrust.getEnterStationKilo())
                                    .divide(new BigDecimal("1.00"), 0, BigDecimal.ROUND_HALF_UP).toString()
                                    + "   Km");

        }

        row = sheet.getRow(18);

        cell = row.getCell(4);

        cell.setCellValue(tbCustomer.getContractPerson() == null ? "" : tbCustomer.getContractPerson());

        row = sheet.getRow(18);

        cell = row.getCell(24);

        cell.setCellValue(tbCarInfo.getEngineCode() == null ? "" : tbCarInfo.getEngineCode());

        row = sheet.getRow(18);

        cell = row.getCell(41);

        cell.setCellValue(tbCarInfo.getColor() == null ? "" : tbCarInfo.getColor());

        if (null != tbBusinessSpecialBalanceItemList && tbBusinessSpecialBalanceItemList.size() > 0) {

            for (TbBusinessSpecialBalanceItem tbBusinessSpecialBalanceItem : tbBusinessSpecialBalanceItemList) {

                if ("XLCLF".equals(tbBusinessSpecialBalanceItem.getBalanceItemCode())) {

                    row = sheet.getRow(77);

                    cell = row.getCell(24);

                    cell.setCellValue(new BigDecimal(tbBusinessSpecialBalanceItem.getBalanceItemTotal())
                            .divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

                    continue;
                }

                if ("XLGSF".equals(tbBusinessSpecialBalanceItem.getBalanceItemCode())) {

                    row = sheet.getRow(75);

                    cell = row.getCell(24);

                    cell.setCellValue(new BigDecimal(tbBusinessSpecialBalanceItem.getBalanceItemTotal())
                            .divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

                    continue;
                }

                if ("ZJE".equals(tbBusinessSpecialBalanceItem.getBalanceItemCode())) {

                    row = sheet.getRow(81);

                    cell = row.getCell(24);

                    cell.setCellValue(new BigDecimal(tbBusinessSpecialBalanceItem.getBalanceItemTotal())
                            .divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

                    continue;
                }

            }

            row = sheet.getRow(79);

            cell = row.getCell(24);

            cell.setCellValue("0.00");

        }

        Double wt = tbBusinessSpecialBalance.getWorkingHourTotalAll() == null ? 0d
                : tbBusinessSpecialBalance.getWorkingHourTotalAll();

        Double wf = tbBusinessSpecialBalance.getWorkingHourFavourRate() == null ? 0d
                : tbBusinessSpecialBalance.getWorkingHourFavourRate();

        Double pt = tbBusinessSpecialBalance.getFixPartTotalAll() == null ? 0d
                : tbBusinessSpecialBalance.getFixPartTotalAll();

        Double pf = tbBusinessSpecialBalance.getFixPartFavourRate() == null ? 0d
                : tbBusinessSpecialBalance.getFixPartFavourRate();

        Double st = tbBusinessSpecialBalance.getSolePartTotalAll() == null ? 0d
                : tbBusinessSpecialBalance.getSolePartTotalAll();

        Double sf = tbBusinessSpecialBalance.getSolePartFavourRate() == null ? 0d
                : tbBusinessSpecialBalance.getSolePartFavourRate();

        BigDecimal fixF = new BigDecimal(wt).divide(new BigDecimal(1 - wf), 2, BigDecimal.ROUND_HALF_UP)
                .multiply(new BigDecimal(wf));

        BigDecimal partF = new BigDecimal(pt).divide(new BigDecimal(1 - pf), 2, BigDecimal.ROUND_HALF_UP)
                .multiply(new BigDecimal(pf));

        BigDecimal soleF = new BigDecimal(st).divide(new BigDecimal(1 - sf), 2, BigDecimal.ROUND_HALF_UP)
                .multiply(new BigDecimal(sf));

        row = sheet.getRow(83);

        cell = row.getCell(4);

        // cell.setCellStyle(styleCenter);

        cell.setCellValue(fixF.add(partF).add(soleF).divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP)
                .toString());

        row = sheet.getRow(83);

        cell = row.getCell(14);

        // cell.setCellStyle(styleCenter);

        cell.setCellValue(new BigDecimal(tbBusinessSpecialBalance.getPayedAmount() == null ? 0d
                : tbBusinessSpecialBalance.getPayedAmount())
                        .divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

        row = sheet.getRow(68);

        cell = row.getCell(40);

        // cell.setCellStyle(styleCenter);

        cell.setCellValue(CommonMethod.parseDateToString(tbFixEntrust.getRemindMaintainDate(), "yyyy-MM-dd"));

        row = sheet.getRow(70);

        cell = row.getCell(40);

        // cell.setCellStyle(styleCenter);

        cell.setCellValue(tbFixEntrust.getRemindMaintainKilo() == null ? ""
                : new BigDecimal(tbFixEntrust.getRemindMaintainKilo()).divide(new BigDecimal("1.00"), 0,
                        BigDecimal.ROUND_HALF_UP) + "   Km");

        row = sheet.getRow(77);

        cell = row.getCell(30);

        // cell.setCellStyle(styleCenter);

        cell.setCellValue(tbFixEntrust.getRemark());

        ByteArrayOutputStream byteArrayOutImgLion = new ByteArrayOutputStream();

        String pic = "";

        if ("dfbz".equals(companyName)) {
            pic = "/lion_jsd.png";
        } else if ("xtl".equals(companyName)) {

            pic = "/xtl_jsd.png";
        }

        BufferedImage bufferImgLion = ImageIO.read(this.getClass().getResourceAsStream(pic));

        ImageIO.write(bufferImgLion, "png", byteArrayOutImgLion);

        HSSFPatriarch patriarch = sheet.createDrawingPatriarch();

        HSSFClientAnchor anchorLion = new HSSFClientAnchor(0, 0, 1023, 200, (short) 41, 0, (short) 47, 7);

        patriarch.createPicture(anchorLion,
                workbook.addPicture(byteArrayOutImgLion.toByteArray(), HSSFWorkbook.PICTURE_TYPE_PNG));

        int maxSize = 19;

        int maxFixSize = (fixSize > 19 ? 19 : fixSize);

        int maxPartSize = maxSize - maxFixSize > partSize ? partSize : maxSize - maxFixSize;

        int partStartRow = (fixSize == 0 ? 21 : 21 + maxFixSize * 2 + 4);

        int partStartRowClone = ((fixSize - maxFixSize) == 0 ? 21 : 21 + (fixSize - maxFixSize) * 2 + 4);

        int minBlank = 9;

        if ((fixSize + partSize) > 17) {

            HSSFSheet sheetClone = workbook.cloneSheet(0);

            HSSFRow rowClone = sheetClone.getRow(87);

            HSSFCell cellClone = rowClone.getCell(34);

            cellClone.setCellValue("2  2  ");

            HSSFPatriarch patriarchClone = sheetClone.createDrawingPatriarch();

            HSSFClientAnchor anchorLionClone = new HSSFClientAnchor(0, 0, 1023, 200, (short) 41, 0, (short) 47,
                    8);

            patriarchClone.createPicture(anchorLionClone,
                    workbook.addPicture(byteArrayOutImgLion.toByteArray(), HSSFWorkbook.PICTURE_TYPE_PNG));

            if ((fixSize - maxFixSize) > 0) {

                /*
                 * sheetClone.addMergedRegion(new Region(21, (short) 0, 21,
                 * (short) 49));
                 * 
                 * sheetClone.addMergedRegion(new Region(21, (short) 0, 21,
                 * (short) 0));
                 */

                sheetClone.addMergedRegion(new CellRangeAddress(21, 21, 0, 49));

                rowClone = sheetClone.getRow(21);

                cellClone = rowClone.getCell(0);

                // cellClone.setCellStyle(style);

                cellClone.setCellValue("");

                cellClone.setCellStyle(styleBorderThickLeft);

                rowClone = sheetClone.getRow(21);

                cellClone = rowClone.getCell(0);

                cellClone.setCellStyle(styleBorderThickLeft);

                rowClone = sheetClone.getRow(24);

                cellClone = rowClone.getCell(0);

                cellClone.setCellStyle(styleBorderThickLeftCenter);

                rowClone = sheetClone.getRow(23);

                cellClone = rowClone.getCell(0);

                // cellClone.setCellStyle(styleCenter);

                cellClone.setCellStyle(styleBorderThickLeftCenter);

                cellClone.setCellValue("??");

                cellClone = rowClone.getCell(2);

                cellClone.setCellStyle(styleCenter);

                cellClone.setCellValue("?");

                cellClone = rowClone.getCell(10);

                cellClone.setCellStyle(styleCenter);

                cellClone.setCellValue("");

                cellClone = rowClone.getCell(21);

                cellClone.setCellStyle(styleCenter);

                cellClone.setCellValue("?");

                cellClone = rowClone.getCell(24);

                cellClone.setCellStyle(styleCenter);

                cellClone.setCellValue("");

                cellClone = rowClone.getCell(30);

                cellClone.setCellStyle(styleCenter);

                cellClone.setCellValue("");

                cellClone = rowClone.getCell(34);

                cellClone.setCellStyle(styleCenter);

                cellClone.setCellValue("?");

                cellClone = rowClone.getCell(40);

                cellClone.setCellStyle(styleCenter);

                cellClone.setCellValue("");

                cellClone = rowClone.getCell(44);

                cellClone.setCellStyle(styleCenter);

                cellClone.setCellValue("");

                for (int i = 0; i < (fixSize - maxFixSize); i++) {

                    TbSpecialWorkingContent tbFixEntrustContent = tbSpecialWorkingContentList.get(i);

                    rowClone = sheetClone.getRow(25 + i * 2);

                    cellClone = rowClone.getCell(0);

                    // cellClone.setCellStyle(styleCenter);

                    cellClone.setCellValue(i + 1);

                    cellClone = rowClone.getCell(2);

                    // cellClone.setCellStyle(styleCenter);

                    cellClone.setCellValue(tbFixEntrustContent.getStationCode());

                    cellClone = rowClone.getCell(10);

                    // cellClone.setCellStyle(styleCenter);

                    cellClone.setCellValue(tbFixEntrustContent.getStationName());

                    cellClone = rowClone.getCell(21);

                    // cellClone.setCellStyle(styleCenter);

                    cellClone.setCellValue("");

                    cellClone = rowClone.getCell(24);

                    // cellClone.setCellStyle(styleCenter);

                    cellClone.setCellValue("");

                    cellClone = rowClone.getCell(30);

                    // cellClone.setCellStyle(styleCenter);

                    cellClone.setCellValue(new BigDecimal(tbFixEntrustContent.getFixHour())
                            .divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

                    cellClone = rowClone.getCell(34);

                    // cellClone.setCellStyle(styleCenter);

                    cellClone.setCellValue(new BigDecimal(tbFixEntrustContent.getWorkingHourPrice())
                            .divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

                    cellClone = rowClone.getCell(40);

                    // cellClone.setCellStyle(styleCenter);

                    cellClone.setCellValue(new BigDecimal(tbBusinessSpecialBalance.getWorkingHourFavourRate())
                            .divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

                    cellClone = rowClone.getCell(44);

                    // cellClone.setCellStyle(styleCenter);

                    cellClone.setCellValue(new BigDecimal(tbFixEntrustContent.getFixHourAll())
                            .divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());
                }

            }

            if ((partSize - maxPartSize) > 0) {

                /*
                 * sheetClone.addMergedRegion(new Region(partStartRowClone,
                 * (short) 0, partStartRowClone, (short) 49));
                 * 
                 * sheetClone.addMergedRegion(new Region(partStartRowClone,
                 * (short) 0, partStartRowClone, (short) 49));
                 */

                sheetClone.addMergedRegion(new CellRangeAddress(partStartRowClone, partStartRowClone, 0, 49));

                rowClone = sheetClone.getRow(partStartRowClone);

                cellClone = rowClone.getCell(0);

                // cellClone.setCellStyle(style);

                cellClone.setCellStyle(styleBorderThickLeft);

                cellClone.setCellValue("");

                rowClone = sheetClone.getRow(partStartRowClone + 1);

                cellClone = rowClone.getCell(0);

                cellClone.setCellStyle(styleBorderThickLeft);

                rowClone = sheetClone.getRow(partStartRowClone + 2 + 1);

                cellClone = rowClone.getCell(0);

                cellClone.setCellStyle(styleBorderThickLeftCenter);

                rowClone = sheetClone.getRow(partStartRowClone + 2);

                cellClone = rowClone.getCell(0);

                // cellClone.setCellStyle(styleCenter);
                cellClone.setCellStyle(styleBorderThickLeftCenter);

                cellClone.setCellValue("??");

                cellClone = rowClone.getCell(2);

                cellClone.setCellStyle(styleCenter);

                cellClone.setCellValue("?");

                cellClone = rowClone.getCell(10);

                cellClone.setCellStyle(styleCenter);

                cellClone.setCellValue("??");

                cellClone = rowClone.getCell(21);

                cellClone.setCellStyle(styleCenter);

                cellClone.setCellValue("?");

                cellClone = rowClone.getCell(24);

                cellClone.setCellStyle(styleCenter);

                cellClone.setCellValue("");

                cellClone = rowClone.getCell(30);

                cellClone.setCellStyle(styleCenter);

                cellClone.setCellValue("?");

                cellClone = rowClone.getCell(34);

                cellClone.setCellStyle(styleCenter);

                cellClone.setCellValue("?");

                cellClone = rowClone.getCell(40);

                cellClone.setCellStyle(styleCenter);

                cellClone.setCellValue("");

                cellClone = rowClone.getCell(44);

                cellClone.setCellStyle(styleCenter);

                cellClone.setCellValue("");

                for (int i = 0; i < (partSize - maxPartSize); i++) {

                    TbSpecialPartContent tbMaintianVo = tbSpecialPartContentList.get(i);

                    rowClone = sheetClone.getRow(partStartRowClone + 4 + i * 2);

                    cellClone = rowClone.getCell(0);

                    // cellClone.setCellStyle(styleCenter);

                    cellClone.setCellValue(i + 1);

                    cellClone = rowClone.getCell(2);

                    // cellClone.setCellStyle(styleCenter);

                    cellClone.setCellValue(tbMaintianVo.getPartCode());

                    cellClone = rowClone.getCell(10);

                    // cellClone.setCellStyle(styleCenter);

                    cellClone.setCellValue(tbMaintianVo.getPartName());

                    cellClone = rowClone.getCell(21);

                    // cellClone.setCellStyle(styleCenter);

                    cellClone.setCellValue("");

                    cellClone = rowClone.getCell(24);

                    // cellClone.setCellStyle(styleCenter);

                    cellClone.setCellValue("");

                    cellClone = rowClone.getCell(30);

                    // cellClone.setCellStyle(styleCenter);

                    cellClone.setCellValue(new BigDecimal(tbMaintianVo.getPartQuantity())
                            .divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

                    cellClone = rowClone.getCell(34);

                    // cellClone.setCellStyle(styleCenter);

                    cellClone.setCellValue(new BigDecimal(tbMaintianVo.getPrice())
                            .divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

                    cellClone = rowClone.getCell(40);

                    // .setCellStyle(styleCenter);

                    cellClone.setCellValue(new BigDecimal(tbBusinessSpecialBalance.getFixPartFavourRate())
                            .divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

                    cellClone = rowClone.getCell(44);

                    // cellClone.setCellStyle(styleCenter);

                    cellClone.setCellValue(new BigDecimal(tbMaintianVo.getPartQuantity())
                            .multiply(new BigDecimal(tbMaintianVo.getPrice()))
                            .divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());
                }

            }

            int attachStartRowClone = 21;

            if ((fixSize - maxFixSize + partSize - maxPartSize) <= 17) {

                if ((fixSize - maxFixSize) != 0 && (partSize - maxPartSize) == 0
                        && (fixSize - maxFixSize) < 18) {

                    attachStartRowClone = 21 + 2 + 2 + (fixSize - maxFixSize) * 2;

                }

                if ((partSize - maxPartSize) != 0 && (fixSize - maxFixSize) == 0
                        && (partSize - maxPartSize) < 18) {

                    attachStartRowClone = 21 + 2 + 2 + 2 + (partSize - maxPartSize) * 2;
                }

                if ((fixSize - maxFixSize) != 0 && (partSize - maxPartSize) != 0
                        && (fixSize - maxFixSize + partSize - maxPartSize < 18)) {

                    attachStartRowClone = 21 + 2 + 2 + 2 + 2 + (fixSize - maxFixSize) * 2
                            + (partSize - maxPartSize) * 2;

                }

                /*
                 * sheetClone.addMergedRegion(new
                 * Region(attachStartRowClone, (short) 0,
                 * attachStartRowClone, (short) 49));
                 * 
                 * sheetClone.addMergedRegion(new
                 * Region(attachStartRowClone, (short) 0,
                 * attachStartRowClone, (short) 49));
                 */

                sheetClone
                        .addMergedRegion(new CellRangeAddress(attachStartRowClone, attachStartRowClone, 0, 49));

                rowClone = sheetClone.getRow(attachStartRowClone);

                cellClone = rowClone.getCell(0);

                // cellClone.setCellStyle(style);

                cellClone.setCellStyle(styleBorderThickLeft);

                cellClone.setCellValue("");

                rowClone = sheetClone.getRow(attachStartRowClone + 1);

                cellClone = rowClone.getCell(0);

                cellClone.setCellStyle(styleBorderThickLeft);

                rowClone = sheetClone.getRow(attachStartRowClone + 2 + 1);

                cellClone = rowClone.getCell(0);

                // cellClone.setCellStyle(styleCenter);
                cellClone.setCellStyle(styleBorderThickLeftCenter);

                rowClone = sheetClone.getRow(attachStartRowClone + 2);

                cellClone = rowClone.getCell(0);

                // cellClone.setCellStyle(styleCenter);
                cellClone.setCellStyle(styleBorderThickLeftCenter);

                cellClone.setCellValue("??");

                if ("dfbz".equals(companyName)) {

                    cellClone = rowClone.getCell(10);

                    cellClone.setCellStyle(styleCenter);

                    cellClone.setCellValue("??");

                    cellClone = rowClone.getCell(21);

                    cellClone.setCellStyle(styleCenter);

                    cellClone.setCellValue("?");

                    cellClone = rowClone.getCell(24);

                    cellClone.setCellStyle(styleCenter);

                    cellClone.setCellValue("");

                    cellClone = rowClone.getCell(30);

                    cellClone.setCellStyle(styleCenter);

                    cellClone.setCellValue("?");

                    cellClone = rowClone.getCell(34);

                    cellClone.setCellStyle(styleCenter);

                    cellClone.setCellValue("?");

                    cellClone = rowClone.getCell(40);

                    cellClone.setCellStyle(styleCenter);

                } else if ("xtl".equals(companyName)) {

                    /*
                     * sheetClone.addMergedRegion(new
                     * Region(attachStartRowClone + 2, (short) 2,
                     * attachStartRowClone + 2, (short) 39));
                     * 
                     * sheetClone.addMergedRegion(new
                     * Region(attachStartRowClone + 2, (short) 2,
                     * attachStartRowClone + 2, (short) 39));
                     */

                    sheetClone.addMergedRegion(
                            new CellRangeAddress(attachStartRowClone + 2, attachStartRowClone + 2, 2, 39));

                    cellClone = rowClone.getCell(2);

                    cellClone.setCellStyle(styleCenter);

                    cellClone.setCellValue("");

                }

                cellClone = rowClone.getCell(40);

                cellClone.setCellStyle(styleCenter);

                cellClone.setCellValue("");

                cellClone = rowClone.getCell(44);

                cellClone.setCellStyle(styleCenter);

                cellClone.setCellValue("");

                rowClone = sheetClone.getRow(attachStartRowClone + 4);

                cellClone = rowClone.getCell(0);

                // cellClone.setCellStyle(styleCenter);

                cellClone.setCellStyle(styleBorderThickLeftCenter);

                cellClone.setCellValue("1");

                rowClone = sheetClone.getRow(attachStartRowClone + 4 + 1);

                cellClone = rowClone.getCell(0);

                cellClone.setCellStyle(styleBorderThickLeftCenter);

                /*
                 * sheetClone.addMergedRegion(new Region(attachStartRowClone
                 * + 6, (short) 0, 66, (short) 49));
                 * 
                 * sheetClone.addMergedRegion(new Region(attachStartRowClone
                 * + 6, (short) 0, 66, (short) 49));
                 */

                sheetClone.addMergedRegion(new CellRangeAddress(attachStartRowClone + 6, 66, 0, 49));

            }

        } else {

            row = sheet.getRow(87);

            cell = row.getCell(34);

            cell.setCellValue(" 1   1  ");

        }

        if (fixSize > 0) {

            /*
             * sheet.addMergedRegion(new Region(21, (short) 0, 21, (short)
             * 49));
             * 
             * sheet.addMergedRegion(new Region(21, (short) 0, 21, (short)
             * 49));
             */

            sheet.addMergedRegion(new CellRangeAddress(21, 21, 0, 49));

            row = sheet.getRow(21);

            cell = row.getCell(0);

            // cell.setCellStyle(style);

            cell.setCellValue("");

            cell.setCellStyle(styleBorderThickLeft);

            row = sheet.getRow(22);

            cell = row.getCell(0);

            cell.setCellStyle(styleBorderThickLeft);

            row = sheet.getRow(24);

            cell = row.getCell(0);

            cell.setCellStyle(styleBorderThickLeft);

            row = sheet.getRow(23);

            cell = row.getCell(0);

            // cell.setCellStyle(styleCenter);

            cell.setCellValue("??");

            cell.setCellStyle(styleBorderThickLeftCenter);

            cell = row.getCell(2);

            cell.setCellStyle(styleCenter);

            cell.setCellValue("?");

            cell = row.getCell(10);

            cell.setCellStyle(styleCenter);

            cell.setCellValue("");

            cell = row.getCell(21);

            cell.setCellStyle(styleCenter);

            cell.setCellValue("?");

            cell = row.getCell(24);

            cell.setCellStyle(styleCenter);

            cell.setCellValue("");

            cell = row.getCell(30);

            cell.setCellStyle(styleCenter);

            cell.setCellValue("");

            cell = row.getCell(34);

            cell.setCellStyle(styleCenter);

            cell.setCellValue("?");

            cell = row.getCell(40);

            cell.setCellStyle(styleCenter);

            cell.setCellValue("");

            cell = row.getCell(44);

            cell.setCellStyle(styleCenter);

            cell.setCellValue("");

            for (int i = 0; i < maxFixSize; i++) {

                TbSpecialWorkingContent tbFixEntrustContent = tbSpecialWorkingContentList.get(i);

                row = sheet.getRow(25 + i * 2);

                cell = row.getCell(0);

                // cell.setCellStyle(styleCenter);

                cell.setCellValue(i + 1);

                cell = row.getCell(2);

                // cell.setCellStyle(styleCenter);

                cell.setCellValue(tbFixEntrustContent.getStationCode());

                cell = row.getCell(10);

                // cell.setCellStyle(styleCenter);

                cell.setCellValue(tbFixEntrustContent.getStationName());

                cell = row.getCell(21);

                // cell.setCellStyle(styleCenter);

                cell.setCellValue("");

                cell = row.getCell(24);

                // cell.setCellStyle(styleCenter);

                cell.setCellValue("");

                cell = row.getCell(30);

                // cell.setCellStyle(styleCenter);

                cell.setCellValue(new BigDecimal(tbFixEntrustContent.getFixHour())
                        .divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

                cell = row.getCell(34);

                // cell.setCellStyle(styleCenter);

                cell.setCellValue(new BigDecimal(tbFixEntrustContent.getWorkingHourPrice())
                        .divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

                cell = row.getCell(40);

                // cell.setCellStyle(styleCenter);

                cell.setCellValue(
                        new BigDecimal((1 - tbBusinessSpecialBalance.getWorkingHourFavourRate()) * 100)
                                .divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

                cell = row.getCell(44);

                // cell.setCellStyle(styleCenter);

                cell.setCellValue(new BigDecimal(tbFixEntrustContent.getFixHourAll())
                        .divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());
            }

        }

        if ((fixSize <= maxSize - 1) && partSize > 0) {

            /*
             * sheet.addMergedRegion(new Region(partStartRow, (short) 0,
             * partStartRow, (short) 49));
             * 
             * sheet.addMergedRegion(new Region(partStartRow, (short) 0,
             * partStartRow, (short) 49));
             */

            sheet.addMergedRegion(new CellRangeAddress(partStartRow, partStartRow, 0, 49));

            row = sheet.getRow(partStartRow);

            cell = row.getCell(0);

            // cell.setCellStyle(style);

            cell.setCellValue("");

            cell.setCellStyle(styleBorderThickLeft);

            row = sheet.getRow(partStartRow + 1);

            cell = row.getCell(0);

            cell.setCellStyle(styleBorderThickLeft);

            row = sheet.getRow(partStartRow + 2 + 1);

            cell = row.getCell(0);

            cell.setCellStyle(styleBorderThickLeftCenter);

            row = sheet.getRow(partStartRow + 2);

            cell = row.getCell(0);

            cell.setCellStyle(styleBorderThickLeftCenter);

            cell.setCellValue("??");

            cell = row.getCell(2);

            cell.setCellStyle(styleCenter);

            cell.setCellValue("?");

            cell = row.getCell(10);

            cell.setCellStyle(styleCenter);

            cell.setCellValue("??");

            cell = row.getCell(21);

            cell.setCellStyle(styleCenter);

            cell.setCellValue("?");

            cell = row.getCell(24);

            cell.setCellStyle(styleCenter);

            cell.setCellValue("");

            cell = row.getCell(30);

            cell.setCellStyle(styleCenter);

            cell.setCellValue("?");

            cell = row.getCell(34);

            cell.setCellStyle(styleCenter);

            cell.setCellValue("?");

            cell = row.getCell(40);

            cell.setCellStyle(styleCenter);

            cell.setCellValue("");

            cell = row.getCell(44);

            cell.setCellStyle(styleCenter);

            cell.setCellValue("");

            if (partSize > 0) {

                for (int i = 0; i < maxPartSize; i++) {

                    TbSpecialPartContent tbMaintianVo = tbSpecialPartContentList.get(i);

                    row = sheet.getRow(partStartRow + 4 + i * 2);

                    cell = row.getCell(0);

                    // cell.setCellStyle(styleCenter);

                    cell.setCellValue(i + 1);

                    cell = row.getCell(2);

                    // cell.setCellStyle(styleCenter);

                    cell.setCellValue(tbMaintianVo.getPartCode());

                    cell = row.getCell(10);

                    // cell.setCellStyle(styleCenter);

                    cell.setCellValue(tbMaintianVo.getPartName());

                    cell = row.getCell(21);

                    // cell.setCellStyle(styleCenter);

                    cell.setCellValue("");

                    cell = row.getCell(24);

                    // cell.setCellStyle(styleCenter);

                    cell.setCellValue("");

                    cell = row.getCell(30);

                    // cell.setCellStyle(styleCenter);

                    cell.setCellValue(new BigDecimal(tbMaintianVo.getPartQuantity())
                            .divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

                    cell = row.getCell(34);

                    // cell.setCellStyle(styleCenter);

                    cell.setCellValue(new BigDecimal(tbMaintianVo.getPrice())
                            .divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

                    cell = row.getCell(40);

                    // cell.setCellStyle(styleCenter);

                    cell.setCellValue(
                            new BigDecimal((1 - tbBusinessSpecialBalance.getFixPartFavourRate()) * 100)
                                    .divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());

                    cell = row.getCell(44);

                    // cell.setCellStyle(styleCenter);

                    cell.setCellValue(new BigDecimal(tbMaintianVo.getPartQuantity())
                            .multiply(new BigDecimal(tbMaintianVo.getPrice()))
                            .divide(new BigDecimal("1.00"), 2, BigDecimal.ROUND_HALF_UP).toString());
                }

            }

        }

        int attachStartRow = 21;

        if ((fixSize + partSize) <= 17) {

            if (fixSize != 0 && partSize == 0 && fixSize < 18) {

                attachStartRow = 19 + 2 + 2 + 2 + fixSize * 2;

            }

            if (partSize != 0 && fixSize == 0 && partSize < 18) {

                attachStartRow = 19 + 2 + 2 + 2 + partSize * 2;
            }

            if (fixSize != 0 && partSize != 0 && (fixSize + partSize < 18)) {

                attachStartRow = 19 + 2 + 2 + 2 + 2 + 2 + fixSize * 2 + partSize * 2;

            }

            /*
             * sheet.addMergedRegion(new Region(attachStartRow, (short) 0,
             * attachStartRow, (short) 49));
             * 
             * sheet.addMergedRegion(new Region(attachStartRow, (short) 0,
             * attachStartRow, (short) 49));
             */

            sheet.addMergedRegion(new CellRangeAddress(attachStartRow, attachStartRow, 0, 49));

            row = sheet.getRow(attachStartRow);

            cell = row.getCell(0);

            // cell.setCellStyle(style);

            cell.setCellStyle(styleBorderThickLeft);

            cell.setCellValue("");

            row = sheet.getRow(attachStartRow + 1);

            cell = row.getCell(0);

            cell.setCellStyle(styleBorderThickLeft);

            row = sheet.getRow(attachStartRow + 2 + 1);

            cell = row.getCell(0);

            cell.setCellStyle(styleBorderThickLeftCenter);

            row = sheet.getRow(attachStartRow + 2);

            cell = row.getCell(0);

            // cell.setCellStyle(styleCenter);
            cell.setCellStyle(styleBorderThickLeftCenter);

            cell.setCellValue("??");

            if ("dfbz".equals(companyName)) {

                cell = row.getCell(10);

                cell.setCellStyle(styleCenter);

                cell.setCellValue("??");

                cell = row.getCell(21);

                cell.setCellStyle(styleCenter);

                cell.setCellValue("?");

                cell = row.getCell(24);

                cell.setCellStyle(styleCenter);

                cell.setCellValue("");

                cell = row.getCell(30);

                cell.setCellStyle(styleCenter);

                cell.setCellValue("?");

                cell = row.getCell(34);

                cell.setCellStyle(styleCenter);

                cell.setCellValue("?");

                cell = row.getCell(40);

                cell.setCellStyle(styleCenter);

            } else if ("xtl".equals(companyName)) {

                /*
                 * sheet.addMergedRegion(new Region(attachStartRow + 2,
                 * (short) 2, attachStartRow + 2, (short) 39));
                 * 
                 * sheet.addMergedRegion(new Region(attachStartRow + 2,
                 * (short) 2, attachStartRow + 2, (short) 39));
                 */

                sheet.addMergedRegion(new CellRangeAddress(attachStartRow + 2, attachStartRow + 2, 2, 39));

                cell = row.getCell(2);

                cell.setCellStyle(styleCenter);

                cell.setCellValue("");

            }

            /*
             * sheet.addMergedRegion(new Region(attachStartRow + 2, (short)
             * 2, attachStartRow + 2, (short) 39));
             * 
             * sheet.addMergedRegion(new Region(attachStartRow + 2, (short)
             * 2, attachStartRow + 2, (short) 39));
             * 
             * cell = row.getCell(2);
             * 
             * cell.setCellStyle(styleCenter);
             * 
             * cell.setCellValue("");
             */

            cell = row.getCell(40);

            cell.setCellStyle(styleCenter);

            cell.setCellValue("");

            cell = row.getCell(44);

            cell.setCellStyle(styleCenter);

            cell.setCellValue("");

            row = sheet.getRow(attachStartRow + 4);

            cell = row.getCell(0);

            // cell.setCellStyle(styleCenter);
            cell.setCellStyle(styleBorderThickLeftCenter);

            cell.setCellValue("1");

            row = sheet.getRow(attachStartRow + 4 + 1);

            cell = row.getCell(0);

            cell.setCellStyle(styleBorderThickLeftCenter);

            if ("xtl".equals(companyName)) {

                /*
                 * sheet.addMergedRegion(new Region(attachStartRow + 6,
                 * (short) 0, 66, (short) 49));
                 * 
                 * sheet.addMergedRegion(new Region(attachStartRow + 6,
                 * (short) 0, 66, (short) 49));
                 */
                try {
                    sheet.addMergedRegion(new CellRangeAddress(attachStartRow + 6, 66, 0, 49));
                } catch (Exception e) {
                    sheet.addMergedRegion(new CellRangeAddress(attachStartRow + 6, 67, 0, 49));
                    e.printStackTrace();
                }

            }
        }

        workbook.write(os);

    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    // 8 41

}

From source file:com.sevenorcas.openstyle.app.service.spreadsheet.SpreadsheetCell.java

public void addMergedRegion(int r1, int r2, int c1, int c2) {
    crAdress = new CellRangeAddress(r1, r2, c1, c2);
}

From source file:com.skt.adcas.lte.action.DownLinkByNMSAction.java

private void makeTrafficSheet(Workbook wb, String safeName, Map map) {
    //sheet //from  www  . ja  v a 2  s .c o  m
    Sheet sheet = wb.createSheet(safeName);

    //header ?
    Row hrow0 = sheet.createRow((short) 0);
    hrow0.setHeightInPoints(20);
    createCell(wb, hrow0, (short) 0, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "");
    createCell(wb, hrow0, (short) 1, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, ""); // "MB_TIME"
    createCell(wb, hrow0, (short) 2, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "DU"); // "BTS_NM"
    createCell(wb, hrow0, (short) 3, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "CELL ID"); // "CELL_ID"
    createCell(wb, hrow0, (short) 4, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "CELL "); //  "CELL_NM"
    createCell(wb, hrow0, (short) 5, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "MCID"); //  "MCID"
    createCell(wb, hrow0, (short) 6, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, ""); //  "FREQ_KIND"
    createCell(wb, hrow0, (short) 7, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "MIMO"); //   "MIMO_TYPE"
    createCell(wb, hrow0, (short) 8, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "(Mbps)"); //   "THROUGHPUT"
    createCell(wb, hrow0, (short) 9, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "CQI ?"); //   "CQI_AVERAGE"
    createCell(wb, hrow0, (short) 10, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "CQI0 (%)"); //   "RI_RATE"
    createCell(wb, hrow0, (short) 11, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "RI2 (%)"); //
    createCell(wb, hrow0, (short) 12, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "DL PRB(%)"); //
    createCell(wb, hrow0, (short) 13, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "MCS?"); //SS
    createCell(wb, hrow0, (short) 14, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "RSSI"); //SS
    createCell(wb, hrow0, (short) 15, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "RSSI"); //SS
    createCell(wb, hrow0, (short) 16, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "MIMO "); //    ELG
    createCell(wb, hrow0, (short) 17, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "DL Throughput(kbps)");//    ELG
    createCell(wb, hrow0, (short) 18, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER,
            "License  "); //    ELG
    createCell(wb, hrow0, (short) 19, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "OL MIMO (%)"); //NSN
    createCell(wb, hrow0, (short) 20, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "MCS0 (%)"); //NSN
    createCell(wb, hrow0, (short) 21, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "RSSI"); //NSN
    createCell(wb, hrow0, (short) 22, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "RSSI"); //NSN
    createCell(wb, hrow0, (short) 23, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "RSSI"); //NSN
    createCell(wb, hrow0, (short) 24, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "RSSI"); //NSN
    createCell(wb, hrow0, (short) 25, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "??");
    createCell(wb, hrow0, (short) 26, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "??");
    createCell(wb, hrow0, (short) 27, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "??");
    createCell(wb, hrow0, (short) 28, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "??");
    createCell(wb, hrow0, (short) 29, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "??");
    createCell(wb, hrow0, (short) 30, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "??");
    createCell(wb, hrow0, (short) 31, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "??");
    createCell(wb, hrow0, (short) 32, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "??");
    createCell(wb, hrow0, (short) 33, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "HD Voice");
    createCell(wb, hrow0, (short) 34, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "HD Voice");
    createCell(wb, hrow0, (short) 35, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "HD Voice");
    createCell(wb, hrow0, (short) 36, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "HD Voice");
    createCell(wb, hrow0, (short) 37, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "??");
    createCell(wb, hrow0, (short) 38, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "??");
    createCell(wb, hrow0, (short) 39, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "??");
    createCell(wb, hrow0, (short) 40, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "??");
    createCell(wb, hrow0, (short) 41, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "");
    createCell(wb, hrow0, (short) 42, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "");

    Row hrow1 = sheet.createRow((short) 1);
    hrow1.setHeightInPoints(20);
    createCell(wb, hrow1, (short) 0, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "");
    createCell(wb, hrow1, (short) 1, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, ""); // "MB_TIME"
    createCell(wb, hrow1, (short) 2, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "DU"); // "BTS_NM"
    createCell(wb, hrow1, (short) 3, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "CELL ID"); // "CELL_ID"
    createCell(wb, hrow1, (short) 4, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "CELL "); //  "CELL_NM"
    createCell(wb, hrow1, (short) 5, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "MCID"); //  "MCID"
    createCell(wb, hrow1, (short) 6, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, ""); //  "FREQ_KIND"
    createCell(wb, hrow1, (short) 7, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "MIMO"); //  "MIMO_TYPE"
    createCell(wb, hrow1, (short) 8, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "(Mbps)"); //   "THROUGHPUT"
    createCell(wb, hrow1, (short) 9, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "CQI ?"); //   "CQI_AVERAGE"
    createCell(wb, hrow1, (short) 10, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "CQI0 (%)"); //   "RI_RATE"
    createCell(wb, hrow1, (short) 11, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "RI2 (%)"); //
    createCell(wb, hrow1, (short) 12, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "DL PRB(%)"); //
    createCell(wb, hrow1, (short) 13, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "MCS?"); //SS
    createCell(wb, hrow1, (short) 14, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, ""); //SS
    createCell(wb, hrow1, (short) 15, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, ""); //SS
    createCell(wb, hrow1, (short) 16, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "MIMO "); //    ELG
    createCell(wb, hrow1, (short) 17, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "DL Throughput(kbps)");//    ELG
    createCell(wb, hrow1, (short) 18, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER,
            "License  "); //    ELG
    createCell(wb, hrow1, (short) 19, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "OL MIMO (%)"); //NSN
    createCell(wb, hrow1, (short) 20, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "MCS0 (%)"); //NSN
    createCell(wb, hrow1, (short) 21, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "PUCCH"); //NSN
    createCell(wb, hrow1, (short) 22, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "PUCCH"); //NSN
    createCell(wb, hrow1, (short) 23, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "PUSCH"); //NSN
    createCell(wb, hrow1, (short) 24, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "PUSCH"); //NSN
    createCell(wb, hrow1, (short) 25, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "(MB)");
    createCell(wb, hrow1, (short) 26, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "PRB(%)");
    createCell(wb, hrow1, (short) 27, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "DPR(%)");
    createCell(wb, hrow1, (short) 28, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "??(Erl)");
    createCell(wb, hrow1, (short) 29, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "?");
    createCell(wb, hrow1, (short) 30, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "?(%)");
    createCell(wb, hrow1, (short) 31, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "CD(%)");
    createCell(wb, hrow1, (short) 32, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "FA(%)");
    createCell(wb, hrow1, (short) 33, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "(MB)");
    createCell(wb, hrow1, (short) 34, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "PRB (%)");
    createCell(wb, hrow1, (short) 35, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "?");
    createCell(wb, hrow1, (short) 36, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "?");
    createCell(wb, hrow1, (short) 37, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, " (MB)");
    createCell(wb, hrow1, (short) 38, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "PRB(%)");
    createCell(wb, hrow1, (short) 39, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "?");
    createCell(wb, hrow1, (short) 40, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "?");
    createCell(wb, hrow1, (short) 41, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "");
    createCell(wb, hrow1, (short) 42, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "");

    Row hrow2 = sheet.createRow((short) 2);
    hrow2.setHeightInPoints(20);
    createCell(wb, hrow2, (short) 0, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "");
    createCell(wb, hrow2, (short) 1, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, ""); // "MB_TIME"
    createCell(wb, hrow2, (short) 2, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "DU"); // "BTS_NM"
    createCell(wb, hrow2, (short) 3, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "CELL ID"); // "CELL_ID"
    createCell(wb, hrow2, (short) 4, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "CELL "); //  "CELL_NM"
    createCell(wb, hrow2, (short) 5, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "MCID"); //  "MCID"
    createCell(wb, hrow2, (short) 6, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, ""); //  "FREQ_KIND"
    createCell(wb, hrow2, (short) 7, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "MIMO"); //  "MIMO_TYPE"
    createCell(wb, hrow2, (short) 8, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "(Mbps)"); //   "THROUGHPUT"
    createCell(wb, hrow2, (short) 9, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "CQI ?"); //   "CQI_AVERAGE"
    createCell(wb, hrow2, (short) 10, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "CQI0 (%)"); //   "RI_RATE"
    createCell(wb, hrow2, (short) 11, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "RI2 (%)");
    createCell(wb, hrow2, (short) 12, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "DL PRB(%)");
    createCell(wb, hrow2, (short) 13, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "MCS?"); //SS
    createCell(wb, hrow2, (short) 14, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "RSSI "); //SS
    createCell(wb, hrow2, (short) 15, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "RSSI "); //SS
    createCell(wb, hrow2, (short) 16, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "MIMO "); //    ELG
    createCell(wb, hrow2, (short) 17, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "DL Throughput(kbps)");//    ELG
    createCell(wb, hrow2, (short) 18, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER,
            "License  "); //    ELG
    createCell(wb, hrow2, (short) 19, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "OL MIMO (%)"); //NSN
    createCell(wb, hrow2, (short) 20, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "MCS0 (%)"); //NSN
    createCell(wb, hrow2, (short) 21, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, ""); //NSN
    createCell(wb, hrow2, (short) 22, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, ""); //NSN
    createCell(wb, hrow2, (short) 23, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, ""); //NSN
    createCell(wb, hrow2, (short) 24, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, ""); //NSN
    createCell(wb, hrow2, (short) 25, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "(MB)");
    createCell(wb, hrow2, (short) 26, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "PRB(%)");
    createCell(wb, hrow2, (short) 27, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "DPR(%)");
    createCell(wb, hrow2, (short) 28, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "??(Erl)");
    createCell(wb, hrow2, (short) 29, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "?");
    createCell(wb, hrow2, (short) 30, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "?(%)");
    createCell(wb, hrow2, (short) 31, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "CD(%)");
    createCell(wb, hrow2, (short) 32, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "FA(%)");
    createCell(wb, hrow2, (short) 33, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "(MB)");
    createCell(wb, hrow2, (short) 34, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "PRB (%)");
    createCell(wb, hrow2, (short) 35, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "?");
    createCell(wb, hrow2, (short) 36, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "?");
    createCell(wb, hrow2, (short) 37, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, " (MB)");
    createCell(wb, hrow2, (short) 38, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "PRB(%)");
    createCell(wb, hrow2, (short) 39, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "?");
    createCell(wb, hrow2, (short) 40, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "?");
    createCell(wb, hrow2, (short) 41, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "");
    createCell(wb, hrow2, (short) 42, CellStyle.ALIGN_CENTER, CellStyle.VERTICAL_CENTER, "");

    sheet.addMergedRegion(new CellRangeAddress(0, 2, 0, 0)); // ("");
    sheet.addMergedRegion(new CellRangeAddress(0, 2, 1, 1)); // ("");
    sheet.addMergedRegion(new CellRangeAddress(0, 2, 2, 2)); // ("DU");
    sheet.addMergedRegion(new CellRangeAddress(0, 2, 3, 3)); // ("CELL ID");
    sheet.addMergedRegion(new CellRangeAddress(0, 2, 4, 4)); // ("CELL ");
    sheet.addMergedRegion(new CellRangeAddress(0, 2, 5, 5)); // ("MCID");
    sheet.addMergedRegion(new CellRangeAddress(0, 2, 6, 6)); // ("");
    sheet.addMergedRegion(new CellRangeAddress(0, 2, 7, 7)); // ("MIMO ");
    sheet.addMergedRegion(new CellRangeAddress(0, 2, 8, 8)); // ("(Mbps)");
    sheet.addMergedRegion(new CellRangeAddress(0, 2, 9, 9)); // ("CQI ?");
    sheet.addMergedRegion(new CellRangeAddress(0, 2, 10, 10)); // ("CQI0 (%)");
    sheet.addMergedRegion(new CellRangeAddress(0, 2, 11, 11)); // ("RI2 (%)");
    sheet.addMergedRegion(new CellRangeAddress(0, 2, 12, 12)); // ("DL PRB(%)");
    sheet.addMergedRegion(new CellRangeAddress(0, 2, 13, 13)); // ("MCS?");

    sheet.addMergedRegion(new CellRangeAddress(0, 0, 14, 15)); // ("RSSI");    //ss
    sheet.addMergedRegion(new CellRangeAddress(1, 2, 14, 14)); // ("");  //ss
    sheet.addMergedRegion(new CellRangeAddress(1, 2, 15, 15)); // ("");  //ss

    sheet.addMergedRegion(new CellRangeAddress(0, 2, 16, 16)); // ("MIMO ");            //    ELG
    sheet.addMergedRegion(new CellRangeAddress(0, 2, 17, 17)); // ("DL Throughput(kbps)");//    ELG
    sheet.addMergedRegion(new CellRangeAddress(0, 2, 18, 18)); // ("License  "); //    ELG
    sheet.addMergedRegion(new CellRangeAddress(0, 2, 19, 19)); // ("OL MIMO (%)");      //NSN
    sheet.addMergedRegion(new CellRangeAddress(0, 2, 20, 20)); // ("MCS0 (%)");         //NSN

    sheet.addMergedRegion(new CellRangeAddress(0, 0, 21, 24)); //  RSSI                     //NSN  
    sheet.addMergedRegion(new CellRangeAddress(1, 1, 21, 22)); //  RSSI - PUCCH             //NSN  ?
    sheet.addMergedRegion(new CellRangeAddress(1, 1, 23, 24)); //  RSSI - PUSCH             //NSN  ?
    // 4 

    sheet.addMergedRegion(new CellRangeAddress(0, 0, 25, 32)); //??
    sheet.addMergedRegion(new CellRangeAddress(1, 2, 25, 25)); // ?? - ("(MB)");
    sheet.addMergedRegion(new CellRangeAddress(1, 2, 26, 26)); // ?? - ("PRB(%)");
    sheet.addMergedRegion(new CellRangeAddress(1, 2, 27, 27)); // ?? - ("DPR(%)");
    sheet.addMergedRegion(new CellRangeAddress(1, 2, 28, 28)); // ?? - ("??(Erl)");
    sheet.addMergedRegion(new CellRangeAddress(1, 2, 29, 29)); // ?? - ("?");
    sheet.addMergedRegion(new CellRangeAddress(1, 2, 30, 30)); // ?? - ("?(%)");
    sheet.addMergedRegion(new CellRangeAddress(1, 2, 31, 31)); // ?? - ("CD(%)");
    sheet.addMergedRegion(new CellRangeAddress(1, 2, 32, 32)); // ?? - ("FA(%)");

    sheet.addMergedRegion(new CellRangeAddress(0, 0, 33, 36)); // HD Voice
    sheet.addMergedRegion(new CellRangeAddress(1, 2, 33, 33)); // HD Voice - ("(MB)");
    sheet.addMergedRegion(new CellRangeAddress(1, 2, 34, 34)); // HD Voice - ("PRB (%)");
    sheet.addMergedRegion(new CellRangeAddress(1, 2, 35, 35)); // HD Voice - ("?");
    sheet.addMergedRegion(new CellRangeAddress(1, 2, 36, 36)); // HD Voice - ("?");

    sheet.addMergedRegion(new CellRangeAddress(0, 0, 37, 40)); //??
    sheet.addMergedRegion(new CellRangeAddress(1, 2, 37, 37)); //
    sheet.addMergedRegion(new CellRangeAddress(1, 2, 38, 38)); //
    sheet.addMergedRegion(new CellRangeAddress(1, 2, 39, 39)); //
    sheet.addMergedRegion(new CellRangeAddress(1, 2, 40, 40)); //

    sheet.addMergedRegion(new CellRangeAddress(0, 0, 41, 42)); //
    sheet.addMergedRegion(new CellRangeAddress(1, 2, 41, 41)); //
    sheet.addMergedRegion(new CellRangeAddress(1, 2, 42, 42)); //

    String _MFC_CD = "MFC00001";
    ArrayList list01 = (ArrayList) map.get("rows");
    Iterator iterator = (Iterator) list01.iterator();
    short i = 3;
    while (iterator.hasNext()) {

        StringMap jrow = (StringMap) iterator.next();

        if (i == 3) {
            _MFC_CD = jrow.containsKey("MFC_CD") ? jrow.get("MFC_CD").toString() : "MFC00001";

            // hieddn  
            if (_MFC_CD.equals("MFC00001")) {
                // ?
                //                sheet.setColumnHidden(13,true);
                //                sheet.setColumnHidden(14,true);
                //                sheet.setColumnHidden(15,true);
                sheet.setColumnHidden(16, true);
                sheet.setColumnHidden(17, true);
                sheet.setColumnHidden(18, true);
                sheet.setColumnHidden(19, true);
                sheet.setColumnHidden(20, true);
                sheet.setColumnHidden(21, true);
                sheet.setColumnHidden(22, true);
                sheet.setColumnHidden(23, true);
                sheet.setColumnHidden(24, true);
            } else if (_MFC_CD.equals("MFC00002")) {
                sheet.setColumnHidden(13, true);
                sheet.setColumnHidden(14, true);
                sheet.setColumnHidden(15, true);
                //                sheet.setColumnHidden(16,true);
                //                sheet.setColumnHidden(17,true);
                //                sheet.setColumnHidden(18,true);
                sheet.setColumnHidden(19, true);
                sheet.setColumnHidden(20, true);
                //                        sheet.setColumnHidden(21,true);
                //                        sheet.setColumnHidden(22,true);
                //                        sheet.setColumnHidden(23,true);
                //                        sheet.setColumnHidden(24,true);
            } else if (_MFC_CD.equals("MFC00014")) {
                sheet.setColumnHidden(13, true);
                sheet.setColumnHidden(14, true);
                sheet.setColumnHidden(15, true);
                sheet.setColumnHidden(16, true);
                sheet.setColumnHidden(17, true);
                sheet.setColumnHidden(18, true);
                //                sheet.setColumnHidden(19,true);
                //                sheet.setColumnHidden(20,true);
                //                sheet.setColumnHidden(21,true);
                //                sheet.setColumnHidden(22,true);
                //                sheet.setColumnHidden(23,true);
                //                sheet.setColumnHidden(24,true);
            }

        }

        //  
        Row row = sheet.createRow((short) i);
        row.setHeightInPoints(20);

        row.createCell(0).setCellValue((String) jrow.get("YMD"));
        row.createCell(1).setCellValue((String) jrow.get("MB_TIME"));
        row.createCell(2).setCellValue((String) jrow.get("BTS_NM"));
        row.createCell(3).setCellValue((String) jrow.get("CELL_ID"));
        row.createCell(4).setCellValue((String) jrow.get("CELL_NM"));
        row.createCell(5).setCellValue((String) jrow.get("MCID"));
        row.createCell(6).setCellValue((String) jrow.get("FREQ_KIND"));
        row.createCell(7).setCellValue(jrow.containsKey("MIMO_TYPE") ? jrow.get("MIMO_TYPE").toString() : "-"); // ");       //   "MIMO_TYPE"       //?

        setCellDoubleIfExistValue(row.createCell(8), jrow, "THROUGHPUT"); // (Mbps)");       //   "THROUGHPUT"
        setCellDoubleIfExistValue(row.createCell(9), jrow, "CQI_AVERAGE"); // CQI ?");         //   "CQI_AVERAGE"
        setCellDoubleIfExistValue(row.createCell(10), jrow, "CQI0_RATE"); // CQI0 (%)");         //   "RI_RATE"
        setCellDoubleIfExistValue(row.createCell(11), jrow, "RI_RATE"); // RI2 (%)");
        setCellDoubleIfExistValue(row.createCell(12), jrow, "DL_PRB_RATE"); // DL PRB(%)");

        /**/
        setCellDoubleIfExistValue(row.createCell(13), jrow, "MCS_AVERAGE"); // MCS?");               //SS
        setCellDoubleIfExistValue(row.createCell(14), jrow, "RSSI"); // RSSI ");          //SS
        setCellDoubleIfExistValue(row.createCell(15), jrow, "R2_RSSI"); // RSSI ");          //SS
        setCellDoubleIfExistValue(row.createCell(16), jrow, "MIMO_RATE"); // MIMO ");             //    ELG
        setCellDoubleIfExistValue(row.createCell(17), jrow, "DL_THROUGHPUT"); // DL Throughput(kbps)");   //    ELG
        setCellDoubleIfExistValue(row.createCell(18), jrow, "LICENSE_FAIL"); // License  ");   //    ELG
        setCellDoubleIfExistValue(row.createCell(19), jrow, "MIMO_RATE"); // OL MIMO (%)");           //ELG + NSN
        setCellDoubleIfExistValue(row.createCell(20), jrow, "MCS_AVERAGE"); // MCS0 (%)");         //ELG + NSN
        setCellDoubleIfExistValue(row.createCell(21), jrow, "PUCCH_AVG"); // RSSI PUCCH ");        //ELG + NSN
        setCellDoubleIfExistValue(row.createCell(22), jrow, "R2_PUCCH_AVG"); // RSSI PUCCH "); //NSN
        setCellDoubleIfExistValue(row.createCell(23), jrow, "PUSCH_AVG"); // RSSI PUSCH ");        //NSN
        setCellDoubleIfExistValue(row.createCell(24), jrow, "R2_PUSCH_AVG"); // RSSI PUSCH "); //NSN

        /**/
        setCellDoubleIfExistValue(row.createCell(25), jrow, "PDCP_DL_MB"); // ?? (MB)");
        setCellDoubleIfExistValue(row.createCell(26), jrow, "PRB_USG_RATE"); // ?? PRB(%)");
        setCellDoubleIfExistValue(row.createCell(27), jrow, "DRB_USG_RATE"); // ?? DPR(%)");
        setCellDoubleIfExistValue(row.createCell(28), jrow, "CON_TIME"); // ?? ??(Erl)");
        setCellDoubleIfExistValue(row.createCell(29), jrow, "TRY_CCNT"); // ?? ?");
        setCellDoubleIfExistValue(row.createCell(30), jrow, "CON_RATE"); // ?? ?(%)");
        setCellDoubleIfExistValue(row.createCell(31), jrow, "CDC_RATE"); // ?? CD(%)");
        setCellDoubleIfExistValue(row.createCell(32), jrow, "DL_FA_USG_RATE"); //?? FA(%)

        setCellDoubleIfExistValue(row.createCell(33), jrow, "VOICE_DL_MB");
        setCellDoubleIfExistValue(row.createCell(34), jrow, "VOICE_DL_PRB"); // HD Voice PRB (%)");
        setCellDoubleIfExistValue(row.createCell(35), jrow, "VOICE_TRY_CCNT"); // HD Voice ?");
        setCellDoubleIfExistValue(row.createCell(36), jrow, "VOICE_TIME"); // HD Voice ?");
        setCellDoubleIfExistValue(row.createCell(37), jrow, "IMAGE_DL_MB"); // ??  (MB)");
        setCellDoubleIfExistValue(row.createCell(38), jrow, "IMAGE_DL_PRB"); // ?? PRB(%)");
        setCellDoubleIfExistValue(row.createCell(39), jrow, "IMAGE_TRY_CCNT"); // ?? ?");
        setCellDoubleIfExistValue(row.createCell(40), jrow, "IMAGE_TIME"); // ?? ?");
        row.createCell(41).setCellValue((String) jrow.get("CHNL_TYPE")); //  ");
        setCellDoubleIfExistValue(row.createCell(42), jrow, "CHNL_COUNT"); //  ");

        i++;

    }

}

From source file:com.skt.adcas.lte.action.DownLinkByNMSStatsAction.java

public void createCellTrafficStatsExcelSheet(Sheet sheet, String searchType, Map<String, Object> map)
        throws Exception {

    this.log.debug("createCellTrafficStatsExcelSheet Start");

    //header ?//w  ww . j av a 2  s  .  c o  m
    log.debug("createCellTrafficStatsExcelSheet : hrow0 start");
    Row hrow0 = sheet.createRow((short) 0);
    hrow0.setHeightInPoints(20);
    int a = 0;

    hrow0.createCell(a++).setCellValue("");
    if (searchType.equalsIgnoreCase("BONBU")) {
        hrow0.createCell(a++).setCellValue("");
    } else if (searchType.equalsIgnoreCase("TEAM")) {
        hrow0.createCell(a++).setCellValue("");
        hrow0.createCell(a++).setCellValue("");
    } else if (searchType.equalsIgnoreCase("PART")) {
        hrow0.createCell(a++).setCellValue("");
        hrow0.createCell(a++).setCellValue("");
        hrow0.createCell(a++).setCellValue("");
    } else if (searchType.equalsIgnoreCase("CITY")) {
        hrow0.createCell(a++).setCellValue("?//");
    } else if (searchType.equalsIgnoreCase("UNI")) {
        hrow0.createCell(a++).setCellValue("?//");
        hrow0.createCell(a++).setCellValue("//");
    }
    hrow0.createCell(a++).setCellValue("");
    hrow0.createCell(a++).setCellValue("(Mbps)"); //"(Mbps) : THROUGHPUT"
    hrow0.createCell(a++).setCellValue("CQI ?"); //"CQI ? : CQI_AVERAGE"
    hrow0.createCell(a++).setCellValue("CQI0 "); //"CQI0  : CQI0_RATE"
    hrow0.createCell(a++).setCellValue("RI2 (%)"); //"RI2 (%) : RI_RATE"
    hrow0.createCell(a++).setCellValue("DL PRB (%)"); //"DL PRB (%) : DL_PRB_RATE"
    hrow0.createCell(a++).setCellValue("MCS ?"); //"MCS ? : MCS_AVERAGE"
    hrow0.createCell(a++).setCellValue("MIMO "); //"MIMO  : MIMO_RATE"
    hrow0.createCell(a++).setCellValue("DL Throughput(Kbps)"); //"DL Throughput(Kbps) : DL_THROUGHPUT"
    hrow0.createCell(a++).setCellValue("License "); //"License  : LICENSE_FAIL"
    hrow0.createCell(a++).setCellValue("OL MIMO (%)"); //"OL MIMO (%) : MIMO_RATE"
    hrow0.createCell(a++).setCellValue("MCS0 (%)"); //"MCS0 (%) : MCS_AVERAGE"
    hrow0.createCell(a++).setCellValue("RSSI"); //"PUCCH- : PUCCH_AVG"
    hrow0.createCell(a++).setCellValue("RSSI"); //"PUCCH- : R2_PUCCH_AVG"
    hrow0.createCell(a++).setCellValue("RSSI"); //"PUSCH- : PUSCH_AVG"
    hrow0.createCell(a++).setCellValue("RSSI"); //"PUSCH- : R2_PUSCH_AVG"
    hrow0.createCell(a++).setCellValue("?? (dBm)"); //"?? (dBm)-(MB) : PDCP_DL_MB"
    hrow0.createCell(a++).setCellValue("?? (dBm)"); //"?? (dBm)-PRB (%) : PRB_USG_RATE"
    hrow0.createCell(a++).setCellValue("?? (dBm)"); //"?? (dBm)-DRB (%) : DRB_USG_RATE"
    hrow0.createCell(a++).setCellValue("?? (dBm)"); //"?? (dBm)-?? : CON_TIME"
    hrow0.createCell(a++).setCellValue("?? (dBm)"); //"?? (dBm)-? : TRY_CCNT"
    hrow0.createCell(a++).setCellValue("?? (dBm)"); //"?? (dBm)-?(%) : CON_RATE"
    hrow0.createCell(a++).setCellValue("?? (dBm)"); //"?? (dBm)-CD(%) : CDC_RATE"
    hrow0.createCell(a++).setCellValue("?? (dBm)"); //"?? (dBm)-FA (%)"
    hrow0.createCell(a++).setCellValue("HD Voice"); //"HD Voice - (MB)"
    hrow0.createCell(a++).setCellValue("HD Voice"); //"HD Voice - PRB (%)"
    hrow0.createCell(a++).setCellValue("HD Voice"); //"HD Voice - ?"
    hrow0.createCell(a++).setCellValue("HD Voice"); //"HD Voice - ?"
    hrow0.createCell(a++).setCellValue("??"); //"?? - (MB)"
    hrow0.createCell(a++).setCellValue("??"); //"?? - PRB (%)"
    hrow0.createCell(a++).setCellValue("??"); //"?? - ?"
    hrow0.createCell(a++).setCellValue("??"); //"?? - ?"
    //        hrow0.createCell(a++).setCellValue("");               //""
    //        hrow0.createCell(a++).setCellValue("");               //""

    log.debug("createCellTrafficStatsExcelSheet : hrow0 end");
    log.debug("createCellTrafficStatsExcelSheet : hrow1 start");
    Row hrow1 = sheet.createRow((short) 1);
    hrow1.setHeightInPoints(20);
    int b = 0;
    hrow1.createCell(b++).setCellValue(""); //
    if (searchType.equalsIgnoreCase("BONBU") || searchType.equalsIgnoreCase("CITY")) {
        hrow1.createCell(b++).setCellValue("");
    } else if (searchType.equalsIgnoreCase("TEAM") || searchType.equalsIgnoreCase("UNI")
            || searchType.equalsIgnoreCase("EMS")) {
        hrow1.createCell(b++).setCellValue("");
        hrow1.createCell(b++).setCellValue("");
    } else if (searchType.equalsIgnoreCase("PART")) {
        hrow1.createCell(b++).setCellValue("");
        hrow1.createCell(b++).setCellValue("");
        hrow1.createCell(b++).setCellValue("");
    }
    hrow1.createCell(b++).setCellValue(""); //
    hrow1.createCell(b++).setCellValue(""); //"(Mbps) : THROUGHPUT"
    hrow1.createCell(b++).setCellValue(""); //"CQI ? : CQI_AVERAGE"
    hrow1.createCell(b++).setCellValue(""); //"CQI0  : CQI0_RATE"
    hrow1.createCell(b++).setCellValue(""); //"RI2 (%) : RI_RATE"
    hrow1.createCell(b++).setCellValue(""); //"DL PRB (%) : DL_PRB_RATE"
    hrow1.createCell(b++).setCellValue(""); //"MCS ? : MCS_AVERAGE"
    hrow1.createCell(b++).setCellValue(""); //"MIMO  : MIMO_RATE"
    hrow1.createCell(b++).setCellValue(""); //"DL Throughput(Kbps) : DL_THROUGHPUT"
    hrow1.createCell(b++).setCellValue(""); //"License  : LICENSE_FAIL"
    hrow1.createCell(b++).setCellValue(""); //"OL MIMO (%) : MIMO_RATE"
    hrow1.createCell(b++).setCellValue(""); //"MCS0 (%) : MCS_AVERAGE"
    hrow1.createCell(b++).setCellValue("PUCCH"); //"PUCCH- : PUCCH_AVG"
    hrow1.createCell(b++).setCellValue("PUCCH"); //"PUCCH- : R2_PUCCH_AVG"
    hrow1.createCell(b++).setCellValue("PUSCH"); //"PUSCH- : PUSCH_AVG"
    hrow1.createCell(b++).setCellValue("PUSCH"); //"PUSCH- : R2_PUSCH_AVG"
    hrow1.createCell(b++).setCellValue("(MB)"); //"?? (dBm)-(MB) : PDCP_DL_MB"
    hrow1.createCell(b++).setCellValue("PRB (%)"); //"?? (dBm)-PRB (%) : PRB_USG_RATE"
    hrow1.createCell(b++).setCellValue("DRB (%)"); //"?? (dBm)-DRB (%) : DRB_USG_RATE"
    hrow1.createCell(b++).setCellValue("??"); //"?? (dBm)-?? : CON_TIME"
    hrow1.createCell(b++).setCellValue("?"); //"?? (dBm)-? : TRY_CCNT"
    hrow1.createCell(b++).setCellValue("?(%)"); //"?? (dBm)-?(%) : CON_RATE"
    hrow1.createCell(b++).setCellValue("CD(%)"); //"?? (dBm)-CD(%) : CDC_RATE"
    hrow1.createCell(b++).setCellValue("FA (%)"); //"?? (dBm)-FA (%)"
    hrow1.createCell(b++).setCellValue("(MB)"); //"HD Voice - (MB)"
    hrow1.createCell(b++).setCellValue("PRB (%)"); //"HD Voice - PRB (%)"
    hrow1.createCell(b++).setCellValue("?"); //"HD Voice - ?"
    hrow1.createCell(b++).setCellValue("?"); //"HD Voice - ?"
    hrow1.createCell(b++).setCellValue("(MB)"); //"?? - (MB)"
    hrow1.createCell(b++).setCellValue("PRB (%)"); //"?? - PRB (%)"
    hrow1.createCell(b++).setCellValue("?"); //"?? - ?"
    hrow1.createCell(b++).setCellValue("?"); //"?? - ?"
    //        hrow1.createCell(b++).setCellValue("");           //"-"
    //        hrow1.createCell(b++).setCellValue("");           //"-"

    log.debug("createCellTrafficStatsExcelSheet : hrow1 end");

    log.debug("createCellTrafficStatsExcelSheet : hrow2 start");
    Row hrow2 = sheet.createRow((short) 2);
    hrow2.setHeightInPoints(20);
    int c = 0;
    hrow2.createCell(c++).setCellValue(""); //
    if (searchType.equalsIgnoreCase("BONBU") || searchType.equalsIgnoreCase("CITY")) {
        hrow2.createCell(c++).setCellValue("");
    } else if (searchType.equalsIgnoreCase("TEAM") || searchType.equalsIgnoreCase("UNI")
            || searchType.equalsIgnoreCase("EMS")) {
        hrow2.createCell(c++).setCellValue("");
        hrow2.createCell(c++).setCellValue("");
    } else if (searchType.equalsIgnoreCase("PART")) {
        hrow2.createCell(c++).setCellValue("");
        hrow2.createCell(c++).setCellValue("");
        hrow2.createCell(c++).setCellValue("");
    }
    hrow2.createCell(c++).setCellValue(""); //
    hrow2.createCell(c++).setCellValue(""); //"(Mbps) : THROUGHPUT"
    hrow2.createCell(c++).setCellValue(""); //"CQI ? : CQI_AVERAGE"
    hrow2.createCell(c++).setCellValue(""); //"CQI0  : CQI0_RATE"
    hrow2.createCell(c++).setCellValue(""); //"RI2 (%) : RI_RATE"
    hrow2.createCell(c++).setCellValue(""); //"DL PRB (%) : DL_PRB_RATE"
    hrow2.createCell(c++).setCellValue(""); //"MCS ? : MCS_AVERAGE"
    hrow2.createCell(c++).setCellValue(""); //"MIMO  : MIMO_RATE"
    hrow2.createCell(c++).setCellValue(""); //"DL Throughput(Kbps) : DL_THROUGHPUT"
    hrow2.createCell(c++).setCellValue(""); //"License  : LICENSE_FAIL"
    hrow2.createCell(c++).setCellValue(""); //"OL MIMO (%) : MIMO_RATE"
    hrow2.createCell(c++).setCellValue(""); //"MCS0 (%) : MCS_AVERAGE"
    hrow2.createCell(c++).setCellValue(""); //"PUCCH- : PUCCH_AVG"
    hrow2.createCell(c++).setCellValue(""); //"PUCCH- : R2_PUCCH_AVG"
    hrow2.createCell(c++).setCellValue(""); //"PUSCH- : PUSCH_AVG"
    hrow2.createCell(c++).setCellValue(""); //"PUSCH- : R2_PUSCH_AVG"
    hrow2.createCell(c++).setCellValue(""); //"?? (dBm)-(MB) : PDCP_DL_MB"
    hrow2.createCell(c++).setCellValue(""); //"?? (dBm)-PRB (%) : PRB_USG_RATE"
    hrow2.createCell(c++).setCellValue(""); //"?? (dBm)-DRB (%) : DRB_USG_RATE"
    hrow2.createCell(c++).setCellValue(""); //"?? (dBm)-?? : CON_TIME"
    hrow2.createCell(c++).setCellValue(""); //"?? (dBm)-? : TRY_CCNT"
    hrow2.createCell(c++).setCellValue(""); //"?? (dBm)-?(%) : CON_RATE"
    hrow2.createCell(c++).setCellValue(""); //"?? (dBm)-CD(%) : CDC_RATE"
    hrow2.createCell(c++).setCellValue(""); //"?? (dBm)-FA (%)"
    hrow2.createCell(c++).setCellValue(""); //"HD Voice - (MB)"
    hrow2.createCell(c++).setCellValue(""); //"HD Voice - PRB (%)"
    hrow2.createCell(c++).setCellValue(""); //"HD Voice - ?"
    hrow2.createCell(c++).setCellValue(""); //"HD Voice - ?"
    hrow2.createCell(c++).setCellValue(""); //"?? - (MB)"
    hrow2.createCell(c++).setCellValue(""); //"?? - PRB (%)"
    hrow2.createCell(c++).setCellValue(""); //"?? - ?"
    hrow2.createCell(c++).setCellValue(""); //"?? - ?"
    //        hrow2.createCell(c++).setCellValue("");               //"-"
    //        hrow2.createCell(c++).setCellValue("");               //"-"

    int d = 0;
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // ""
    if (searchType.equalsIgnoreCase("BONBU") || searchType.equalsIgnoreCase("CITY")) {
        sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++));
    } else if (searchType.equalsIgnoreCase("TEAM") || searchType.equalsIgnoreCase("UNI")
            || searchType.equalsIgnoreCase("EMS")) {
        sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++));
        sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++));
    } else if (searchType.equalsIgnoreCase("PART")) {
        sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++));
        sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++));
        sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++));
    }
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); //
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); //"(Mbps) : THROUGHPUT"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); //"CQI ? : CQI_AVERAGE"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); //"CQI0  : CQI0_RATE"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); //"RI2 (%) : RI_RATE"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); //"DL PRB (%) : DL_PRB_RATE"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); //"MCS ? : MCS_AVERAGE"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); //"MIMO  : MIMO_RATE"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); //"DL Throughput(Kbps) : DL_THROUGHPUT"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); //"License  : LICENSE_FAIL"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); //"OL MIMO (%) : MIMO_RATE"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); //"MCS0 (%) : MCS_AVERAGE"
    sheet.addMergedRegion(new CellRangeAddress(0, 0, d, d + 3)); //"RSSI"
    sheet.addMergedRegion(new CellRangeAddress(1, 1, d, d + 1)); //"Total(PUCCH)"
    sheet.addMergedRegion(new CellRangeAddress(1, 1, d + 2, d + 3)); // "Total(PUSCH)"
    d += 4;
    sheet.addMergedRegion(new CellRangeAddress(0, 0, d, d + 7)); //"?? (dBm)"
    sheet.addMergedRegion(new CellRangeAddress(1, 2, d, d)); //"?? (dBm)-(MB) : PDCP_DL_MB"
    sheet.addMergedRegion(new CellRangeAddress(1, 2, d + 1, d + 1)); //"?? (dBm)-PRB (%) : PRB_USG_RATE"
    sheet.addMergedRegion(new CellRangeAddress(1, 2, d + 2, d + 2)); //"?? (dBm)-DRB (%) : DRB_USG_RATE"
    sheet.addMergedRegion(new CellRangeAddress(1, 2, d + 3, d + 3)); //"?? (dBm)-?? : CON_TIME"
    sheet.addMergedRegion(new CellRangeAddress(1, 2, d + 4, d + 4)); //"?? (dBm)-? : TRY_CCNT"
    sheet.addMergedRegion(new CellRangeAddress(1, 2, d + 5, d + 5)); //"?? (dBm)-?(%) : CON_RATE"
    sheet.addMergedRegion(new CellRangeAddress(1, 2, d + 6, d + 6)); //"?? (dBm)-CD(%) : CDC_RATE"
    sheet.addMergedRegion(new CellRangeAddress(1, 2, d + 7, d + 7)); //"?? (dBm)-FA (%)"
    d += 8;
    sheet.addMergedRegion(new CellRangeAddress(0, 0, d, d + 3)); //"HD Voice"
    sheet.addMergedRegion(new CellRangeAddress(1, 2, d, d)); //"HD Voice - (MB)"
    sheet.addMergedRegion(new CellRangeAddress(1, 2, d + 1, d + 1)); //"HD Voice - PRB (%)"
    sheet.addMergedRegion(new CellRangeAddress(1, 2, d + 2, d + 2)); //"HD Voice - ?"
    sheet.addMergedRegion(new CellRangeAddress(1, 2, d + 3, d + 3)); //"HD Voice - ?"
    d += 4;
    sheet.addMergedRegion(new CellRangeAddress(0, 0, d, d + 3)); //"??"
    sheet.addMergedRegion(new CellRangeAddress(1, 2, d, d)); //"?? - (MB)"
    sheet.addMergedRegion(new CellRangeAddress(1, 2, d + 1, d + 1)); //"?? - PRB (%)"
    sheet.addMergedRegion(new CellRangeAddress(1, 2, d + 2, d + 2)); //"?? - ?"
    sheet.addMergedRegion(new CellRangeAddress(1, 2, d + 3, d + 3)); //"?? - ?"
    d += 4;
    sheet.addMergedRegion(new CellRangeAddress(0, 0, d, d + 1)); // ""
    //        sheet.addMergedRegion(new CellRangeAddress(1,2,d,d));     // "-"
    //        sheet.addMergedRegion(new CellRangeAddress(1,2,d+1,d+1)); // "-"

    log.debug("createCellTrafficStatsExcelSheet : hrow2 end");

    log.debug("createCellTrafficStatsExcelSheet : row start");
    ArrayList list01 = (ArrayList) map.get("rows");
    Iterator iterator = (Iterator) list01.iterator();
    short i = 3;
    while (iterator.hasNext()) {
        StringMap jrow = (StringMap) iterator.next();
        //  
        Row row = sheet.createRow((short) i);
        row.setHeightInPoints(20);
        int e = 0;
        row.createCell(e++).setCellValue((String) jrow.get("YMD"));
        if (searchType.equalsIgnoreCase("BONBU") || searchType.equalsIgnoreCase("CITY")) {
            row.createCell(e++).setCellValue((String) jrow.get("TITLE01"));
        } else if (searchType.equalsIgnoreCase("TEAM") || searchType.equalsIgnoreCase("UNI")
                || searchType.equalsIgnoreCase("EMS")) {
            row.createCell(e++).setCellValue((String) jrow.get("TITLE01"));
            row.createCell(e++).setCellValue((String) jrow.get("TITLE02"));
        } else if (searchType.equalsIgnoreCase("PART")) {
            row.createCell(e++).setCellValue((String) jrow.get("TITLE01"));
            row.createCell(e++).setCellValue((String) jrow.get("TITLE02"));
            row.createCell(e++).setCellValue((String) jrow.get("TITLE03"));
        }
        row.createCell(e++).setCellValue((String) jrow.get("FREQ_KIND"));

        setCellDoubleIfExistValue(row.createCell(e++), jrow, "THROUGHPUT");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "CQI_AVERAGE");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "CQI0_RATE");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "RI_RATE");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "DL_PRB_RATE");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "MCS_AVERAGE");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "MIMO_RATE");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "DL_THROUGHPUT");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "LICENSE_FAIL");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "MIMO_RATE");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "MCS_AVERAGE");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "PUCCH_AVG");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "R2_PUCCH_AVG");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "PUSCH_AVG");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "R2_PUSCH_AVG");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "PDCP_DL_MB");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "PRB_USG_RATE");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "DRB_USG_RATE");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "CON_TIME");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "TRY_CCNT");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "CON_RATE");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "CDC_RATE");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "DL_FA_USG_RATE");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "VOICE_DL_MB");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "VOICE_DL_PRB");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "VOICE_TRY_CCNT");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "VOICE_TIME");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "IMAGE_DL_MB");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "IMAGE_DL_PRB");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "IMAGE_TRY_CCNT");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "IMAGE_TIME");
        //            row.createCell(e++).setCellValue("n/a");
        //            row.createCell(e++).setCellValue("n/a");
        i++;
    }

    log.debug("createCellTrafficStatsExcelSheet : row end");

    this.log.debug("createCellTrafficStatsExcelSheet End");

}

From source file:com.skt.adcas.lte.action.DownLinkByQMSAction.java

public void createCellTrafficExcelSheet(Sheet sheet, Map<String, Object> map) throws Exception {

    this.log.debug("createCellTrafficExcelSheet Start");

    Row hrow0 = sheet.createRow((short) 0);
    hrow0.setHeightInPoints(20);//from  w  ww . ja v a2s  .  c om
    int a = 0;
    hrow0.createCell(a++).setCellValue(""); // "YMD"
    hrow0.createCell(a++).setCellValue("DU"); // "BTS_NM"
    hrow0.createCell(a++).setCellValue("CELL ID"); // "CELL_ID"
    hrow0.createCell(a++).setCellValue("CELL "); // "CELL_NM"
    hrow0.createCell(a++).setCellValue(""); // "FREQ_KIND"
    hrow0.createCell(a++).setCellValue("DL Throughput(Mbps)"); // "DL_TPUT"
    hrow0.createCell(a++).setCellValue("UL Throughput(Mbps)"); // "UL_TPUT"
    hrow0.createCell(a++).setCellValue("CQI ?"); // "CQI_AVERAGE"
    hrow0.createCell(a++).setCellValue("RI2 "); // "RI_RANK_INDEX
    hrow0.createCell(a++).setCellValue("MCS ?"); // "MCS_AVERAGE"
    hrow0.createCell(a++).setCellValue("RSRP ?"); // "RSRP_AVERAGE
    hrow0.createCell(a++).setCellValue("RSSI ?"); // "RSSI_AVERAGE"
    hrow0.createCell(a++).setCellValue("SINR ?"); // "SINR_AVERAGE"
    hrow0.createCell(a++).setCellValue("RSRQ ?"); // "RSRQ_AVERAGE"
    hrow0.createCell(a++).setCellValue("PUCCH Tx ?"); // "TXPW_PUCCH"
    hrow0.createCell(a++).setCellValue("CQI0 "); // "CQI0_RATE"
    hrow0.createCell(a++).setCellValue("DL PRB "); // "DL_PRB_RATE"
    hrow0.createCell(a++).setCellValue("RSSI"); // "RSSI0_PUCCH"
    hrow0.createCell(a++).setCellValue("RSSI"); // "RSSI1_PUCCH"
    hrow0.createCell(a++).setCellValue("RSSI"); // "RSSI0_PUSCH"
    hrow0.createCell(a++).setCellValue("RSSI"); // "RSSI1_PUSCH"
    hrow0.createCell(a++).setCellValue("License  "); // "LICENSE_FAIL"
    //        hrow0.createCell(a++).setCellValue("");               // ""
    //        hrow0.createCell(a++).setCellValue("");               // ""

    Row hrow1 = sheet.createRow((short) 1);
    hrow1.setHeightInPoints(20);
    int b = 0;
    hrow1.createCell(b++).setCellValue(""); // "YMD"
    hrow1.createCell(b++).setCellValue(""); // "BTS_NM"
    hrow1.createCell(b++).setCellValue(""); // "CELL_ID"
    hrow1.createCell(b++).setCellValue(""); // "CELL_NM"
    hrow1.createCell(b++).setCellValue(""); // "FREQ_KIND"
    hrow1.createCell(b++).setCellValue(""); // "DL_TPUT"
    hrow1.createCell(b++).setCellValue(""); // "UL_TPUT"
    hrow1.createCell(b++).setCellValue(""); // "CQI_AVERAGE"
    hrow1.createCell(b++).setCellValue(""); // "RI_RANK_INDEX
    hrow1.createCell(b++).setCellValue(""); // "MCS_AVERAGE"
    hrow1.createCell(b++).setCellValue(""); // "RSRP_AVERAGE
    hrow1.createCell(b++).setCellValue(""); // "RSSI_AVERAGE"
    hrow1.createCell(b++).setCellValue(""); // "SINR_AVERAGE"
    hrow1.createCell(b++).setCellValue(""); // "RSRQ_AVERAGE"
    hrow1.createCell(b++).setCellValue(""); // "TXPW_PUCCH"
    hrow1.createCell(b++).setCellValue(""); // "CQI0_RATE"
    hrow1.createCell(b++).setCellValue(""); // "DL_PRB_RATE"
    hrow1.createCell(b++).setCellValue("Total(PUCCH)"); // "RSSI0_PUCCH"
    hrow1.createCell(b++).setCellValue("Total(PUCCH)"); // "RSSI1_PUCCH"
    hrow1.createCell(b++).setCellValue("Total(PUSCH)"); // "RSSI0_PUSCH"
    hrow1.createCell(b++).setCellValue("Total(PUSCH)"); // "RSSI1_PUSCH"
    hrow1.createCell(b++).setCellValue(""); // "LICENSE_FAIL"
    //        hrow1.createCell(b++).setCellValue("");          // "-"
    //        hrow1.createCell(b++).setCellValue("");          // "-"

    Row hrow2 = sheet.createRow((short) 2);
    hrow2.setHeightInPoints(20);
    int c = 0;
    hrow2.createCell(c++).setCellValue(""); // "YMD"
    hrow2.createCell(c++).setCellValue(""); // "BTS_NM"
    hrow2.createCell(c++).setCellValue(""); // "CELL_ID"
    hrow2.createCell(c++).setCellValue(""); // "CELL_NM"
    hrow2.createCell(c++).setCellValue(""); // "FREQ_KIND"
    hrow2.createCell(c++).setCellValue(""); // "DL_TPUT"
    hrow2.createCell(c++).setCellValue(""); // "UL_TPUT"
    hrow2.createCell(c++).setCellValue(""); // "CQI_AVERAGE"
    hrow2.createCell(c++).setCellValue(""); // "RI_RANK_INDEX
    hrow2.createCell(c++).setCellValue(""); // "MCS_AVERAGE"
    hrow2.createCell(c++).setCellValue(""); // "RSRP_AVERAGE
    hrow2.createCell(c++).setCellValue(""); // "RSSI_AVERAGE"
    hrow2.createCell(c++).setCellValue(""); // "SINR_AVERAGE"
    hrow2.createCell(c++).setCellValue(""); // "RSRQ_AVERAGE"
    hrow2.createCell(c++).setCellValue(""); // "TXPW_PUCCH"
    hrow2.createCell(c++).setCellValue(""); // "CQI0_RATE"
    hrow2.createCell(c++).setCellValue(""); // "DL_PRB_RATE"
    hrow2.createCell(c++).setCellValue(""); // "RSSI0_PUCCH"
    hrow2.createCell(c++).setCellValue(""); // "RSSI1_PUCCH"
    hrow2.createCell(c++).setCellValue(""); // "RSSI0_PUSCH"
    hrow2.createCell(c++).setCellValue(""); // "RSSI1_PUSCH"
    hrow2.createCell(c++).setCellValue(""); // "LICENSE_FAIL"
    //        hrow2.createCell(c++).setCellValue("");       // "-"
    //        hrow2.createCell(c++).setCellValue("");       // "-"

    int d = 0;
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "YMD"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "BTS_NM"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "CELL_ID"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "CELL_NM"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "FREQ_KIND"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "DL_TPUT"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "UL_TPUT"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "CQI_AVERAGE"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "RI_RANK_INDEX
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "MCS_AVERAGE"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "RSRP_AVERAGE
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "RSSI_AVERAGE"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "SINR_AVERAGE"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "RSRQ_AVERAGE"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "TXPW_PUCCH"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "CQI0_RATE"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "DL_PRB_RATE"
    sheet.addMergedRegion(new CellRangeAddress(0, 0, d, d + 3)); // "RSSI"
    sheet.addMergedRegion(new CellRangeAddress(1, 1, d, d + 1)); // "Total(PUCCH)"
    sheet.addMergedRegion(new CellRangeAddress(1, 1, d + 2, d + 3)); // "Total(PUSCH)"
    d += 4;
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "LICENSE_FAIL"
    //        sheet.addMergedRegion(new CellRangeAddress(0,0,d,d+1));   // ""
    //        sheet.addMergedRegion(new CellRangeAddress(1,2,d,d));     // "-"
    //        sheet.addMergedRegion(new CellRangeAddress(1,2,d+1,d+1)); // "-"

    ArrayList list01 = (ArrayList) map.get("rows");
    Iterator iterator = (Iterator) list01.iterator();
    short i = 3;
    while (iterator.hasNext()) {
        StringMap jrow = (StringMap) iterator.next();
        //  
        Row row = sheet.createRow((short) i);
        row.setHeightInPoints(20);
        int e = 0;
        row.createCell(e++).setCellValue((String) jrow.get("YMD"));
        row.createCell(e++).setCellValue((String) jrow.get("BTS_NM"));
        row.createCell(e++).setCellValue((String) jrow.get("CELL_ID"));
        row.createCell(e++).setCellValue((String) jrow.get("CELL_NM"));
        row.createCell(e++).setCellValue((String) jrow.get("FREQ_KIND"));

        setCellDoubleIfExistValue(row.createCell(e++), jrow, "DL_TPUT");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "UL_TPUT");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "CQI_AVERAGE");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "RANK_INDEX");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "MCS_AVERAGE");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "RSRP_AVERAGE");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "RSSI_AVERAGE");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "SINR_AVERAGE");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "RSRQ_AVERAGE");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "TXPW_PUCCH");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "CQI0_RATE");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "DL_PRB_RATE");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "RSSI0_PUCCH");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "RSSI1_PUCCH");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "RSSI0_PUSCH");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "RSSI1_PUSCH");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "LICENSE_FAIL");
        //            row.createCell(e++).setCellValue("n/a");
        //            row.createCell(e++).setCellValue("n/a");
        i++;

    }

    this.log.debug("createCellTrafficExcelSheet End");

}

From source file:com.skt.adcas.lte.action.DownLinkByQMSStatsAction.java

public void createCellTrafficStatsExcelSheet(Sheet sheet, String searchType, Map<String, Object> map)
        throws Exception {

    this.log.debug("createCellTrafficStatsExcelSheet Start");

    //header ?/*from   w  w w  .  j  a v  a2  s . c  o m*/
    log.debug("createCellTrafficStatsExcelSheet : hrow start");

    Row hrow0 = sheet.createRow((short) 0);
    hrow0.setHeightInPoints(20);
    int a = 0;
    hrow0.createCell(a++).setCellValue("");
    if (searchType.equalsIgnoreCase("BONBU")) {
        hrow0.createCell(a++).setCellValue("");
    } else if (searchType.equalsIgnoreCase("TEAM")) {
        hrow0.createCell(a++).setCellValue("");
        hrow0.createCell(a++).setCellValue("");
    } else if (searchType.equalsIgnoreCase("PART")) {
        hrow0.createCell(a++).setCellValue("");
        hrow0.createCell(a++).setCellValue("");
        hrow0.createCell(a++).setCellValue("");
    } else if (searchType.equalsIgnoreCase("CITY")) {
        hrow0.createCell(a++).setCellValue("?//");
    } else if (searchType.equalsIgnoreCase("UNI")) {
        hrow0.createCell(a++).setCellValue("?//");
        hrow0.createCell(a++).setCellValue("//");
    } else if (searchType.equalsIgnoreCase("EMS")) {
        hrow0.createCell(a++).setCellValue("MME GROUP");
        hrow0.createCell(a++).setCellValue("EMS");
    }
    hrow0.createCell(a++).setCellValue(""); // "FREQ_KIND"
    hrow0.createCell(a++).setCellValue("DL Throughput(Mbps)"); // "DL_TPUT"
    hrow0.createCell(a++).setCellValue("UL Throughput(Mbps)"); // "UL_TPUT"
    hrow0.createCell(a++).setCellValue("CQI ?"); // "CQI_AVERAGE"
    hrow0.createCell(a++).setCellValue("RI2 "); // "RI_RANK_INDEX
    hrow0.createCell(a++).setCellValue("MCS ?"); // "MCS_AVERAGE"
    hrow0.createCell(a++).setCellValue("RSRP ?"); // "RSRP_AVERAGE
    hrow0.createCell(a++).setCellValue("RSSI ?"); // "RSSI_AVERAGE"
    hrow0.createCell(a++).setCellValue("SINR ?"); // "SINR_AVERAGE"
    hrow0.createCell(a++).setCellValue("RSRQ ?"); // "RSRQ_AVERAGE"
    hrow0.createCell(a++).setCellValue("PUCCH Tx ?"); // "TXPW_PUCCH"
    hrow0.createCell(a++).setCellValue("CQI0 "); // "CQI0_RATE"
    hrow0.createCell(a++).setCellValue("DL PRB "); // "DL_PRB_RATE"
    hrow0.createCell(a++).setCellValue("RSSI"); // "RSSI0_PUCCH"
    hrow0.createCell(a++).setCellValue("RSSI"); // "RSSI1_PUCCH"
    hrow0.createCell(a++).setCellValue("RSSI"); // "RSSI0_PUSCH"
    hrow0.createCell(a++).setCellValue("RSSI"); // "RSSI1_PUSCH"
    hrow0.createCell(a++).setCellValue("License  "); // "LICENSE_FAIL"
    //        hrow0.createCell(a++).setCellValue("");               // ""
    //        hrow0.createCell(a++).setCellValue("");               // ""

    Row hrow1 = sheet.createRow((short) 1);
    hrow1.setHeightInPoints(20);
    int b = 0;
    hrow1.createCell(b++).setCellValue("");
    if (searchType.equalsIgnoreCase("BONBU")) {
        hrow1.createCell(b++).setCellValue("");
    } else if (searchType.equalsIgnoreCase("TEAM")) {
        hrow1.createCell(b++).setCellValue("");
        hrow1.createCell(b++).setCellValue("");
    } else if (searchType.equalsIgnoreCase("PART")) {
        hrow1.createCell(b++).setCellValue("");
        hrow1.createCell(b++).setCellValue("");
        hrow1.createCell(b++).setCellValue("");
    } else if (searchType.equalsIgnoreCase("CITY")) {
        hrow1.createCell(b++).setCellValue("");
    } else if (searchType.equalsIgnoreCase("UNI")) {
        hrow1.createCell(b++).setCellValue("");
        hrow1.createCell(b++).setCellValue("");
    } else if (searchType.equalsIgnoreCase("EMS")) {
        hrow1.createCell(b++).setCellValue("");
        hrow1.createCell(b++).setCellValue("");
    }
    hrow1.createCell(b++).setCellValue(""); // "FREQ_KIND"
    hrow1.createCell(b++).setCellValue(""); // "DL_TPUT"
    hrow1.createCell(b++).setCellValue(""); // "UL_TPUT"
    hrow1.createCell(b++).setCellValue(""); // "CQI_AVERAGE"
    hrow1.createCell(b++).setCellValue(""); // "RI_RANK_INDEX
    hrow1.createCell(b++).setCellValue(""); // "MCS_AVERAGE"
    hrow1.createCell(b++).setCellValue(""); // "RSRP_AVERAGE
    hrow1.createCell(b++).setCellValue(""); // "RSSI_AVERAGE"
    hrow1.createCell(b++).setCellValue(""); // "SINR_AVERAGE"
    hrow1.createCell(b++).setCellValue(""); // "RSRQ_AVERAGE"
    hrow1.createCell(b++).setCellValue(""); // "TXPW_PUCCH"
    hrow1.createCell(b++).setCellValue(""); // "CQI0_RATE"
    hrow1.createCell(b++).setCellValue(""); // "DL_PRB_RATE"
    hrow1.createCell(b++).setCellValue("Total(PUCCH)"); // "RSSI0_PUCCH"
    hrow1.createCell(b++).setCellValue("Total(PUCCH)"); // "RSSI1_PUCCH"
    hrow1.createCell(b++).setCellValue("Total(PUSCH)"); // "RSSI0_PUSCH"
    hrow1.createCell(b++).setCellValue("Total(PUSCH)"); // "RSSI1_PUSCH"
    hrow1.createCell(b++).setCellValue(""); // "LICENSE_FAIL"
    //        hrow1.createCell(b++).setCellValue("");          // "-"
    //        hrow1.createCell(b++).setCellValue("");          // "-"

    Row hrow2 = sheet.createRow((short) 2);
    hrow2.setHeightInPoints(20);
    int c = 0;
    hrow2.createCell(c++).setCellValue("");
    if (searchType.equalsIgnoreCase("BONBU")) {
        hrow2.createCell(c++).setCellValue("");
    } else if (searchType.equalsIgnoreCase("TEAM")) {
        hrow2.createCell(c++).setCellValue("");
        hrow2.createCell(c++).setCellValue("");
    } else if (searchType.equalsIgnoreCase("PART")) {
        hrow2.createCell(c++).setCellValue("");
        hrow2.createCell(c++).setCellValue("");
        hrow2.createCell(c++).setCellValue("");
    } else if (searchType.equalsIgnoreCase("CITY")) {
        hrow2.createCell(c++).setCellValue("");
    } else if (searchType.equalsIgnoreCase("UNI")) {
        hrow2.createCell(c++).setCellValue("");
        hrow2.createCell(c++).setCellValue("");
    } else if (searchType.equalsIgnoreCase("EMS")) {
        hrow2.createCell(c++).setCellValue("");
        hrow2.createCell(c++).setCellValue("");
    }
    hrow2.createCell(c++).setCellValue(""); // "FREQ_KIND"
    hrow2.createCell(c++).setCellValue(""); // "DL_TPUT"
    hrow2.createCell(c++).setCellValue(""); // "UL_TPUT"
    hrow2.createCell(c++).setCellValue(""); // "CQI_AVERAGE"
    hrow2.createCell(c++).setCellValue(""); // "RI_RANK_INDEX
    hrow2.createCell(c++).setCellValue(""); // "MCS_AVERAGE"
    hrow2.createCell(c++).setCellValue(""); // "RSRP_AVERAGE
    hrow2.createCell(c++).setCellValue(""); // "RSSI_AVERAGE"
    hrow2.createCell(c++).setCellValue(""); // "SINR_AVERAGE"
    hrow2.createCell(c++).setCellValue(""); // "RSRQ_AVERAGE"
    hrow2.createCell(c++).setCellValue(""); // "TXPW_PUCCH"
    hrow2.createCell(c++).setCellValue(""); // "CQI0_RATE"
    hrow2.createCell(c++).setCellValue(""); // "DL_PRB_RATE"
    hrow2.createCell(c++).setCellValue(""); // "RSSI0_PUCCH"
    hrow2.createCell(c++).setCellValue(""); // "RSSI1_PUCCH"
    hrow2.createCell(c++).setCellValue(""); // "RSSI0_PUSCH"
    hrow2.createCell(c++).setCellValue(""); // "RSSI1_PUSCH"
    hrow2.createCell(c++).setCellValue(""); // "LICENSE_FAIL"
    //        hrow2.createCell(c++).setCellValue("");       // "-"
    //        hrow2.createCell(c++).setCellValue("");       // "-"

    int d = 0;
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // ""
    if (searchType.equalsIgnoreCase("BONBU") || searchType.equalsIgnoreCase("CITY")) {
        sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++));
    } else if (searchType.equalsIgnoreCase("TEAM") || searchType.equalsIgnoreCase("UNI")
            || searchType.equalsIgnoreCase("EMS")) {
        sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++));
        sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++));
    } else if (searchType.equalsIgnoreCase("PART")) {
        sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++));
        sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++));
        sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++));
    }
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "FREQ_KIND"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "DL_TPUT"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "UL_TPUT"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "CQI_AVERAGE"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "RI_RANK_INDEX
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "MCS_AVERAGE"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "RSRP_AVERAGE"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "RSSI_AVERAGE"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "SINR_AVERAGE"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "RSRQ_AVERAGE"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "TXPW_PUCCH"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "CQI0_RATE"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "DL_PRB_RATE"
    sheet.addMergedRegion(new CellRangeAddress(0, 0, d, d + 3)); // "RSSI"
    sheet.addMergedRegion(new CellRangeAddress(1, 1, d, d + 1)); // "Total(PUCCH)"
    sheet.addMergedRegion(new CellRangeAddress(1, 1, d + 2, d + 3)); // "Total(PUSCH)"
    d += 4;
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "LICENSE_FAIL"
    //        sheet.addMergedRegion(new CellRangeAddress(0,0,d,d+1));   // ""
    //        sheet.addMergedRegion(new CellRangeAddress(1,2,d,d));     // "-"
    //        sheet.addMergedRegion(new CellRangeAddress(1,2,d+1,d+1)); // "-"

    log.debug("createCellTrafficStatsExcelSheet : hrow end");

    log.debug("createCellTrafficStatsExcelSheet : row start");
    ArrayList list01 = (ArrayList) map.get("rows");
    Iterator iterator = (Iterator) list01.iterator();
    short i = 3;
    while (iterator.hasNext()) {
        StringMap jrow = (StringMap) iterator.next();
        //  
        Row row = sheet.createRow((short) i);
        row.setHeightInPoints(20);
        int e = 0;
        row.createCell(e++).setCellValue((String) jrow.get("YMD"));
        if (searchType.equalsIgnoreCase("BONBU") || searchType.equalsIgnoreCase("CITY")) {
            row.createCell(e++).setCellValue((String) jrow.get("TITLE01"));
        } else if (searchType.equalsIgnoreCase("TEAM") || searchType.equalsIgnoreCase("UNI")
                || searchType.equalsIgnoreCase("EMS")) {
            row.createCell(e++).setCellValue((String) jrow.get("TITLE01"));
            row.createCell(e++).setCellValue((String) jrow.get("TITLE02"));
        } else if (searchType.equalsIgnoreCase("PART")) {
            row.createCell(e++).setCellValue((String) jrow.get("TITLE01"));
            row.createCell(e++).setCellValue((String) jrow.get("TITLE02"));
            row.createCell(e++).setCellValue((String) jrow.get("TITLE03"));
        }
        row.createCell(e++).setCellValue((String) jrow.get("FREQ_KIND"));

        setCellDoubleIfExistValue(row.createCell(e++), jrow, "DL_TPUT");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "UL_TPUT");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "CQI_AVERAGE");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "RANK_INDEX");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "MCS_AVERAGE");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "RSRP_AVERAGE");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "RSSI_AVERAGE");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "SINR_AVERAGE");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "RSRQ_AVERAGE");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "TXPW_PUCCH");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "CQI0_RATE");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "DL_PRB_RATE");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "RSSI0_PUCCH");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "RSSI1_PUCCH");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "RSSI0_PUSCH");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "RSSI1_PUSCH");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "LICENSE_FAIL");
        //            row.createCell(e++).setCellValue("n/a");
        //            row.createCell(e++).setCellValue("n/a");
        i++;
    }

    log.debug("createCellTrafficStatsExcelSheet : row end");

    this.log.debug("createCellTrafficStatsExcelSheet End");

}

From source file:com.skt.adcas.lte.action.DownLinkBySTDAction.java

public void createCellTrafficExcelSheet(Sheet sheet, Map<String, Object> map) throws Exception {

    this.log.debug("createCellTrafficExcelSheet Start");

    Row hrow0 = sheet.createRow((short) 0);
    hrow0.setHeightInPoints(20);//from   ww  w.  j a v a2  s  . c om
    int a = 0;
    hrow0.createCell(a++).setCellValue(""); // "YMD"
    hrow0.createCell(a++).setCellValue("DU"); // "BTS_NM"
    hrow0.createCell(a++).setCellValue("CELL ID"); // "CELL_ID"
    hrow0.createCell(a++).setCellValue("CELL "); // "CELL_NM"
    hrow0.createCell(a++).setCellValue("MCID"); // "MCID"
    hrow0.createCell(a++).setCellValue(""); // "FREQ_KIND"
    hrow0.createCell(a++).setCellValue("(Mbps)"); // "THROUGHPUT"
    hrow0.createCell(a++).setCellValue("CQI ?"); // "CQI_AVERAGE"
    hrow0.createCell(a++).setCellValue("CQI0  "); // "CQI0_RATE"
    hrow0.createCell(a++).setCellValue("RI2 "); // "RI_RATE"
    hrow0.createCell(a++).setCellValue("DL PRB "); // "DL_PRB_RATE"
    hrow0.createCell(a++).setCellValue("RSSI"); // "RSSI0_PUCCH"
    hrow0.createCell(a++).setCellValue("RSSI"); // "RSSI1_PUCCH"
    hrow0.createCell(a++).setCellValue("RSSI"); // "RSSI0_PUSCH"
    hrow0.createCell(a++).setCellValue("RSSI"); // "RSSI1_PUSCH"
    hrow0.createCell(a++).setCellValue("License  "); // "LICENSE_FAIL"
    hrow0.createCell(a++).setCellValue(""); // ""
    hrow0.createCell(a++).setCellValue(""); // ""

    Row hrow1 = sheet.createRow((short) 1);
    hrow1.setHeightInPoints(20);
    int b = 0;
    hrow1.createCell(b++).setCellValue(""); // "YMD"
    hrow1.createCell(b++).setCellValue(""); // "BTS_NM"
    hrow1.createCell(b++).setCellValue(""); // "CELL_ID"
    hrow1.createCell(b++).setCellValue(""); // "CELL_NM"
    hrow1.createCell(b++).setCellValue(""); // "MCID"
    hrow1.createCell(b++).setCellValue(""); // "FREQ_KIND"
    hrow1.createCell(b++).setCellValue(""); // "THROUGHPUT"
    hrow1.createCell(b++).setCellValue(""); // "CQI_AVERAGE"
    hrow1.createCell(b++).setCellValue(""); // "CQI0_RATE"
    hrow1.createCell(b++).setCellValue(""); // "RI_RATE"
    hrow1.createCell(b++).setCellValue(""); // "DL_PRB_RATE"
    hrow1.createCell(b++).setCellValue("Total(PUCCH)"); // "SI0_PUCCH"
    hrow1.createCell(b++).setCellValue("Total(PUCCH)"); // "SI1_PUCCH"
    hrow1.createCell(b++).setCellValue("Total(PUSCH)"); // "SI0_PUSCH"
    hrow1.createCell(b++).setCellValue("Total(PUSCH)"); // "SI1_PUSCH"
    hrow1.createCell(b++).setCellValue(""); // "LICENSE_FAIL"
    hrow1.createCell(b++).setCellValue(""); // "-"
    hrow1.createCell(b++).setCellValue(""); // "-"

    Row hrow2 = sheet.createRow((short) 2);
    hrow2.setHeightInPoints(20);
    int c = 0;
    hrow2.createCell(c++).setCellValue(""); // "YMD"
    hrow2.createCell(c++).setCellValue(""); // "BTS_NM"
    hrow2.createCell(c++).setCellValue(""); // "CELL_ID"
    hrow2.createCell(c++).setCellValue(""); // "CELL_NM"
    hrow2.createCell(c++).setCellValue(""); // "MCID"
    hrow2.createCell(c++).setCellValue(""); // "FREQ_KIND"
    hrow2.createCell(c++).setCellValue(""); // "THROUGHPUT"
    hrow2.createCell(c++).setCellValue(""); // "CQI_AVERAGE"
    hrow2.createCell(c++).setCellValue(""); // "CQI0_RATE"
    hrow2.createCell(c++).setCellValue(""); // "RI_RATE"
    hrow2.createCell(c++).setCellValue(""); // "DL_PRB_RATE"
    hrow2.createCell(c++).setCellValue(""); //  "RI0_PUCCH"
    hrow2.createCell(c++).setCellValue(""); //  "RI1_PUCCH"
    hrow2.createCell(c++).setCellValue(""); //  "RI0_PUSCH"
    hrow2.createCell(c++).setCellValue(""); //  "RI1_PUSCH"
    hrow2.createCell(c++).setCellValue(""); // "LICENSE_FAIL"
    hrow2.createCell(c++).setCellValue(""); // "-"
    hrow2.createCell(c++).setCellValue(""); // "-"

    int d = 0;
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "YMD"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "BTS_NM"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "CELL_ID"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "CELL_NM"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "MCID"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "FREQ_KIND"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "THROUGHPUT"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "CQI_AVERAGE"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "CQI0_RATE"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "RI_RATE"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "DL_PRB_RATE"
    sheet.addMergedRegion(new CellRangeAddress(0, 0, d, d + 3)); // "RSSI"
    sheet.addMergedRegion(new CellRangeAddress(1, 1, d, d + 1)); // "Total(PUCCH)"
    sheet.addMergedRegion(new CellRangeAddress(1, 1, d + 2, d + 3)); // "Total(PUSCH)"
    d += 4;
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "LICENSE_FAIL"
    sheet.addMergedRegion(new CellRangeAddress(0, 0, d, d + 1)); // ""
    sheet.addMergedRegion(new CellRangeAddress(1, 2, d, d)); // "-"
    sheet.addMergedRegion(new CellRangeAddress(1, 2, d + 1, d + 1)); // "-"

    ArrayList list01 = (ArrayList) map.get("rows");
    Iterator iterator = (Iterator) list01.iterator();
    short i = 3;
    while (iterator.hasNext()) {
        StringMap jrow = (StringMap) iterator.next();
        //  
        Row row = sheet.createRow((short) i);
        row.setHeightInPoints(20);
        int e = 0;
        row.createCell(e++).setCellValue((String) jrow.get("YMD"));
        row.createCell(e++).setCellValue((String) jrow.get("BTS_NM"));
        row.createCell(e++).setCellValue((String) jrow.get("CELL_ID"));
        row.createCell(e++).setCellValue((String) jrow.get("CELL_NM"));
        row.createCell(e++).setCellValue((String) jrow.get("MCID"));
        row.createCell(e++).setCellValue((String) jrow.get("FREQ_KIND"));

        setCellDoubleIfExistValue(row.createCell(e++), jrow, "THROUGHPUT");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "CQI_AVERAGE");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "CQI0_RATE");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "RI_RATE");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "DL_PRB_RATE");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "RSSI0_PUCCH");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "RSSI1_PUCCH");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "RSSI0_PUSCH");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "RSSI1_PUSCH");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "LICENSE_FAIL");
        row.createCell(e++).setCellValue((String) jrow.get("CHNL_TYPE")); //  ");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "CHNL_COUNT"); //  ");

        i++;

    }

    this.log.debug("createCellTrafficExcelSheet End");

}

From source file:com.skt.adcas.lte.action.DownLinkBySTDStatsAction.java

public void createCellTrafficStatsExcelSheet(Sheet sheet, Map<String, Object> map, String searchType)
        throws Exception {

    this.log.debug("createCellTrafficStatsExcelSheet Start");

    Row hrow0 = sheet.createRow((short) 0);
    hrow0.setHeightInPoints(20);/*from  w  ww  .  ja  va2s.co  m*/
    int a = 0;
    hrow0.createCell(a++).setCellValue("");
    if (searchType.equalsIgnoreCase("BONBU")) {
        hrow0.createCell(a++).setCellValue("");
    } else if (searchType.equalsIgnoreCase("TEAM")) {
        hrow0.createCell(a++).setCellValue("");
        hrow0.createCell(a++).setCellValue("");
    } else if (searchType.equalsIgnoreCase("PART")) {
        hrow0.createCell(a++).setCellValue("");
        hrow0.createCell(a++).setCellValue("");
        hrow0.createCell(a++).setCellValue("");
    } else if (searchType.equalsIgnoreCase("CITY")) {
        hrow0.createCell(a++).setCellValue("?//");
    } else if (searchType.equalsIgnoreCase("UNI")) {
        hrow0.createCell(a++).setCellValue("?//");
        hrow0.createCell(a++).setCellValue("//");
    } else if (searchType.equalsIgnoreCase("EMS")) {
        hrow0.createCell(a++).setCellValue("MME GROUP");
        hrow0.createCell(a++).setCellValue("EMS");
    }
    hrow0.createCell(a++).setCellValue(""); // "FREQ_KIND"
    hrow0.createCell(a++).setCellValue("(Mbps)"); // "THROUGHPUT"
    hrow0.createCell(a++).setCellValue("CQI ?"); // "CQI_AVERAGE"
    hrow0.createCell(a++).setCellValue("CQI0  "); // "CQI0_RATE"
    hrow0.createCell(a++).setCellValue("RI2 "); // "RI_RATE"
    hrow0.createCell(a++).setCellValue("DL PRB "); // "DL_PRB_RATE"
    hrow0.createCell(a++).setCellValue("RSSI"); // "RSSI0_PUCCH"
    hrow0.createCell(a++).setCellValue("RSSI"); // "RSSI1_PUCCH"
    hrow0.createCell(a++).setCellValue("RSSI"); // "RSSI0_PUSCH"
    hrow0.createCell(a++).setCellValue("RSSI"); // "RSSI1_PUSCH"
    hrow0.createCell(a++).setCellValue("License  "); // "LICENSE_FAIL"
    //hrow0.createCell(a++).setCellValue("");                 // ""
    //hrow0.createCell(a++).setCellValue("");                 // ""

    Row hrow1 = sheet.createRow((short) 1);
    hrow1.setHeightInPoints(20);
    int b = 0;
    hrow1.createCell(b++).setCellValue("");
    if (searchType.equalsIgnoreCase("BONBU") || searchType.equalsIgnoreCase("CITY")) {
        hrow1.createCell(b++).setCellValue("");
    } else if (searchType.equalsIgnoreCase("TEAM") || searchType.equalsIgnoreCase("UNI")
            || searchType.equalsIgnoreCase("EMS")) {
        hrow1.createCell(b++).setCellValue("");
        hrow1.createCell(b++).setCellValue("");
    } else if (searchType.equalsIgnoreCase("PART")) {
        hrow1.createCell(b++).setCellValue("");
        hrow1.createCell(b++).setCellValue("");
        hrow1.createCell(b++).setCellValue("");
    }
    hrow1.createCell(b++).setCellValue(""); // "FREQ_KIND"
    hrow1.createCell(b++).setCellValue(""); // "THROUGHPUT"
    hrow1.createCell(b++).setCellValue(""); // "CQI_AVERAGE"
    hrow1.createCell(b++).setCellValue(""); // "CQI0_RATE"
    hrow1.createCell(b++).setCellValue(""); // "RI_RATE"
    hrow1.createCell(b++).setCellValue(""); // "DL_PRB_RATE"
    hrow1.createCell(b++).setCellValue("Total(PUCCH)"); // "RSSI0_PUCCH"
    hrow1.createCell(b++).setCellValue("Total(PUCCH)"); // "RSSI1_PUCCH"
    hrow1.createCell(b++).setCellValue("Total(PUSCH)"); // "RSSI0_PUSCH"
    hrow1.createCell(b++).setCellValue("Total(PUSCH)"); // "RSSI1_PUSCH"
    hrow1.createCell(b++).setCellValue(""); // "LICENSE_FAIL"
    //hrow1.createCell(b++).setCellValue("");           // ""
    //hrow1.createCell(b++).setCellValue("");           // ""

    Row hrow2 = sheet.createRow((short) 2);
    hrow2.setHeightInPoints(20);
    int c = 0;
    hrow2.createCell(c++).setCellValue("");
    if (searchType.equalsIgnoreCase("BONBU") || searchType.equalsIgnoreCase("CITY")) {
        hrow2.createCell(c++).setCellValue("");
    } else if (searchType.equalsIgnoreCase("TEAM") || searchType.equalsIgnoreCase("UNI")
            || searchType.equalsIgnoreCase("EMS")) {
        hrow2.createCell(c++).setCellValue("");
        hrow2.createCell(c++).setCellValue("");
    } else if (searchType.equalsIgnoreCase("PART")) {
        hrow2.createCell(c++).setCellValue("");
        hrow2.createCell(c++).setCellValue("");
        hrow2.createCell(c++).setCellValue("");
    }
    hrow2.createCell(c++).setCellValue(""); // "FREQ_KIND"
    hrow2.createCell(c++).setCellValue(""); // "THROUGHPUT"
    hrow2.createCell(c++).setCellValue(""); // "CQI_AVERAGE"
    hrow2.createCell(c++).setCellValue(""); // "CQI0_RATE"
    hrow2.createCell(c++).setCellValue(""); // "RI_RATE"
    hrow2.createCell(c++).setCellValue(""); // "DL_PRB_RATE"
    hrow2.createCell(c++).setCellValue(""); // "RSSI0_PUCCH"
    hrow2.createCell(c++).setCellValue(""); // "RSSI1_PUCCH"
    hrow2.createCell(c++).setCellValue(""); // "RSSI0_PUSCH"
    hrow2.createCell(c++).setCellValue(""); // "RSSI1_PUSCH"
    hrow2.createCell(c++).setCellValue(""); // "LICENSE_FAIL"
    hrow2.createCell(c++).setCellValue(""); // "-"
    hrow2.createCell(c++).setCellValue(""); // "-"

    int d = 0;
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // ""
    if (searchType.equalsIgnoreCase("BONBU") || searchType.equalsIgnoreCase("CITY")) {
        sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++));
    } else if (searchType.equalsIgnoreCase("TEAM") || searchType.equalsIgnoreCase("UNI")
            || searchType.equalsIgnoreCase("EMS")) {
        sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++));
        sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++));
    } else if (searchType.equalsIgnoreCase("PART")) {
        sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++));
        sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++));
        sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++));
    }
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "FREQ_KIND"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "THROUGHPUT"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "CQI_AVERAGE"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "CQI0_RATE"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "RI_RATE"
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "DL_PRB_RATE"
    sheet.addMergedRegion(new CellRangeAddress(0, 0, d, d + 3)); //"RSSI"
    sheet.addMergedRegion(new CellRangeAddress(1, 1, d, d + 1)); //"Total(PUCCH)"
    sheet.addMergedRegion(new CellRangeAddress(1, 1, d + 2, d + 3)); // "Total(PUSCH)"
    d += 4;
    sheet.addMergedRegion(new CellRangeAddress(0, 2, d, d++)); // "LICENSE_FAIL"
    sheet.addMergedRegion(new CellRangeAddress(0, 0, d, d + 1)); // ""
    sheet.addMergedRegion(new CellRangeAddress(1, 2, d, d)); // "-"
    sheet.addMergedRegion(new CellRangeAddress(1, 2, d + 1, d + 1)); // "-"

    ArrayList list01 = (ArrayList) map.get("rows");
    Iterator iterator = (Iterator) list01.iterator();
    short i = 3;
    while (iterator.hasNext()) {
        StringMap jrow = (StringMap) iterator.next();
        //  
        Row row = sheet.createRow((short) i);
        row.setHeightInPoints(20);
        int e = 0;
        row.createCell(e++).setCellValue((String) jrow.get("YMD"));
        if (searchType.equalsIgnoreCase("BONBU") || searchType.equalsIgnoreCase("CITY")) {
            row.createCell(e++).setCellValue((String) jrow.get("TITLE01"));
        } else if (searchType.equalsIgnoreCase("TEAM") || searchType.equalsIgnoreCase("UNI")
                || searchType.equalsIgnoreCase("EMS")) {
            row.createCell(e++).setCellValue((String) jrow.get("TITLE01"));
            row.createCell(e++).setCellValue((String) jrow.get("TITLE02"));
        } else if (searchType.equalsIgnoreCase("PART")) {
            row.createCell(e++).setCellValue((String) jrow.get("TITLE01"));
            row.createCell(e++).setCellValue((String) jrow.get("TITLE02"));
            row.createCell(e++).setCellValue((String) jrow.get("TITLE03"));
        }
        row.createCell(e++).setCellValue((String) jrow.get("FREQ_KIND"));

        setCellDoubleIfExistValue(row.createCell(e++), jrow, "THROUGHPUT");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "CQI_AVERAGE");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "CQI0_RATE");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "RI_RATE");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "DL_PRB_RATE");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "RSSI0_PUCCH");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "RSSI1_PUCCH");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "RSSI0_PUSCH");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "RSSI1_PUSCH");
        setCellDoubleIfExistValue(row.createCell(e++), jrow, "LICENSE_FAIL");
        // row.createCell(e++).setCellValue("n/a");
        // row.createCell(e++).setCellValue("n/a");
        i++;

    }

    this.log.debug("createCellTrafficStatsExcelSheet End");
}

From source file:com.solidmaps.webapp.report.utils.ExcelMapCivilGenerator.java

private void createCellProduct(XSSFSheet sheetBuy, XSSFRow row, Integer index, String value) {
    XSSFCell cell = row.createCell(index);
    sheetBuy.addMergedRegion(new CellRangeAddress(row.getRowNum(), row.getRowNum(), 0, 3));
    cell.setCellStyle(styleProductList);
    cell.setCellValue(value);//  w  w  w .  jav  a 2s .c  o m
}