Example usage for org.apache.poi.hssf.usermodel HSSFRow createCell

List of usage examples for org.apache.poi.hssf.usermodel HSSFRow createCell

Introduction

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

Prototype

@Override
public HSSFCell createCell(int column) 

Source Link

Document

Use this to create new cells within the row and return it.

Usage

From source file:com.fota.qualityMgt.controller.ModemQualityInfoExcelDown.java

License:Open Source License

@Override
protected void buildExcelDocument(Map<String, Object> model, HSSFWorkbook workbook, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    String date = DateTimeUtil.getCurrentDate();
    String formNm = "";
    String fileName = date + "_" + formNm;
    String sheetName = "sheet1";

    response.setContentType("application/vnd.ms-excel;charset=UTF-8");
    response.setHeader("Content-disposition",
            "attachent; filename=" + new String((fileName).getBytes("KSC5601"), "8859_1") + ".xls");

    @SuppressWarnings("unchecked")
    List<ModemQulSearchVO> resultData = (List<ModemQulSearchVO>) model.get("resultData");

    HSSFSheet sheet = workbook.createSheet(sheetName);

    //  ?// www  .j a  v  a  2s  .c om
    HSSFRow header = sheet.createRow(0);
    header.createCell(0).setCellValue("");
    header.createCell(1).setCellValue("");
    //(ctn)  
    header.createCell(2).setCellValue("?");
    header.createCell(3).setCellValue("??");
    header.createCell(4).setCellValue("");
    header.createCell(5).setCellValue("?");
    header.createCell(6).setCellValue("");
    header.createCell(7).setCellValue("RAT");
    header.createCell(8).setCellValue("RSSI");
    header.createCell(9).setCellValue("?");

    int index = 0;
    for (int i = 0; i < resultData.size(); i++) {
        ModemQulSearchVO fvo = resultData.get(i);
        HSSFRow row = sheet.createRow(++index);
        row.createCell(0).setCellValue(fvo.getBizNm());
        row.createCell(1).setCellValue(fvo.getSvcNm());
        row.createCell(2).setCellValue(fvo.getDevMakerNm());
        row.createCell(3).setCellValue(fvo.getDevModelNm());
        row.createCell(4).setCellValue(fvo.getModemMakerNm());
        row.createCell(5).setCellValue(fvo.getModemModelNm());
        row.createCell(6).setCellValue("(?)");
        row.createCell(7).setCellValue(fvo.getRat());
        row.createCell(8).setCellValue(fvo.getRssi());
        row.createCell(9).setCellValue(fvo.getLastAccDt());
    }

    workbook.write(response.getOutputStream());
    response.getOutputStream().close();
}

From source file:com.fota.qualityMgt.controller.QualityInfoExcelDown.java

License:Open Source License

@Override
protected void buildExcelDocument(Map<String, Object> model, HSSFWorkbook workbook, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    String date = DateTimeUtil.getCurrentDate();
    String formNm = "";
    String fileName = date + "_" + formNm;
    String sheetName = "sheet1";

    response.setContentType("application/vnd.ms-excel;charset=UTF-8");
    response.setHeader("Content-disposition",
            "attachent; filename=" + new String((fileName).getBytes("KSC5601"), "8859_1") + ".xls");

    @SuppressWarnings("unchecked")
    List<QulSearchVO> resultData = (List<QulSearchVO>) model.get("resultData");

    HSSFSheet sheet = workbook.createSheet(sheetName);

    //  ?//from ww w  .j a v a 2  s. co m
    HSSFRow header = sheet.createRow(0);
    header.createCell(0).setCellValue("");
    header.createCell(1).setCellValue("");
    //(ctn)  
    header.createCell(2).setCellValue("?");
    header.createCell(3).setCellValue("??");
    header.createCell(4).setCellValue("");
    header.createCell(5).setCellValue("?");
    header.createCell(6).setCellValue("?");
    header.createCell(7).setCellValue("ErrorDesc");
    header.createCell(8).setCellValue("");
    header.createCell(9).setCellValue("RAT");
    header.createCell(10).setCellValue("RSSI");
    header.createCell(11).setCellValue("()");
    header.createCell(12).setCellValue("???");
    header.createCell(13).setCellValue("??");

    int index = 0;
    for (int i = 0; i < resultData.size(); i++) {
        QulSearchVO fvo = resultData.get(i);
        HSSFRow row = sheet.createRow(++index);
        row.createCell(0).setCellValue(fvo.getBizNm());
        row.createCell(1).setCellValue(fvo.getSvcNm());
        //(ctn)  
        row.createCell(2).setCellValue(fvo.getDevMakerNm());
        row.createCell(3).setCellValue(fvo.getDevModelNm());
        row.createCell(4).setCellValue(fvo.getModemMakerNm());
        row.createCell(5).setCellValue(fvo.getModemModelNm());
        row.createCell(6).setCellValue(fvo.getDevQulInfo());
        row.createCell(7).setCellValue(fvo.getErrorDesc());
        row.createCell(8).setCellValue("(?)");
        row.createCell(9).setCellValue(fvo.getRat());
        row.createCell(10).setCellValue(fvo.getRssi());
        row.createCell(11).setCellValue(fvo.getQulAccCycle());
        row.createCell(12).setCellValue(fvo.getDevNonAccPeriod());
        row.createCell(13).setCellValue(fvo.getLastAccDt());
    }

    workbook.write(response.getOutputStream());
    response.getOutputStream().close();
}

