Example usage for org.apache.poi.hssf.usermodel HSSFCell setCellValue

List of usage examples for org.apache.poi.hssf.usermodel HSSFCell setCellValue

Introduction

In this page you can find the example usage for org.apache.poi.hssf.usermodel HSSFCell setCellValue.

Prototype

@SuppressWarnings("fallthrough")
public void setCellValue(boolean value) 

Source Link

Document

set a boolean value for the cell

Usage

From source file:com.cimmyt.reports.impl.ServiceReportKBioImpl.java

License:Apache License

private void loadListGenotypingSewrvices() {
    int size = setShipmentDetail.iterator().next().getStSampleDetail().getLabstudyid().getPlatesize();
    HSSFSheet sheetgrid = listBook.getSheetAt(5);
    HSSFCell cellStyle = sheetgrid.getRow(11).getCell(0);
    HSSFCellStyle style = cellStyle.getCellStyle();
    HSSFCell cellStyleIntertek = sheetgrid.getRow(19).getCell(11);
    HSSFCellStyle styleIntertek = cellStyleIntertek.getCellStyle();
    if (size == SIZE_PLATE_96) {
        rowsplate = 8;//w ww . ja va  2  s . c  om
        colsplate = 12;
    } else {
        rowsplate = 16;
        colsplate = 24;
    }

    LinkedHashMap<String, Map<String, SampleDetail>> mapPlates = new LinkedHashMap<String, Map<String, SampleDetail>>();
    for (ShipmentDetail shipmentDetail : setShipmentDetail) {

        SampleDetail detail = shipmentDetail.getStSampleDetail();
        if (mapPlates.containsKey(detail.getPlatename())) {
            Map<String, SampleDetail> map = mapPlates.get(detail.getPlatename());
            String letter = detail.getPlateloc().substring(0, 1);
            String number = detail.getPlateloc().substring(1, detail.getPlateloc().length());
            map.put(getEquivalenceInInteger(letter) + "|" + number, detail);
        } else {
            Map<String, SampleDetail> map = new HashMap<String, SampleDetail>();
            String letter = detail.getPlateloc().substring(0, 1);
            String number = detail.getPlateloc().substring(1, detail.getPlateloc().length());
            map.put(getEquivalenceInInteger(letter) + "|" + number, detail);
            mapPlates.put(detail.getPlatename(), map);
        }
    }

    Iterator<Entry<String, Map<String, SampleDetail>>> it = mapPlates.entrySet().iterator();
    int row = 10;
    int column = 0;
    while (it.hasNext()) {
        Map.Entry<String, Map<String, SampleDetail>> entry = (Entry<String, Map<String, SampleDetail>>) it
                .next();
        if (entry.getKey() != null) {
            Map<String, SampleDetail> map = entry.getValue();
            validateRow(sheetgrid, row);
            HSSFCell cellPlateName = validateCell(sheetgrid, row, 0);
            cellPlateName.setCellValue("Plate");
            cellPlateName.setCellStyle(style);
            HSSFCell cellPlate = validateCell(sheetgrid, row, 1);
            cellPlate.setCellValue(entry.getKey());
            row = row + 1;
            drawingFormatPlate(style, sheetgrid, row);
            for (int indexRow = 1; indexRow <= rowsplate; indexRow++) {
                for (int indexCol = 1; indexCol <= colsplate; indexCol++) {

                    SampleDetail detail = map.get(indexRow + "|" + indexCol);
                    validateRow(sheetgrid, row + indexRow);
                    HSSFCellStyle styleCell = null;
                    if (detail.getControltype() != null && !detail.getControltype().equals(""))
                        styleCell = validateStatusSample(detail.getControltype());
                    else {
                        styleCell = styleCellNormally;
                    }
                    if (sheetgrid.getRow(row + indexRow).getCell(column + indexCol) == null)
                        sheetgrid.getRow(row + indexRow).createCell(column + indexCol);
                    HSSFCell cell = sheetgrid.getRow(row + indexRow).getCell(column + indexCol);
                    if (detail.getSamplegid() == null
                            || (detail.getControltype() != null && !detail.getControltype().equals(""))) {
                        cell.setCellValue(mapBlank.get(detail.getStudysampleid()));
                        cell.setCellStyle(styleCell);
                    } else {
                        styleCell = styleCellNormally;
                        cell.setCellValue(detail.getLabstudyid().getPrefix()
                                + (detail.getLabstudyid().isUsePadded()
                                        ? StrUtils.getPaddingCeros(detail.getSamplegid())
                                        : String.valueOf(detail.getSamplegid()))
                                + "-" + detail.getStudysampleid());
                    }
                    detail.getPlateloc();
                    if (detail.getPlateloc().equals("H11") || detail.getPlateloc().equals("H12")) {
                        cell.setCellStyle(styleIntertek);
                    }
                }
            }
            row = row + rowsplate;
            row = row + 2;
        }

    }
}

