Example usage for org.apache.poi.ss.usermodel Row setHeightInPoints

List of usage examples for org.apache.poi.ss.usermodel Row setHeightInPoints

Introduction

In this page you can find the example usage for org.apache.poi.ss.usermodel Row setHeightInPoints.

Prototype

void setHeightInPoints(float height);

Source Link

Document

Set the row's height in points.

Usage

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 ?// w ww .ja v a2s  . c  om
    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.DownLinkByQMSStatsAction.java

public String selectCellTrafficStatsHistogramExcelDownload() {

    this.log.debug("selectCellTrafficStatsHistogramExcelDownload Start");
    SqlSession session = null;/*from  w  w w  . j  a va  2 s .co  m*/
    FileOutputStream fileOut = null;

    try {
        //parseParam();
        Type type = new TypeToken<Map<String, Object>>() {
        }.getType();
        Gson gson = new Gson();
        Map<String, Object> map = gson.fromJson(this.JSONDATA, type);

        log.debug("json data : " + this.JSONDATA);

        Workbook wb = new HSSFWorkbook();
        //CreationHelper createHelper = wb.getCreationHelper();

        String sheetName = this.FROMYMD + "~" + this.TOYMD;
        String safeName = WorkbookUtil.createSafeSheetName(sheetName);

        //sheet 
        Sheet sheet = wb.createSheet(safeName);

        //header ?
        Row hrow0 = sheet.createRow((short) 0);
        hrow0.setHeightInPoints(20);
        hrow0.createCell(0).setCellValue("MBPS");
        hrow0.createCell(1).setCellValue("COUNT");
        hrow0.createCell(2).setCellValue("??");
        hrow0.createCell(3).setCellValue("CDF");

        StringMap categoryVal = (StringMap) map.get("categoryVal");
        StringMap rVal = (StringMap) map.get("rVal");
        StringMap rate = (StringMap) map.get("rate");
        StringMap cdf = (StringMap) map.get("cdf");

        short i = 1;
        for (int j = 0; j < 10; j++) {
            //  
            Row row = sheet.createRow((short) i);
            row.setHeightInPoints(20);
            row.createCell(0).setCellValue(Double.parseDouble(categoryVal.get(String.valueOf(j)).toString()));
            row.createCell(1).setCellValue(Double.parseDouble(rVal.get(String.valueOf(j)).toString()));
            row.createCell(2).setCellValue(Double.parseDouble(rate.get(String.valueOf(j)).toString()));
            row.createCell(3).setCellValue(Double.parseDouble(cdf.get(String.valueOf(j)).toString()));
            i++;
        }

        log.debug("selectCellTrafficStatsHistogramExcelDownload : file start");

        String writeFolderPath = (String) super.properties.get("TEMP_FOLDER_PATH");
        String tempFolder = "/" + UUID.randomUUID().toString();
        String xlsFileName = "/DownLinkStatsHistogram(QMS).xls";

        if (!(new File(writeFolderPath + tempFolder)).mkdir()) {
            throw new Exception("? ??  .");
        }

        String xlsFileFullPath = writeFolderPath + tempFolder + xlsFileName;
        fileOut = new FileOutputStream(xlsFileFullPath);
        wb.write(fileOut);
        log.debug("selectCellTrafficStatsHistogramExcelDownload : file end");

        this.msg = "? ? ?";
        this.status = "SUCCESS";
        this.downloadurl = "download" + tempFolder + xlsFileName;

    } catch (Exception e) {
        this.msg = e.getMessage();
        this.status = "ERROR";
        this.error = true;
        if (session != null) {
            session.rollback();
        }
        e.printStackTrace();
    } finally {
        try {
            if (fileOut != null)
                fileOut.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (session != null) {
            session.close();
        }
    }

    this.log.debug("selectCellTrafficStatsHistogramExcelDownload End");
    return SUCCESS;
}

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

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

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

    String[] CQINAME = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15" };
    if (MFC_CD.equals("MFC00002")) {
        CQINAME[0] = "1";
        CQINAME[1] = "2";
        CQINAME[2] = "3";
        CQINAME[3] = "4";
        CQINAME[4] = "5";
        CQINAME[5] = "6";
        CQINAME[6] = "7";
        CQINAME[7] = "8";
        CQINAME[8] = "9";
        CQINAME[9] = "10";
        CQINAME[10] = "11";
        CQINAME[11] = "12";
        CQINAME[12] = "13";
        CQINAME[13] = "14";
        CQINAME[14] = "15";
        CQINAME[15] = "16";
    }/*from   w  w  w. jav a 2  s . c om*/

    //header ?
    Row hrow0 = sheet.createRow((short) 0);
    hrow0.setHeightInPoints(20);
    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(type + "-" + CQINAME[0]);
    hrow0.createCell(a++).setCellValue(type + "-" + CQINAME[1]);
    hrow0.createCell(a++).setCellValue(type + "-" + CQINAME[2]);
    hrow0.createCell(a++).setCellValue(type + "-" + CQINAME[3]);
    hrow0.createCell(a++).setCellValue(type + "-" + CQINAME[4]);
    hrow0.createCell(a++).setCellValue(type + "-" + CQINAME[5]);
    hrow0.createCell(a++).setCellValue(type + "-" + CQINAME[6]);
    hrow0.createCell(a++).setCellValue(type + "-" + CQINAME[7]);
    hrow0.createCell(a++).setCellValue(type + "-" + CQINAME[8]);
    hrow0.createCell(a++).setCellValue(type + "-" + CQINAME[9]);
    hrow0.createCell(a++).setCellValue(type + "-" + CQINAME[10]);
    hrow0.createCell(a++).setCellValue(type + "-" + CQINAME[11]);
    hrow0.createCell(a++).setCellValue(type + "-" + CQINAME[12]);
    hrow0.createCell(a++).setCellValue(type + "-" + CQINAME[13]);
    hrow0.createCell(a++).setCellValue(type + "-" + CQINAME[14]);
    hrow0.createCell(a++).setCellValue(type + "-" + CQINAME[15]);

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

        setCellDoubleIfExistValue(row.createCell(b++), jrow, "CQI_" + type + "_00");
        setCellDoubleIfExistValue(row.createCell(b++), jrow, "CQI_" + type + "_01");
        setCellDoubleIfExistValue(row.createCell(b++), jrow, "CQI_" + type + "_02");
        setCellDoubleIfExistValue(row.createCell(b++), jrow, "CQI_" + type + "_03");
        setCellDoubleIfExistValue(row.createCell(b++), jrow, "CQI_" + type + "_04");
        setCellDoubleIfExistValue(row.createCell(b++), jrow, "CQI_" + type + "_05");
        setCellDoubleIfExistValue(row.createCell(b++), jrow, "CQI_" + type + "_06");
        setCellDoubleIfExistValue(row.createCell(b++), jrow, "CQI_" + type + "_07");
        setCellDoubleIfExistValue(row.createCell(b++), jrow, "CQI_" + type + "_08");
        setCellDoubleIfExistValue(row.createCell(b++), jrow, "CQI_" + type + "_09");
        setCellDoubleIfExistValue(row.createCell(b++), jrow, "CQI_" + type + "_10");
        setCellDoubleIfExistValue(row.createCell(b++), jrow, "CQI_" + type + "_11");
        setCellDoubleIfExistValue(row.createCell(b++), jrow, "CQI_" + type + "_12");
        setCellDoubleIfExistValue(row.createCell(b++), jrow, "CQI_" + type + "_13");
        setCellDoubleIfExistValue(row.createCell(b++), jrow, "CQI_" + type + "_14");
        setCellDoubleIfExistValue(row.createCell(b++), jrow, "CQI_" + type + "_15");

        i++;
    }

    this.log.debug("createCellTrafficCQIExcelSheet 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);
    int a = 0;//  w  w  w.j av a 2 s  .  co  m
    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.DownLinkBySTDAction.java

public String selectCellTrafficThrpCompGraphExcelDownload() {

    this.log.debug("selectCellTrafficThrpCompGraphExcelDownload Start");
    SqlSession session = null;/*from  w w  w .  ja va2  s. c om*/
    FileOutputStream fileOut = null;

    try {
        //parseParam();
        Type type = new TypeToken<Map<String, Object>>() {
        }.getType();
        Gson gson = new Gson();
        Map<String, Object> map = gson.fromJson(this.JSONDATA, type);

        log.debug("json data : " + this.JSONDATA);

        Workbook wb = new HSSFWorkbook();
        //CreationHelper createHelper = wb.getCreationHelper();

        String sheetName = " ?";
        String safeName = WorkbookUtil.createSafeSheetName(sheetName);

        //sheet 
        Sheet sheet = wb.createSheet(safeName);

        //header ?
        Row hrow0 = sheet.createRow((short) 0);
        hrow0.setHeightInPoints(20);
        hrow0.createCell(0).setCellValue("");
        hrow0.createCell(1).setCellValue("(" + this.FROMYMD + ")");
        hrow0.createCell(2).setCellValue("(" + this.TOYMD + ")");

        StringMap categories = (StringMap) map.get("categories");
        StringMap beforeSeries = (StringMap) map.get("beforeSeries");
        StringMap afterSeries = (StringMap) map.get("afterSeries");

        short i = 1;
        for (int j = 0; j < categories.size(); j++) {
            //  
            Row row = sheet.createRow((short) i);
            row.setHeightInPoints(20);
            row.createCell(0)
                    .setCellValue(categories.get(String.valueOf(j)).toString().replaceAll("<br>", " : "));
            row.createCell(1).setCellValue(Double.parseDouble(beforeSeries.get(String.valueOf(j)).toString()));
            row.createCell(2).setCellValue(Double.parseDouble(afterSeries.get(String.valueOf(j)).toString()));
            i++;
        }

        log.debug("selectCellTrafficThrpCompGraphExcelDownload : file start");

        String writeFolderPath = (String) super.properties.get("TEMP_FOLDER_PATH");
        String tempFolder = "/" + UUID.randomUUID().toString();
        String xlsFileName = "/DownLinkThrpCompGraph(STD).xls";

        if (!(new File(writeFolderPath + tempFolder)).mkdir()) {
            throw new Exception("? ??  .");
        }

        String xlsFileFullPath = writeFolderPath + tempFolder + xlsFileName;
        fileOut = new FileOutputStream(xlsFileFullPath);
        wb.write(fileOut);
        log.debug("selectCellTrafficThrpCompGraphExcelDownload : file end");

        this.msg = "? ? ?";
        this.status = "SUCCESS";
        this.downloadurl = "download" + tempFolder + xlsFileName;

    } catch (Exception e) {
        this.msg = e.getMessage();
        this.status = "ERROR";
        this.error = true;
        if (session != null) {
            session.rollback();
        }
        e.printStackTrace();
    } finally {
        try {
            if (fileOut != null)
                fileOut.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (session != null) {
            session.close();
        }
    }

    this.log.debug("selectCellTrafficThrpCompGraphExcelDownload End");
    return SUCCESS;
}

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

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

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

    Row hrow0 = sheet.createRow((short) 0);
    hrow0.setHeightInPoints(20);
    int a = 0;//from   w  w w .ja v  a  2  s  . co  m
    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("");
    hrow0.createCell(a++).setCellValue(type + "#00");
    hrow0.createCell(a++).setCellValue(type + "#01");
    hrow0.createCell(a++).setCellValue(type + "#02");
    hrow0.createCell(a++).setCellValue(type + "#03");
    hrow0.createCell(a++).setCellValue(type + "#04");
    hrow0.createCell(a++).setCellValue(type + "#05");
    hrow0.createCell(a++).setCellValue(type + "#06");
    hrow0.createCell(a++).setCellValue(type + "#07");
    hrow0.createCell(a++).setCellValue(type + "#08");
    hrow0.createCell(a++).setCellValue(type + "#09");
    hrow0.createCell(a++).setCellValue(type + "#10");
    hrow0.createCell(a++).setCellValue(type + "#11");
    hrow0.createCell(a++).setCellValue(type + "#12");
    hrow0.createCell(a++).setCellValue(type + "#13");
    hrow0.createCell(a++).setCellValue(type + "#14");
    hrow0.createCell(a++).setCellValue(type + "#15");

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

        setCellDoubleIfExistValue(row.createCell(b++), jrow, "CQI_" + type + "_00");
        setCellDoubleIfExistValue(row.createCell(b++), jrow, "CQI_" + type + "_01");
        setCellDoubleIfExistValue(row.createCell(b++), jrow, "CQI_" + type + "_02");
        setCellDoubleIfExistValue(row.createCell(b++), jrow, "CQI_" + type + "_03");
        setCellDoubleIfExistValue(row.createCell(b++), jrow, "CQI_" + type + "_04");
        setCellDoubleIfExistValue(row.createCell(b++), jrow, "CQI_" + type + "_05");
        setCellDoubleIfExistValue(row.createCell(b++), jrow, "CQI_" + type + "_06");
        setCellDoubleIfExistValue(row.createCell(b++), jrow, "CQI_" + type + "_07");
        setCellDoubleIfExistValue(row.createCell(b++), jrow, "CQI_" + type + "_08");
        setCellDoubleIfExistValue(row.createCell(b++), jrow, "CQI_" + type + "_09");
        setCellDoubleIfExistValue(row.createCell(b++), jrow, "CQI_" + type + "_10");
        setCellDoubleIfExistValue(row.createCell(b++), jrow, "CQI_" + type + "_11");
        setCellDoubleIfExistValue(row.createCell(b++), jrow, "CQI_" + type + "_12");
        setCellDoubleIfExistValue(row.createCell(b++), jrow, "CQI_" + type + "_13");
        setCellDoubleIfExistValue(row.createCell(b++), jrow, "CQI_" + type + "_14");
        setCellDoubleIfExistValue(row.createCell(b++), jrow, "CQI_" + type + "_15");

        i++;
    }

    this.log.debug("selectCellTrafficStatsCQIExcelDownload 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);
    int a = 0;//from w  w w.  ja v  a2  s  .  c  o m
    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.skt.adcas.lte.action.DownLinkBySTDStatsAction.java

public String selectCellTrafficStatsThrpCompGraphExcelDownload() {

    this.log.debug("selectCellTrafficStatsThrpCompGraphExcelDownload Start");
    SqlSession session = null;/*from   w  ww.jav  a2  s .  c o m*/
    FileOutputStream fileOut = null;

    try {
        //parseParam();
        Type type = new TypeToken<Map<String, Object>>() {
        }.getType();
        Gson gson = new Gson();
        Map<String, Object> map = gson.fromJson(this.JSONDATA, type);

        log.debug("json data : " + this.JSONDATA);

        Workbook wb = new HSSFWorkbook();
        //CreationHelper createHelper = wb.getCreationHelper();

        String sheetName = " ?";
        String safeName = WorkbookUtil.createSafeSheetName(sheetName);

        //sheet 
        Sheet sheet = wb.createSheet(safeName);

        //header ?
        Row hrow0 = sheet.createRow((short) 0);
        hrow0.setHeightInPoints(20);
        hrow0.createCell(0).setCellValue("");
        hrow0.createCell(1).setCellValue("(" + this.FROMYMD + ")");
        hrow0.createCell(2).setCellValue("(" + this.TOYMD + ")");

        StringMap categories = (StringMap) map.get("categories");
        StringMap beforeSeries = (StringMap) map.get("beforeSeries");
        StringMap afterSeries = (StringMap) map.get("afterSeries");

        short i = 1;
        for (int j = 0; j < categories.size(); j++) {
            //  
            Row row = sheet.createRow((short) i);
            row.setHeightInPoints(20);
            row.createCell(0)
                    .setCellValue(categories.get(String.valueOf(j)).toString().replaceAll("<br>", " : "));
            row.createCell(1).setCellValue(Double.parseDouble(beforeSeries.get(String.valueOf(j)).toString()));
            row.createCell(2).setCellValue(Double.parseDouble(afterSeries.get(String.valueOf(j)).toString()));
            i++;
        }

        log.debug("selectCellTrafficStatsThrpCompGraphExcelDownload : file start");

        String writeFolderPath = (String) super.properties.get("TEMP_FOLDER_PATH");
        String tempFolder = "/" + UUID.randomUUID().toString();
        String xlsFileName = "/DownLinkThrpCompGraph(STD).xls";

        if (!(new File(writeFolderPath + tempFolder)).mkdir()) {
            throw new Exception("? ??  .");
        }

        String xlsFileFullPath = writeFolderPath + tempFolder + xlsFileName;
        fileOut = new FileOutputStream(xlsFileFullPath);
        wb.write(fileOut);
        log.debug("selectCellTrafficStatsThrpCompGraphExcelDownload : file end");

        this.msg = "? ? ?";
        this.status = "SUCCESS";
        this.downloadurl = "download" + tempFolder + xlsFileName;

    } catch (Exception e) {
        this.msg = e.getMessage();
        this.status = "ERROR";
        this.error = true;
        if (session != null) {
            session.rollback();
        }
        e.printStackTrace();
    } finally {
        try {
            if (fileOut != null)
                fileOut.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (session != null) {
            session.close();
        }
    }

    this.log.debug("selectCellTrafficStatsThrpCompGraphExcelDownload End");
    return SUCCESS;
}

From source file:com.solidmaps.webapp.report.TimesheetDemo.java

License:Apache License

public void main(String[] args) throws Exception {
    Workbook wb = new HSSFWorkbook();

    Map<String, CellStyle> styles = createStyles(wb);

    Sheet sheet = wb.createSheet("Timesheet");
    PrintSetup printSetup = sheet.getPrintSetup();
    printSetup.setLandscape(true);//from w w  w  . j a  v a 2  s  .  co  m
    sheet.setFitToPage(true);
    sheet.setHorizontallyCenter(true);

    //title row
    Row titleRow = sheet.createRow(0);
    titleRow.setHeightInPoints(45);
    Cell titleCell = titleRow.createCell(0);
    titleCell.setCellValue("Weekly Timesheet");
    titleCell.setCellStyle(styles.get("title"));
    sheet.addMergedRegion(CellRangeAddress.valueOf("$A$1:$L$1"));

    //header row
    Row headerRow = sheet.createRow(1);
    headerRow.setHeightInPoints(40);
    Cell headerCell;
    for (int i = 0; i < titles.length; i++) {
        headerCell = headerRow.createCell(i);
        headerCell.setCellValue(titles[i]);
        headerCell.setCellStyle(styles.get("header"));
    }

    int rownum = 2;
    for (int i = 0; i < 10; i++) {
        Row row = sheet.createRow(rownum++);
        for (int j = 0; j < titles.length; j++) {
            Cell cell = row.createCell(j);
            if (j == 9) {
                //the 10th cell contains sum over week days, e.g. SUM(C3:I3)
                String ref = "C" + rownum + ":I" + rownum;
                cell.setCellFormula("SUM(" + ref + ")");
                cell.setCellStyle(styles.get("formula"));
            } else if (j == 11) {
                cell.setCellFormula("J" + rownum + "-K" + rownum);
                cell.setCellStyle(styles.get("formula"));
            } else {
                cell.setCellStyle(styles.get("cell"));
            }
        }
    }

    //row with totals below
    Row sumRow = sheet.createRow(rownum++);
    sumRow.setHeightInPoints(35);
    Cell cell;
    cell = sumRow.createCell(0);
    cell.setCellStyle(styles.get("formula"));
    cell = sumRow.createCell(1);
    cell.setCellValue("Total Hrs:");
    cell.setCellStyle(styles.get("formula"));

    for (int j = 2; j < 12; j++) {
        cell = sumRow.createCell(j);
        String ref = (char) ('A' + j) + "3:" + (char) ('A' + j) + "12";
        cell.setCellFormula("SUM(" + ref + ")");
        if (j >= 9)
            cell.setCellStyle(styles.get("formula_2"));
        else
            cell.setCellStyle(styles.get("formula"));
    }
    rownum++;
    sumRow = sheet.createRow(rownum++);
    sumRow.setHeightInPoints(25);
    cell = sumRow.createCell(0);
    cell.setCellValue("Total Regular Hours");
    cell.setCellStyle(styles.get("formula"));
    cell = sumRow.createCell(1);
    cell.setCellFormula("L13");
    cell.setCellStyle(styles.get("formula_2"));
    sumRow = sheet.createRow(rownum++);
    sumRow.setHeightInPoints(25);
    cell = sumRow.createCell(0);
    cell.setCellValue("Total Overtime Hours");
    cell.setCellStyle(styles.get("formula"));
    cell = sumRow.createCell(1);
    cell.setCellFormula("K13");
    cell.setCellStyle(styles.get("formula_2"));

    //set sample data
    for (int i = 0; i < sample_data.length; i++) {
        Row row = sheet.getRow(2 + i);
        for (int j = 0; j < sample_data[i].length; j++) {
            if (sample_data[i][j] == null)
                continue;

            if (sample_data[i][j] instanceof String) {
                row.getCell(j).setCellValue((String) sample_data[i][j]);
            } else {
                row.getCell(j).setCellValue((Double) sample_data[i][j]);
            }
        }
    }

    //finally set column widths, the width is measured in units of 1/256th of a character width
    sheet.setColumnWidth(0, 30 * 256); //30 characters wide
    for (int i = 2; i < 9; i++) {
        sheet.setColumnWidth(i, 6 * 256); //6 characters wide
    }
    sheet.setColumnWidth(10, 10 * 256); //10 characters wide

    // Write the output to a file
    String file = "/home/brunorocca/Desktop/mapa_teste.xls";
    if (wb instanceof XSSFWorkbook)
        file += "x";
    FileOutputStream out = new FileOutputStream(file);
    wb.write(out);
    out.close();
}

From source file:com.springapp.mvc.BusinessPlan.java

License:Apache License

public static void main(String[] args) throws Exception {
    Workbook wb;//from w ww .  jav a 2s.co  m

    if (args.length > 0 && args[0].equals("-xls"))
        wb = new HSSFWorkbook();
    else
        wb = new XSSFWorkbook();

    Map<String, CellStyle> styles = createStyles(wb);

    Sheet sheet = wb.createSheet("Business Plan");

    //turn off gridlines
    sheet.setDisplayGridlines(false);
    sheet.setPrintGridlines(false);
    sheet.setFitToPage(true);
    sheet.setHorizontallyCenter(true);
    PrintSetup printSetup = sheet.getPrintSetup();
    printSetup.setLandscape(true);

    //the following three statements are required only for HSSF
    sheet.setAutobreaks(true);
    printSetup.setFitHeight((short) 1);
    printSetup.setFitWidth((short) 1);

    //the header row: centered text in 48pt font
    Row headerRow = sheet.createRow(0);
    headerRow.setHeightInPoints(12.75f);
    for (int i = 0; i < titles.length; i++) {
        Cell cell = headerRow.createCell(i);
        cell.setCellValue(titles[i]);
        cell.setCellStyle(styles.get("header"));
    }
    //columns for 11 weeks starting from 9-Jul
    Calendar calendar = Calendar.getInstance();
    int year = calendar.get(Calendar.YEAR);

    //calendar.setTime(fmt.parse("9-11"));
    calendar.set(Calendar.YEAR, year);
    for (int i = 0; i < 11; i++) {
        Cell cell = headerRow.createCell(titles.length + i);
        cell.setCellValue(calendar);
        cell.setCellStyle(styles.get("header_date"));
        calendar.roll(Calendar.WEEK_OF_YEAR, true);
    }
    //freeze the first row
    sheet.createFreezePane(0, 1);

    Row row;
    Cell cell;
    int rownum = 1;
    for (int i = 0; i < data.length; i++, rownum++) {
        row = sheet.createRow(rownum);
        if (data[i] == null)
            continue;

        for (int j = 0; j < data[i].length; j++) {
            cell = row.createCell(j);
            String styleName;
            boolean isHeader = i == 0 || data[i - 1] == null;
            switch (j) {
            case 0:
                if (isHeader) {
                    styleName = "cell_b";
                    cell.setCellValue(Double.parseDouble(data[i][j]));
                } else {
                    styleName = "cell_normal";
                    cell.setCellValue(data[i][j]);
                }
                break;
            case 1:
                if (isHeader) {
                    styleName = i == 0 ? "cell_h" : "cell_bb";
                } else {
                    styleName = "cell_indented";
                }
                cell.setCellValue(data[i][j]);
                break;
            case 2:
                styleName = isHeader ? "cell_b" : "cell_normal";
                cell.setCellValue(data[i][j]);
                break;
            case 3:
                styleName = isHeader ? "cell_b_centered" : "cell_normal_centered";
                cell.setCellValue(Integer.parseInt(data[i][j]));
                break;
            case 4: {
                //calendar.setTime(fmt.parse(data[i][j]));
                calendar.set(Calendar.YEAR, year);
                cell.setCellValue(calendar);
                styleName = isHeader ? "cell_b_date" : "cell_normal_date";
                break;
            }
            case 5: {
                int r = rownum + 1;
                String fmla = "IF(AND(D" + r + ",E" + r + "),E" + r + "+D" + r + ",\"\")";
                cell.setCellFormula(fmla);
                styleName = isHeader ? "cell_bg" : "cell_g";
                break;
            }
            default:
                styleName = data[i][j] != null ? "cell_blue" : "cell_normal";
            }

            cell.setCellStyle(styles.get(styleName));
        }
    }

    //group rows for each phase, row numbers are 0-based
    sheet.groupRow(4, 6);
    sheet.groupRow(9, 13);
    sheet.groupRow(16, 18);

    //set column widths, the width is measured in units of 1/256th of a character width
    sheet.setColumnWidth(0, 256 * 6);
    sheet.setColumnWidth(1, 256 * 33);
    sheet.setColumnWidth(2, 256 * 20);
    sheet.setZoom(3, 4);

    // Write the output to a file
    String file = "businessplan.xls";
    if (wb instanceof XSSFWorkbook)
        file += "x";
    FileOutputStream out = new FileOutputStream(file);
    wb.write(out);
    out.close();
}