From source file:com.fota.statMgt.controller.StatDevExcelDown.java

License:Open Source License

@Override
protected void buildExcelDocument(Map<String, Object> model, HSSFWorkbook workbook, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    String date = DateTimeUtil.getCurrentDate();
    String formNm = "?";
    String fileName = date + "_" + formNm;
    String sheetName = "sheet1";

    response.setContentType("application/vnd.ms-excel;charset=UTF-8");
    response.setHeader("Content-disposition",
            "attachent; filename=" + new String((fileName).getBytes("KSC5601"), "8859_1") + ".xls");

    @SuppressWarnings("unchecked")
    List<StatDevSearchVO> resultData = (List<StatDevSearchVO>) model.get("resultData");

    HSSFSheet sheet = workbook.createSheet(sheetName);

    //  ?/* w w  w.j ava2s . c  o m*/
    HSSFRow header = sheet.createRow(0);
    header.createCell(0).setCellValue("FOTA TYPE");
    header.createCell(1).setCellValue("");
    header.createCell(2).setCellValue("");
    header.createCell(3).setCellValue("?");
    header.createCell(4).setCellValue("??");
    header.createCell(5).setCellValue("??");
    header.createCell(6).setCellValue("??");
    header.createCell(7).setCellValue("??");
    header.createCell(8).setCellValue("??");

    int index = 0;
    for (int i = 0; i < resultData.size(); i++) {
        StatDevSearchVO fvo = resultData.get(i);
        HSSFRow row = sheet.createRow(++index);
        row.createCell(0).setCellValue(fvo.getFotaType());
        row.createCell(1).setCellValue(fvo.getBizNm());
        row.createCell(2).setCellValue(fvo.getSvcNm());
        row.createCell(3).setCellValue(fvo.getDevMakerNm());
        row.createCell(4).setCellValue(fvo.getDevModelNm());
        row.createCell(5).setCellValue(fvo.getDevCntDtFrom());
        row.createCell(6).setCellValue(fvo.getDevCntDtTo());
        row.createCell(7).setCellValue(fvo.getIncDevCnt());
        row.createCell(8).setCellValue(fvo.getSumDevCntNow());
    }

    workbook.write(response.getOutputStream());
    response.getOutputStream().close();
}

From source file:com.fota.statMgt.controller.StatFotaExcelDown.java

License:Open Source License