From source file:com.cimmyt.reports.impl.ServiceReportKBioImpl.java

License:Apache License

private void loadStyleandText(HSSFCell cell, HSSFCellStyle style, String value) {
    cell.setCellStyle(style);
    cell.setCellValue(value);
}

From source file:com.cimmyt.reports.impl.ServiceReportKBioImpl.java

License:Apache License

private void loadStyleandText(HSSFCell cell, HSSFCellStyle style, int value) {
    cell.setCellStyle(style);
    cell.setCellValue(value);
}

From source file:com.cimmyt.reports.impl.ServiceReportKBioImpl.java

License:Apache License

private void loadListGridIntertek() {
    int size = setShipmentDetail.iterator().next().getStSampleDetail().getLabstudyid().getPlatesize();
    HSSFSheet sheetgrid = listBook.getSheetAt(4);
    HSSFCell cellStyle = sheetgrid.getRow(5).getCell(2);
    HSSFCellStyle style = cellStyle.getCellStyle();
    if (size == SIZE_PLATE_96) {
        rowsplate = 8;/*from   www  .j a  va 2s  .  com*/
        colsplate = 12;
    } else {
        rowsplate = 16;
        colsplate = 24;
    }

    LinkedHashMap<String, Map<String, SampleDetail>> mapPlates = new LinkedHashMap<String, Map<String, SampleDetail>>();
    for (ShipmentDetail shipmentDetail : setShipmentDetail) {
        SampleDetail detail = shipmentDetail.getStSampleDetail();
        if (mapPlates.containsKey(detail.getPlatename())) {
            Map<String, SampleDetail> map = mapPlates.get(detail.getPlatename());
            String letter = detail.getPlateloc().substring(0, 1);
            String number = detail.getPlateloc().substring(1, detail.getPlateloc().length());
            map.put(getEquivalenceInInteger(letter) + "|" + number, detail);
        } else {
            Map<String, SampleDetail> map = new HashMap<String, SampleDetail>();
            String letter = detail.getPlateloc().substring(0, 1);
            String number = detail.getPlateloc().substring(1, detail.getPlateloc().length());
            map.put(getEquivalenceInInteger(letter) + "|" + number, detail);
            mapPlates.put(detail.getPlatename(), map);
        }
    }

    Iterator<Entry<String, Map<String, SampleDetail>>> it = mapPlates.entrySet().iterator();
    int row = 4;
    int column = 2;
    while (it.hasNext()) {
        Map.Entry<String, Map<String, SampleDetail>> entry = (Entry<String, Map<String, SampleDetail>>) it
                .next();
        if (entry.getKey() != null) {

            Map<String, SampleDetail> map = entry.getValue();
            validateRow(sheetgrid, row);
            HSSFCell cellPlate = validateCell(sheetgrid, row, 1);
            cellPlate.setCellValue(entry.getKey());
            row = row + 1;
            drawingFormatPlate(style, sheetgrid, row);
            for (int indexRow = 1; indexRow <= rowsplate; indexRow++) {
                for (int indexCol = 1; indexCol <= colsplate; indexCol++) {
                    SampleDetail detail = map.get(indexRow + "|" + indexCol);
                    validateRow(sheetgrid, row + indexRow);
                    HSSFCellStyle styleCell = null;
                    if (detail.getControltype() != null && !detail.getControltype().equals(""))
                        styleCell = validateStatusSample(detail.getControltype());
                    else {
                        styleCell = styleCellNormally;
                    }
                    if (sheetgrid.getRow(row + indexRow).getCell(column + indexCol) == null)
                        sheetgrid.getRow(row + indexRow).createCell(column + indexCol);
                    HSSFCell cell = sheetgrid.getRow(row + indexRow).getCell(column + indexCol);
                    if (detail.getSamplegid() == null
                            || (detail.getControltype() != null && !detail.getControltype().equals(""))) {
                        cell.setCellValue("BLANK");
                        cell.setCellStyle(styleCell);
                    } else {
                        styleCell = styleCellNormally;
                        cell.setCellValue(
                                detail.getLabstudyid().getPrefix() + (detail.getLabstudyid().isUsePadded()
                                        ? StrUtils.getPaddingCeros(detail.getSamplegid())
                                        : String.valueOf(detail.getSamplegid())));
                    }
                }
            }
            row = row + rowsplate;
            row = row + 2;
        }

    }
}

