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 columnIndex, CellType type) 

Source Link

Document

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

Usage

From source file:com.efficio.fieldbook.web.nursery.service.impl.ExcelExportStudyServiceImpl.java

License:Open Source License

private void writeStudyDetailRow(HSSFWorkbook xlsBook, HSSFSheet xlsSheet, int currentRowNum, String label,
        String value) {//  w  ww  .  jav  a 2 s.  c o m
    Locale locale = LocaleContextHolder.getLocale();
    HSSFRow row = xlsSheet.createRow(currentRowNum);
    HSSFCell cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
    cell.setCellStyle(getHeaderStyle(xlsBook, 153, 51, 0));
    cell.setCellValue(messageSource.getMessage(label, null, locale));
    cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
    cell.setCellValue(value);
}

From source file:com.efficio.fieldbook.web.nursery.service.impl.ExcelExportStudyServiceImpl.java

License:Open Source License

private void writeSectionHeader(HSSFWorkbook xlsBook, HSSFSheet xlsSheet, int currentRowNum, String typeLabel,
        int c1, int c2, int c3) {
    Locale locale = LocaleContextHolder.getLocale();
    HSSFRow row = xlsSheet.createRow(currentRowNum);

    HSSFCell cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
    cell.setCellStyle(getHeaderStyle(xlsBook, c1, c2, c3));
    cell.setCellValue(messageSource.getMessage(typeLabel, null, locale));

    cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
    cell.setCellStyle(getHeaderStyle(xlsBook, c1, c2, c3));
    cell.setCellValue(messageSource.getMessage("export.study.description.column.description", null, locale));

    cell = row.createCell(2, HSSFCell.CELL_TYPE_STRING);
    cell.setCellStyle(getHeaderStyle(xlsBook, c1, c2, c3));
    cell.setCellValue(messageSource.getMessage("export.study.description.column.property", null, locale));

    cell = row.createCell(3, HSSFCell.CELL_TYPE_STRING);
    cell.setCellStyle(getHeaderStyle(xlsBook, c1, c2, c3));
    cell.setCellValue(messageSource.getMessage("export.study.description.column.scale", null, locale));

    cell = row.createCell(4, HSSFCell.CELL_TYPE_STRING);
    cell.setCellStyle(getHeaderStyle(xlsBook, c1, c2, c3));
    cell.setCellValue(messageSource.getMessage("export.study.description.column.method", null, locale));

    cell = row.createCell(5, HSSFCell.CELL_TYPE_STRING);
    cell.setCellStyle(getHeaderStyle(xlsBook, c1, c2, c3));
    cell.setCellValue(messageSource.getMessage("export.study.description.column.datatype", null, locale));

    cell = row.createCell(6, HSSFCell.CELL_TYPE_STRING);
    cell.setCellStyle(getHeaderStyle(xlsBook, c1, c2, c3));
    cell.setCellValue(messageSource.getMessage("export.study.description.column.value", null, locale));

    cell = row.createCell(7, HSSFCell.CELL_TYPE_STRING);
    cell.setCellStyle(getHeaderStyle(xlsBook, c1, c2, c3));
    cell.setCellValue(messageSource.getMessage("export.study.description.column.label", null, locale));
}

From source file:com.efficio.fieldbook.web.nursery.service.impl.ExcelExportStudyServiceImpl.java

License:Open Source License

private void writeSectionRow(int currentRowNum, HSSFSheet xlsSheet, MeasurementVariable variable) {
    HSSFRow row = xlsSheet.createRow(currentRowNum);

    HSSFCell cell = row.createCell(0, HSSFCell.CELL_TYPE_STRING);
    cell.setCellValue(variable.getName());

    cell = row.createCell(1, HSSFCell.CELL_TYPE_STRING);
    cell.setCellValue(variable.getDescription());

    cell = row.createCell(2, HSSFCell.CELL_TYPE_STRING);
    cell.setCellValue(variable.getProperty());

    cell = row.createCell(3, HSSFCell.CELL_TYPE_STRING);
    cell.setCellValue(variable.getScale());

    cell = row.createCell(4, HSSFCell.CELL_TYPE_STRING);
    cell.setCellValue(variable.getMethod());

    cell = row.createCell(5, HSSFCell.CELL_TYPE_STRING);
    cell.setCellValue(variable.getDataType());

    cell = row.createCell(6, HSSFCell.CELL_TYPE_STRING);
    cell.setCellValue(variable.getValue());

    cell = row.createCell(7, HSSFCell.CELL_TYPE_STRING);
    cell.setCellValue(variable.getLabel());
}