@Override
protected void buildExcelDocument(Map<String, Object> model, HSSFWorkbook workbook, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    String date = DateTimeUtil.getCurrentDate();
    String formNm = "FOTA";
    String fileName = date + "_" + formNm;
    String sheetName = "sheet1";

    response.setContentType("application/vnd.ms-excel;charset=UTF-8");
    response.setHeader("Content-disposition",
            "attachent; filename=" + new String((fileName).getBytes("KSC5601"), "8859_1") + ".xls");

    @SuppressWarnings("unchecked")
    List<StatFotaSearchVO> resultData = (List<StatFotaSearchVO>) model.get("resultData");

    HSSFSheet sheet = workbook.createSheet(sheetName);

    //  ?/*from w  ww  .j  a  v a 2 s.  c  om*/
    HSSFRow header = sheet.createRow(0);
    header.createCell(0).setCellValue("??");
    header.createCell(1).setCellValue("FOTA TYPE");
    header.createCell(2).setCellValue("");
    header.createCell(3).setCellValue("");
    header.createCell(4).setCellValue("?");
    header.createCell(5).setCellValue("??");
    header.createCell(6).setCellValue("");
    header.createCell(7).setCellValue("?");
    header.createCell(8).setCellValue("");
    header.createCell(9).setCellValue("?");
    header.createCell(10).setCellValue("");
    header.createCell(11).setCellValue("");
    header.createCell(12).setCellValue("");
    header.createCell(13).setCellValue("");
    header.createCell(14).setCellValue("(%)");

    int index = 0;
    for (int i = 0; i < resultData.size(); i++) {
        StatFotaSearchVO fvo = resultData.get(i);
        HSSFRow row = sheet.createRow(++index);
        row.createCell(0).setCellValue(fvo.getCretDt());
        row.createCell(1).setCellValue(fvo.getFotaType());
        row.createCell(2).setCellValue(fvo.getBizNm());
        row.createCell(3).setCellValue(fvo.getSvcNm());
        row.createCell(4).setCellValue(fvo.getDevMakerNm());
        row.createCell(5).setCellValue(fvo.getDevModelNm());
        row.createCell(6).setCellValue(fvo.getFirmwareMakerVer());
        row.createCell(7).setCellValue(fvo.getEarlyCnt());
        row.createCell(8).setCellValue(fvo.getWaitCnt());
        row.createCell(9).setCellValue(fvo.getVersionChkCnt());
        row.createCell(10).setCellValue(fvo.getProcessCnt());
        row.createCell(11).setCellValue(fvo.getSuccessCnt());
        row.createCell(12).setCellValue(fvo.getFailCnt());
        row.createCell(13).setCellValue(fvo.getTotal());
        row.createCell(14).setCellValue(fvo.getSuccessRate());
    }

    workbook.write(response.getOutputStream());
    response.getOutputStream().close();
}

From source file:com.frameworkset.platform.sanylog.util.POIExcelUtil.java

License:Open Source License

/**
 * Excel Workbook?./*from  ww w .  j  a  va 2s .  com*/
 * 
 * @param colDesc 17"?:user_id,??:user_name,:type_name"
 * @param dataList
 * @return
 * @author gw_liaozh
 * @throws InvocationTargetException 
 * @throws IllegalAccessException 
 * @throws IllegalArgumentException 
 */
public static HSSFWorkbook createHSSFWorkbook(String colDesc, List<?> dataList)
        throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
    //???17
    //TODO: ?
    List<String> colTitleList = getColumnTitleList(colDesc);
    List<String> colFieldList = getColumnFieldList(colDesc);

    HSSFWorkbook wb = new HSSFWorkbook();
    HSSFSheet sheet = wb.createSheet();

    HSSFFont font = getBaseFont(wb);
    HSSFCellStyle headCellStyle = getHeadCellStyle(wb, font);

    //?
    CellStyle dateCellStyle = getDateTimeCellStyle(wb);

    //CellStyle strCellStyle = getStringCellStyle(wb);

    //??17
    HSSFDataValidationHelper dvHelper = new HSSFDataValidationHelper(sheet);
    Map<String, Class<?>> fieldTypeMap = new HashMap<String, Class<?>>();

    //
    HSSFRow titleRow = sheet.createRow(0);
    for (int i = 0; i < colTitleList.size(); i++) {
        HSSFCell cell = titleRow.createCell(i);
        cell.setCellStyle(headCellStyle);
        cell.setCellType(HSSFCell.CELL_TYPE_STRING);
        cell.setCellValue(colTitleList.get(i));
    }

    //?17
    for (int i = 0; i < dataList.size(); i++) {
        Object obj = dataList.get(i);
        HSSFRow row = sheet.createRow(i + 1);
        for (int j = 0; j < colFieldList.size(); j++) {
            String fieldName = colFieldList.get(j);
            HSSFCell cell = row.createCell(j);
            if (obj == null) {
                continue;
            }
            Object value = BeanConvertUtil.getProperty(obj, fieldName);
            //ClassInfo classInfo = ClassUtil.getClassInfo(obj.getClass());
            //Object value = classInfo.getPropertyDescriptor(fieldName).getValue(obj);
            if (value == null) {
                continue;
            }
            //??
            if (value instanceof Number) {
                cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC);
                cell.setCellValue(((Number) value).doubleValue());
            } else if (value instanceof Date) {
                cell.setCellStyle(dateCellStyle);
                cell.setCellValue((Date) value);
            } else {
                cell.setCellType(HSSFCell.CELL_TYPE_STRING);
                //cell.setCellStyle(strCellStyle);
                cell.setCellValue(value.toString());
            }
            fieldTypeMap.put(fieldName, value.getClass());
        }
    }

    //??
    for (int i = 0; i < colFieldList.size(); i++) {
        String fieldName = colFieldList.get(i);
        Class<?> fieldClass = fieldTypeMap.get(fieldName);
        if (fieldClass == null) {
            continue;
        }
        CellRangeAddressList range = new CellRangeAddressList(1, 65535, i, i);
        DataValidationConstraint constraint = null;
        if (Integer.class.isAssignableFrom(fieldClass)) {
            constraint = dvHelper.createIntegerConstraint(DataValidationConstraint.OperatorType.NOT_BETWEEN,
                    "0", "-1");
            sheet.addValidationData(dvHelper.createValidation(constraint, range));
        } else if (Number.class.isAssignableFrom(fieldClass)) {
            constraint = dvHelper.createNumericConstraint(DataValidationConstraint.ValidationType.DECIMAL,
                    DataValidationConstraint.OperatorType.NOT_BETWEEN, "0", "-1");
            sheet.addValidationData(dvHelper.createValidation(constraint, range));
        } else if (Date.class.isAssignableFrom(fieldClass)) {
            constraint = dvHelper.createDateConstraint(DataValidationConstraint.OperatorType.NOT_BETWEEN,
                    "0000-01-02", "0000-01-01", "yyyy-MM-dd");
            sheet.addValidationData(dvHelper.createValidation(constraint, range));
        }
    }

    //
    for (int i = 0; i < colTitleList.size(); i++) {
        //??
        //sheet.autoSizeColumn(i);
    }

    return wb;
}