From source file:com.cimmyt.reports.impl.ServiceReportLaboratoryImpl.java

License:Apache License

private HSSFWorkbook createBookPlateExcel(StudyLabReportBean beanReport) {
    HSSFWorkbook book = new HSSFWorkbook();
    // Create a new Sheet in book
    HSSFSheet sheet = book.createSheet();
    // Creates a new row for headers
    HSSFRow row = sheet.createRow(0);/*from  w  w w .j  a v  a 2  s .  c o  m*/
    // Creates a new cell for title
    HSSFCell cell = row.createCell(0);
    // Create cell contents.
    HSSFRichTextString text = new HSSFRichTextString("");
    cell.setCellValue(text);
    // Creates a new
    HSSFRow rowHeaders = sheet.createRow(2);
    styleCellNormallyHeader = styleCellNormally(book, true);
    styleCellNormally = styleCellNormally(book, false);
    styleCellControl = getStyleCeldSolidForeground(book, cellControl);
    styleCellControlDART = getStyleCeldSolidForeground(book, cellControlDART);
    styleCellControlRandom = getStyleCeldSolidForeground(book, cellControlRandom);
    styleCellControlKBIo = getStyleCeldSolidForeground(book, cellKBiocontrolRandom);
    styleCellBlank = getStyleCeldSolidForeground(book, cellBlankForegroundColor);
    if (beanReport.getMapPlateSamples().size() > 0) {
        Iterator iteratorMapFirst = beanReport.getMapPlateSamples().entrySet().iterator();
        int rowCounter = 1;
        while (iteratorMapFirst.hasNext()) {
            Map.Entry entry = (Map.Entry) iteratorMapFirst.next();
            Map<String, SampleDetail> mapInner = (Map<String, SampleDetail>) entry.getValue();
            Integer key = (Integer) entry.getKey();
            sheet.createRow(rowCounter);
            rowCounter++;
            rowCounter = createHeaderPlate(sheet, rowCounter, beanReport.getNumberColumn(),
                    styleCellNormallyHeader, beanReport.getPatternPlate() + key.toString());
            int rowCounterLabel = 0;

            for (int sizeRow = 0; sizeRow < beanReport.getNameRow().length; sizeRow++) {
                HSSFRow rowData = sheet.createRow(rowCounter);

                for (int sizeColumn = 0; sizeColumn <= beanReport.getNumberColumn(); sizeColumn++) {
                    if (sizeColumn == 0) {
                        writeCell(rowData, sizeColumn, beanReport.getNameRow()[rowCounterLabel],
                                styleCellNormallyHeader);
                        rowCounterLabel++;
                    } else {
                        SampleDetail detail = mapInner.get(beanReport.getPatternPlate() + key.toString()
                                + beanReport.getNameRow()[sizeRow] + (sizeColumn));
                        if (detail != null) {
                            HSSFCellStyle style = null;
                            String sampleName = "";
                            if (detail.getControltype() != null && !detail.getControltype().equals(""))
                                style = validateStatusSample(detail.getControltype());
                            else
                                sampleName = getFieldsReport(beanReport, detail);
                            String strDetail = getTemplateFiled(detail);
                            if (strDetail != null && !strDetail.isEmpty()) {
                                if (!sampleName.isEmpty()) {
                                    sampleName = sampleName + "\n" + strDetail;
                                } else {
                                    sampleName = sampleName + strDetail;
                                }
                            }

                            writeCell(rowData, sizeColumn, sampleName, style);
                        }
                    }
                }
                rowCounter++;
            }
        }
        return book;
    }
    return null;
}

From source file:com.cimmyt.reports.impl.ServiceReportLaboratoryImpl.java

License:Apache License

private void writeCell(HSSFRow rowData, int sizeColumn, String strValue, HSSFCellStyle style) {
    HSSFCell dataCell = rowData.createCell(sizeColumn);
    HSSFRichTextString cellValue = new HSSFRichTextString(strValue);
    if (style != null)
        dataCell.setCellStyle(style);//  w w  w  .j  av a  2 s. co  m
    dataCell.setCellType(HSSFCell.CELL_TYPE_STRING);
    dataCell.setCellValue(cellValue);
}

From source file:com.cimmyt.reports.impl.ServiceReportLaboratoryImpl.java

License:Apache License

private void loadDataCell(HSSFRow rowData, String value, int index, HSSFCellStyle styleCellNormallyHeader) {
    HSSFCell dataCell = rowData.createCell(index);
    HSSFRichTextString cellValue = new HSSFRichTextString(value);
    dataCell.setCellStyle(styleCellNormallyHeader);
    dataCell.setCellType(HSSFCell.CELL_TYPE_STRING);
    dataCell.setCellValue(cellValue);
}

From source file:com.cimmyt.reports.impl.ServiceReportLaboratoryImpl.java

License:Apache License

private HSSFWorkbook getBookResultData(ResultDataExportDataBean resultDataExport, PropertyHelper pro,
        SortedMap<Integer, ResultsPreferencesDetail> sortedMap) {
    HSSFWorkbook book = new HSSFWorkbook();
    HSSFSheet sheet = book.createSheet();
    HSSFRow filaDatGral;// ww w.j ava 2  s . c  o m
    HSSFCell cellDatGral;
    HSSFRichTextString textDatGral;

    filaDatGral = sheet.createRow(0);
    cellDatGral = filaDatGral.createCell(0);
    textDatGral = new HSSFRichTextString(pro.getKey(LBL_GENERIC_PLATE));
    cellDatGral.setCellValue(textDatGral);
    cellDatGral = filaDatGral.createCell(1);
    textDatGral = new HSSFRichTextString(resultDataExport.getListPlate());
    cellDatGral.setCellValue(textDatGral);

    filaDatGral = sheet.createRow(1);
    cellDatGral = filaDatGral.createCell(0);
    textDatGral = new HSSFRichTextString(pro.getKey(LBL_GENERIC_EXPORT));
    cellDatGral.setCellValue(textDatGral);
    cellDatGral = filaDatGral.createCell(1);
    textDatGral = new HSSFRichTextString(resultDataExport.getNameExport());
    cellDatGral.setCellValue(textDatGral);
    filaDatGral = sheet.createRow(2);
    cellDatGral = filaDatGral.createCell(0);
    textDatGral = new HSSFRichTextString("Date");
    cellDatGral.setCellValue(textDatGral);
    cellDatGral = filaDatGral.createCell(1);
    textDatGral = new HSSFRichTextString(resultDataExport.getDateExport());
    cellDatGral.setCellValue(textDatGral);
    HSSFRow filaEncabezos = sheet.createRow(6);
    int colCounter = 0;
    for (ResultsPreferencesDetail resultsPreferencesDetail : sortedMap.values()) {
        HSSFCell headerCell = filaEncabezos.createCell(colCounter);
        HSSFRichTextString headerText = new HSSFRichTextString(resultsPreferencesDetail.getHeader());
        headerCell.setCellValue(headerText);
        colCounter++;
    }
    int rowCounter = 7;
    colCounter = 0;
    for (RowResultDataBean bean : resultDataExport.getListResults()) {
        HSSFRow rowData = sheet.createRow(rowCounter);
        colCounter = 0;
        for (String str : bean.getListCell()) {

            if (str != null) {
                HSSFCell dataCell = rowData.createCell(colCounter);
                HSSFRichTextString cellValue = new HSSFRichTextString(str);
                dataCell.setCellValue(cellValue);
            }
            colCounter++;
        }
        rowCounter++;
    }
    return book;
}