From source file:com.github.dougkelly88.FLIMPlateReaderGUI.SequencingClasses.Classes.FilterTableModel.java

public void saveFilterTableModelAsSpreadsheet() {

    // Save FilterTable in second sheet of wb .xls
    // Initialize second sheet
    HSSFSheet sheet2 = HCAFLIMPluginFrame.wb.createSheet("SpectralSequencing");

    // Initialize first row with headers
    int RowSize = data_.size();
    HSSFRow row0 = sheet2.createRow(0);
    HSSFCell cell00 = row0.createCell(0);
    HSSFCell cell01 = row0.createCell(1);
    HSSFCell cell02 = row0.createCell(2);
    HSSFCell cell03 = row0.createCell(3);
    HSSFCell cell04 = row0.createCell(4);
    HSSFCell cell05 = row0.createCell(5);
    HSSFCell cell06 = row0.createCell(6);
    HSSFCell cell07 = row0.createCell(7);

    cell00.setCellValue("Label");
    cell01.setCellValue("Ex filter");
    cell02.setCellValue("ND filter");
    cell03.setCellValue("Dichroic");
    cell04.setCellValue("Em filter");
    cell05.setCellValue("Filter Cube");
    cell06.setCellValue("Camera integration (ms)");
    cell07.setCellValue("Delays");

    // write row for row from table to .xls       
    for (int RowNum = 0; RowNum < RowSize; RowNum++) {
        HSSFRow row = sheet2.createRow(RowNum + 1);
        HSSFCell cell0 = row.createCell(0);
        HSSFCell cell1 = row.createCell(1);
        HSSFCell cell2 = row.createCell(2);
        HSSFCell cell3 = row.createCell(3);
        HSSFCell cell4 = row.createCell(4);
        HSSFCell cell5 = row.createCell(5);
        HSSFCell cell6 = row.createCell(6);
        HSSFCell cell7 = row.createCell(7);

        cell0.setCellValue(data_.get(RowNum).getLabel());
        cell1.setCellValue(data_.get(RowNum).getExFilt());
        cell2.setCellValue(data_.get(RowNum).getNDFilt());
        cell3.setCellValue(data_.get(RowNum).getDiFilt());
        cell4.setCellValue(data_.get(RowNum).getEmFilt());
        cell5.setCellValue(data_.get(RowNum).getCube());
        cell6.setCellValue(data_.get(RowNum).getIntTime());

        // convert Array<List> to String like "[0, 1000, 2000, 3000]" and write it to .xls      
        ArrayList<Integer> a = new ArrayList<Integer>();
        a = data_.get(RowNum).getDelays();
        List<String> newList = new ArrayList<String>(a.size());
        for (Integer myInt : a) {
            newList.add(String.valueOf(myInt));
        }/*from   www .j  ava  2 s.  c  om*/
        String b = "[";
        for (String s : newList) {
            b += s + ", ";
        }
        int s = b.length();
        b = b.substring(0, s - 2);
        b = b + "]";
        cell7.setCellValue(b);

    }

}