From source file:com.claim.controller.Center16AndJula2015Controller.java

public ProgrameStatus center16_Jula_2015(OppReport report) {

    ProgrameStatus programeStatus = new ProgrameStatus();
    List<ObjRptChula> listData = new ArrayList<ObjRptChula>();
    int col_last = 29;
    int row_start = 8; // index row
    int row_formula_start = row_start + 1;
    int col_txtid_width = col_last + 1;
    try {/*from w ww  .ja v  a  2 s  . c o m*/
        connection = new DBManage().open();
        Center16AndChula2015DAO chula2015DAO = new Center16AndChula2015DAO();
        chula2015DAO.setConnection(connection);

        if (report.getServiceCode().equals(HCODE_CENTER16)) { // center 16
            listData = chula2015DAO.getListChulaDetail(report.getStmp(), HCODE_CENTER16);
            EXCELL_HEADER1 = "???? OP : "
                    + chula2015DAO.getMonthPayment(report.getStmp());
            EXCELL_HEADER2 = "? 16    13661  Model 2 ";
            EXCELL_HOSPITAL = "??  ? 16   13661 ";

            //out 
            out = new FileOutputStream(report.getPathFile() + "" + File.separator + "HC16_13661_"
                    + report.getYearMonth() + "-" + report.getNo() + ".xls");
            report.setServiceName(
                    " ? 16 ");
        } else if (report.getServiceCode().equals(HCODE_CHULA)) { //  Jula
            listData = chula2015DAO.getListChulaDetail(report.getStmp(), HCODE_CHULA);
            EXCELL_HEADER1 = "???? OP : "
                    + chula2015DAO.getMonthPayment(report.getStmp());
            EXCELL_HEADER2 = "? 16    13661  Model 2";
            EXCELL_HOSPITAL = "??  ?  ?     13756";

            //out 
            out = new FileOutputStream(report.getPathFile() + "" + File.separator + "Chula_13756_"
                    + report.getYearMonth() + "-" + report.getNo() + ".xls");
            report.setServiceName("?");
        }

        //readTemplate 
        file = new FileInputStream(
                new File("." + File.separator + "xls" + File.separator + "CH16_CHula_detail_2015.xls"));

        // style Excell
        HSSFWorkbook wbCenter16Jula = new HSSFWorkbook(file);
        this.loadStyle(wbCenter16Jula);

        // Start sheet 1 *******************************************************************************
        HSSFSheet sheet = workbookBase.getSheetAt(0);

        sheet.createFreezePane(4, 8); // col,row
        sheet.setColumnWidth(col_txtid_width, WIDTH_TXID);

        HSSFCell cell = null;
        HSSFRow row = null;

        // row 0 HEADER0
        row = sheet.createRow(0);
        row.setHeight((short) 390);
        cell = row.createCell(0);
        cell.setCellValue(EXCELL_HEADER1);
        sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, col_last));
        cell.setCellStyle(csHead);

        // row 1 HEADER2
        row = sheet.createRow(1);
        row.setHeight((short) 390);
        cell = row.createCell(0);
        cell.setCellValue(EXCELL_HEADER2);
        sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, col_last));
        cell.setCellStyle(csHead);

        // row 1 HOSPITAL
        row = sheet.createRow(2);
        row.setHeight((short) 390);
        cell = row.createCell(0);
        cell.setCellValue(EXCELL_HOSPITAL);
        sheet.addMergedRegion(new CellRangeAddress(2, 2, 0, col_last));
        cell.setCellStyle(csHead);

        int curRow = row_start;
        int i = 1;

        for (int j = 0; j < listData.size(); j++) {
            ObjRptChula data = listData.get(j);
            int col1 = i;

            row = sheet.createRow(curRow);
            row.setHeight((short) 340);

            /*PoiHssfUtil stylePoi = new PoiHssfUtil(wb, row, cell);
             stylePoi.setStyleText(0, String.valueOf(col1), PoiHssfUtil.CENTER);*/
            cell = row.createCell(0);
            cell.setCellValue(col1);
            cell.setCellStyle(csNum4);

            cell = row.createCell(1);
            cell.setCellValue(data.getPid());
            cell.setCellStyle(csStringPid);

            cell = row.createCell(2);
            cell.setCellValue(data.getHn());
            cell.setCellStyle(csStringLeft);

            cell = row.createCell(3);
            cell.setCellValue(data.getPname());
            cell.setCellStyle(csStringLeft);

            cell = row.createCell(4);
            cell.setCellValue(data.getHmain());
            cell.setCellStyle(csStringLeft);

            cell = row.createCell(5);
            cell.setCellValue(data.getDateopd_th());
            cell.setCellStyle(csStringLeft);

            cell = row.createCell(6);
            cell.setCellValue(data.getPdxcode());
            cell.setCellStyle(csNum4);

            cell = row.createCell(7);
            cell.setCellValue(data.getChrg_car());
            cell.setCellStyle(csDouble2);

            cell = row.createCell(8);
            cell.setCellValue(data.getChrg_rehab_inst());
            cell.setCellStyle(csDouble2);

            cell = row.createCell(9);
            cell.setCellValue(data.getChrg_ophc());
            cell.setCellStyle(csDouble2);

            cell = row.createCell(10);
            cell.setCellValue(data.getChrg_car_rehabinst_ophc_total());
            cell.setCellStyle(csDouble2);

            cell = row.createCell(11);
            cell.setCellValue(data.getChrg_202());
            cell.setCellStyle(csDouble2);

            cell = row.createCell(12);
            cell.setCellValue(data.getChrg_stditem());
            cell.setCellStyle(csDouble2);

            cell = row.createCell(13);
            cell.setCellValue(data.getChrg_other());
            cell.setCellStyle(csDouble2);

            cell = row.createCell(14);
            cell.setCellValue(data.getChrg_total());
            cell.setCellStyle(csDouble2);

            cell = row.createCell(15);
            cell.setCellValue(data.getSum_chrg());
            cell.setCellStyle(csDouble2);

            cell = row.createCell(16);
            cell.setCellValue(data.getPaid_car());
            cell.setCellStyle(csDouble2);

            cell = row.createCell(17);
            cell.setCellValue(data.getPaid_rehab_inst());
            cell.setCellStyle(csDouble2);

            cell = row.createCell(18);
            cell.setCellValue(data.getPaid_ophc());
            cell.setCellStyle(csDouble2);

            cell = row.createCell(19);
            cell.setCellValue(data.getPaid_car_rehabinst_ophc_total());
            cell.setCellStyle(csDouble2);

            cell = row.createCell(20);
            cell.setCellValue(data.getPaid_202());
            cell.setCellStyle(csDouble2);

            cell = row.createCell(21);
            cell.setCellValue(data.getPaid_stditem());
            cell.setCellStyle(csDouble2);

            cell = row.createCell(22);
            cell.setCellValue(data.getPaid_other());
            cell.setCellStyle(csDouble2);

            cell = row.createCell(23);
            cell.setCellValue(data.getPaid_202_stditem_other_total());
            cell.setCellStyle(csDouble2);

            cell = row.createCell(24);
            cell.setCellValue(data.getPaid_cal_point());
            cell.setCellStyle(csDouble2);

            cell = row.createCell(25);
            cell.setCellValue(data.getPaid_cal_point_total());
            cell.setCellStyle(csDouble2);

            cell = row.createCell(26);
            cell.setCellValue(data.getPaid_total());
            cell.setCellStyle(csDouble2);

            cell = row.createCell(27);
            cell.setCellValue(data.getCompensation_fee_total());
            cell.setCellStyle(csDouble2);

            cell = row.createCell(28);
            cell.setCellValue(data.getRemark());
            cell.setCellStyle(csStringLeft);

            cell = row.createCell(29);
            cell.setCellValue(data.getInvoice_no());
            cell.setCellStyle(csStringLeft);

            cell = row.createCell(30);
            cell.setCellValue(data.getTxid());
            cell.setCellStyle(csStringtxid);

            curRow++;
            i++;

        }

        // 
        row = sheet.createRow(curRow);
        cell = row.createCell(0);
        cell.setCellValue("");
        sheet.addMergedRegion(new CellRangeAddress(curRow, curRow, 0, 6));
        cell.setCellStyle(csNum4B);

        row.createCell(1).setCellStyle(csNum4B);
        row.createCell(2).setCellStyle(csNum4B);
        row.createCell(3).setCellStyle(csNum4B);
        row.createCell(4).setCellStyle(csNum4B);
        row.createCell(5).setCellStyle(csNum4B);
        row.createCell(6).setCellStyle(csNum4B);

        cell = row.createCell(7);
        cell.setCellFormula(builderFormulaSum(7, row_formula_start, curRow));
        cell.setCellStyle(csDouble2B);

        cell = row.createCell(8);
        cell.setCellFormula(builderFormulaSum(8, row_formula_start, curRow));
        cell.setCellStyle(csDouble2B);

        cell = row.createCell(9);
        cell.setCellFormula(builderFormulaSum(9, row_formula_start, curRow));
        cell.setCellStyle(csDouble2B);

        cell = row.createCell(10);
        cell.setCellFormula(builderFormulaSum(10, row_formula_start, curRow));
        cell.setCellStyle(csDouble2B);

        cell = row.createCell(11);
        cell.setCellFormula(builderFormulaSum(11, row_formula_start, curRow));
        cell.setCellStyle(csDouble2B);

        cell = row.createCell(12);
        cell.setCellFormula(builderFormulaSum(12, row_formula_start, curRow));
        cell.setCellStyle(csDouble2B);

        cell = row.createCell(13);
        cell.setCellFormula(builderFormulaSum(13, row_formula_start, curRow));
        cell.setCellStyle(csDouble2B);

        cell = row.createCell(14);
        cell.setCellFormula(builderFormulaSum(14, row_formula_start, curRow));
        cell.setCellStyle(csDouble2B);

        cell = row.createCell(15);
        cell.setCellFormula(builderFormulaSum(15, row_formula_start, curRow));
        cell.setCellStyle(csDouble2B);

        cell = row.createCell(16);
        cell.setCellFormula(builderFormulaSum(16, row_formula_start, curRow));
        cell.setCellStyle(csDouble2B);

        cell = row.createCell(17);
        cell.setCellFormula(builderFormulaSum(17, row_formula_start, curRow));
        cell.setCellStyle(csDouble2B);

        cell = row.createCell(18);
        cell.setCellFormula(builderFormulaSum(18, row_formula_start, curRow));
        cell.setCellStyle(csDouble2B);

        cell = row.createCell(19);
        cell.setCellFormula(builderFormulaSum(19, row_formula_start, curRow));
        cell.setCellStyle(csDouble2B);

        cell = row.createCell(20);
        cell.setCellFormula(builderFormulaSum(20, row_formula_start, curRow));
        cell.setCellStyle(csDouble2B);

        cell = row.createCell(21);
        cell.setCellFormula(builderFormulaSum(21, row_formula_start, curRow));
        cell.setCellStyle(csDouble2B);

        cell = row.createCell(22);
        cell.setCellFormula(builderFormulaSum(22, row_formula_start, curRow));
        cell.setCellStyle(csDouble2B);

        cell = row.createCell(23);
        cell.setCellFormula(builderFormulaSum(23, row_formula_start, curRow));
        cell.setCellStyle(csDouble2B);

        cell = row.createCell(24);
        cell.setCellFormula(builderFormulaSum(24, row_formula_start, curRow));
        cell.setCellStyle(csDouble2B);

        cell = row.createCell(25);
        cell.setCellFormula(builderFormulaSum(25, row_formula_start, curRow));
        cell.setCellStyle(csDouble2B);

        cell = row.createCell(26);
        cell.setCellFormula(builderFormulaSum(26, row_formula_start, curRow));
        cell.setCellStyle(csDouble2B);

        cell = row.createCell(27);
        cell.setCellFormula(builderFormulaSum(27, row_formula_start, curRow));
        cell.setCellStyle(csDouble2B);

        cell = row.createCell(28);
        cell.setCellStyle(csNum4B);

        workbookBase.setSheetName(0, report.getServiceCode() + "  " + report.getServiceName());

        workbookBase.write(out);

        out.close();
        file.close();

        Console.LOG(Message.exportSuccess(report.getServiceName()), 1);
        programeStatus.setMessage(ConstantMessage.MSG_REPORT_SUCCESS);
        programeStatus.setTitle(ConstantMessage.MSG_REPORT_COMPLETE);
        programeStatus.setProcessStatus(true);
    } catch (Exception e) {
        e.printStackTrace();
        Console.LOG(e.getMessage(), 0);
        programeStatus.setMessage(ConstantMessage.MSG_PROCESS_FAILS + e.toString());
        programeStatus.setTitle(ConstantMessage.MSG_CONTACT_ADMIN);
        programeStatus.setProcessStatus(false);
    } finally {
        if (connection != null) {
            try {
                connection.close();
            } catch (SQLException ex) {
                Logger.getLogger(Center16AndJula2015Controller.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }
    return programeStatus;
}

From source file:com.claudesoft.service.CarTbDetailed.java

@Override
void makeTableHead(HSSFSheet sheet) {
    HSSFRow row = null;/*  w w  w.j  ava 2s .  com*/
    HSSFCell cell = null;
    row = sheet.createRow(2);
    for (int j = 0; j < this.columnCount; j++) {

        //
        if (j == 0) {
            sheet.setColumnWidth(j, 10 * 256);
        } else {
            sheet.setColumnWidth(j, 15 * 256);
        }
        cell = row.createCell(j);
        cell.setCellStyle(makeTableHeadStyle());
    }

    cell = sheet.getRow(2).getCell(0);
    cell.setCellValue("");
    cell = sheet.getRow(2).getCell(1);
    cell.setCellValue("");
    cell = sheet.getRow(2).getCell(2);
    cell.setCellValue("");
    cell = sheet.getRow(2).getCell(3);
    cell.setCellValue("");
    cell = sheet.getRow(2).getCell(4);
    cell.setCellValue("");
    cell = sheet.getRow(2).getCell(5);
    cell.setCellValue("");
    cell = sheet.getRow(2).getCell(6);
    cell.setCellValue("");
    cell = sheet.getRow(2).getCell(7);
    cell.setCellValue("");
    cell = sheet.getRow(2).getCell(8);
    cell.setCellValue("");
    cell = sheet.getRow(2).getCell(9);
    cell.setCellValue("");
    cell = sheet.getRow(2).getCell(10);
    cell.setCellValue("");
    cell = sheet.getRow(2).getCell(11);
    cell.setCellValue("");

}