From source file:com.github.dougkelly88.FLIMPlateReaderGUI.SequencingClasses.Classes.FOVTableModel.java

public void saveFOVTableModelAsSpreadsheet() {

    // Save FilterTable in first sheet of wb .xls
    // Initialize first sheet
    HSSFSheet sheet1 = HCAFLIMPluginFrame.wb.createSheet("XYSequencing");

    // Initialize first row with headers    
    int RowSize = data_.size();
    HSSFRow row0 = sheet1.createRow(0);
    HSSFCell cell00 = row0.createCell(0);
    HSSFCell cell01 = row0.createCell(1);
    HSSFCell cell02 = row0.createCell(2);
    HSSFCell cell03 = row0.createCell(3);
    HSSFCell cell04 = row0.createCell(4);
    cell00.setCellValue("Well");
    cell01.setCellValue("X " + um);
    cell02.setCellValue("Y" + um);
    cell03.setCellValue("Z" + um);
    cell04.setCellValue("Group");

    // write row for row from table to sheet        
    for (int RowNum = 0; RowNum < RowSize; RowNum++) {
        HSSFRow row = sheet1.createRow(RowNum + 1);
        HSSFCell cell0 = row.createCell(0);
        HSSFCell cell1 = row.createCell(1);
        HSSFCell cell2 = row.createCell(2);
        HSSFCell cell3 = row.createCell(3);
        HSSFCell cell4 = row.createCell(4);
        cell0.setCellValue(data_.get(RowNum).getWell());
        cell1.setCellValue(data_.get(RowNum).getX());
        cell2.setCellValue(data_.get(RowNum).getY());
        cell3.setCellValue(data_.get(RowNum).getZ());
        cell4.setCellValue(data_.get(RowNum).getGroup());
    }/*from   w  ww  .ja  v a 2 s. c  o m*/

    //To change body of generated methods, choose Tools | Templates.
}

From source file:com.github.dougkelly88.FLIMPlateReaderGUI.SequencingClasses.Classes.TimeCourseTableModel.java

public void saveTimeCourseTableModelAsSpreadsheet() {

    // Save FilterTable in third sheet of wb .xls
    // Initialize third sheet
    HSSFSheet sheet3 = HCAFLIMPluginFrame.wb.createSheet("TimeCourseSequencing");

    // Initialize first row with headers    
    int RowSize = data_.size();
    HSSFRow row0 = sheet3.createRow(0);
    HSSFCell cell00 = row0.createCell(0);
    HSSFCell cell01 = row0.createCell(1);
    HSSFCell cell02 = row0.createCell(2);
    cell00.setCellValue("Time (s)");
    cell01.setCellValue("Liquid dispense?");
    cell02.setCellValue("Liquid dispension well(s)");

    // write row for row from table to sheet        
    for (int RowNum = 0; RowNum < RowSize; RowNum++) {
        HSSFRow row = sheet3.createRow(RowNum + 1);
        HSSFCell cell0 = row.createCell(0);
        HSSFCell cell1 = row.createCell(1);
        HSSFCell cell2 = row.createCell(2);
        cell0.setCellValue(data_.get(RowNum).getTimeCell());
        cell1.setCellValue(data_.get(RowNum).getLDState());
        cell2.setCellValue((RichTextString) data_.get(RowNum).getLdWells());

    }//from  w w  w  . j a v  a 2 s . c  o m

    //To change body of generated methods, choose Tools | Templates.
}

From source file:com.grant.data.ItemDAO.java

public List getAllItemOutReport() throws FileNotFoundException, IOException {

    ResultSet rs = null;//from  ww w . j a  va2  s .c om
    Connection dbConn = null;
    List ss = null;

    try {
        dbConn = dbConnManager.connect();

        Statement stmt = dbConn.createStatement();

        String query = "SELECT * FROM grant_item_out";
        //String query = "INSERT INTO grant_item_out(v_item_name,v_item_no,v_ref_code,v_descrip,v_invo_no,i_outwards,i_balance,d_in_date)  " + "VALUES( '" + itemName + "','" + itemNo + "','" + refCode +  "','"+ description + "','" + invoiceNo + "','" + outwards + "','" + balance +  "','"+ itemInDate + "'" + ")";

        System.out.println(query);

        rs = stmt.executeQuery(query);

        /////////////
        HSSFWorkbook workbook = new HSSFWorkbook();
        HSSFSheet sheet = workbook.createSheet("lawix10");
        HSSFRow rowhead = sheet.createRow((short) 0);
        rowhead.createCell((short) 0).setCellValue("CellHeadName1");
        rowhead.createCell((short) 1).setCellValue("CellHeadName2");
        rowhead.createCell((short) 2).setCellValue("CellHeadName3");
        int i = 1;
        while (rs.next()) {
            HSSFRow row = sheet.createRow((short) i);
            // row.createCell((short) 0).setCellValue(Integer.toString(rs.getInt("column1")));
            row.createCell((short) 1).setCellValue(rs.getString(1));
            row.createCell((short) 2).setCellValue(rs.getString(2));
            i++;
        }
        String yemi = "C:/Users/Isura Amarasinghe/Desktop/test.xls";
        //C:/Users/Isura Amarasinghe/Desktop
        FileOutputStream fileOut = new FileOutputStream(yemi);
        workbook.write(fileOut);
        fileOut.close();
        ///////////

    } catch (SQLException sQLException) {

        System.out.println(sQLException + "-----------Insert query failed-------");

        rs = null;
    } finally {
        dbConnManager.con_close(dbConn);
    }
    return ss;
}

From source file:com.grant.data.ItemDAO.java

public boolean getStockINReport(ReportICatogory rrc) throws FileNotFoundException, IOException {

    ResultSet rs = null;//  w  w w . ja  va2s.  c  o  m
    Connection dbConn = null;
    boolean ss = false;

    try {
        dbConn = dbConnManager.connect();

        Statement stmt = dbConn.createStatement();
        String query = "SELECT * FROM grant_item_in WHERE d_in_date BETWEEN '" + rrc.getItemIDateStart()
                + "' AND '" + rrc.getItemInDateEnd() + "'";
        System.out.println(query);

        rs = stmt.executeQuery(query);
        HSSFWorkbook workbook = new HSSFWorkbook();
        HSSFSheet sheet = workbook.createSheet("lawix10");
        HSSFRow rowhead = sheet.createRow((short) 0);

        rowhead.createCell((short) 1).setCellValue("Item ID");
        rowhead.createCell((short) 2).setCellValue("v_item_name");
        rowhead.createCell((short) 3).setCellValue("v_item_no");
        rowhead.createCell((short) 4).setCellValue("v_descrip");
        rowhead.createCell((short) 5).setCellValue("i_inwards");
        rowhead.createCell((short) 6).setCellValue("i_balance");
        rowhead.createCell((short) 7).setCellValue("v_type");
        rowhead.createCell((short) 8).setCellValue("d_in_date");
        rowhead.createCell((short) 9).setCellValue("i_unit_price");

        int i = 1;
        while (rs.next()) {
            HSSFRow row = sheet.createRow((short) i);
            //row.createCell((short) 0).setCellValue(Integer.toString(rs.getInt(0)));
            row.createCell((short) 1).setCellValue(rs.getString(1));
            row.createCell((short) 2).setCellValue(rs.getString(2));
            row.createCell((short) 3).setCellValue(rs.getString(3));
            row.createCell((short) 4).setCellValue(rs.getString(4));
            row.createCell((short) 5).setCellValue(rs.getString(5));
            row.createCell((short) 6).setCellValue(rs.getString(6));
            row.createCell((short) 7).setCellValue(rs.getString(7));
            row.createCell((short) 8).setCellValue(rs.getString(8));
            row.createCell((short) 9).setCellValue(rs.getString(9));

            i++;
        }

        FileDateTime fileDateTime = new FileDateTime();
        FileOutputStream fileOut = new FileOutputStream(fileDateTime.getFileName("Stock_In"));
        workbook.write(fileOut);
        ss = true;
    } catch (SQLException sQLException) {
        ss = false;
        System.out.println(sQLException + "-----------Insert query failed-------");
        rs = null;
    } finally {
        dbConnManager.con_close(dbConn);
    }
    return ss;
}