Java Code Examples for org.apache.poi.ss.usermodel.Cell#setCellValue()

The following examples show how to use org.apache.poi.ss.usermodel.Cell#setCellValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PerFileSheetV1d2.java    From tools with Apache License 2.0 6 votes vote down vote up
public static void create(Workbook wb, String sheetName) {
	int sheetNum = wb.getSheetIndex(sheetName);
	if (sheetNum >= 0) {
		wb.removeSheetAt(sheetNum);
	}
	Sheet sheet = wb.createSheet(sheetName);
	CellStyle headerStyle = AbstractSheet.createHeaderStyle(wb);	
	CellStyle centerStyle = AbstractSheet.createCenterStyle(wb);
	CellStyle wrapStyle = AbstractSheet.createLeftWrapStyle(wb);
	Row row = sheet.createRow(0);
	for (int i = 0; i < HEADER_TITLES.length; i++) {
		sheet.setColumnWidth(i, COLUMN_WIDTHS[i]*256);
		if (LEFT_WRAP[i]) {
			sheet.setDefaultColumnStyle(i, wrapStyle);
		} else if (CENTER_NOWRAP[i]) {
			sheet.setDefaultColumnStyle(i, centerStyle);
		}
		Cell cell = row.createCell(i);
		cell.setCellStyle(headerStyle);
		cell.setCellValue(HEADER_TITLES[i]);
	}
}
 
Example 2
Source File: SessionEndTimeFlatFileLoader.java    From Open-Lowcode with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected boolean putContentInCell(E currentobject, Cell cell, String context) {
	DataObjectProperty<E> property = propertyextractor.extract(currentobject);
	if (property == null)
		throw new RuntimeException("Technical error in inserting start date: property not found");
	if (!(property instanceof Session))
		throw new RuntimeException("Technical error in inserting start date: property not of correct class: "
				+ property.getClass().getName());
	@SuppressWarnings("unchecked")
	Session<E, F> session = (Session<E, F>) property;
	if (cellStyle == null)
		cellStyle = FlatFileExtractor.createDateStyle(cell.getSheet().getWorkbook(), this.dateformat);
	cell.setCellStyle(cellStyle);
	cell.setCellValue(session.getEndtime());
	return true;
}
 
Example 3
Source File: CreationlogDateFlatFileLoader.java    From Open-Lowcode with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected boolean putContentInCell(E currentobject, Cell cell, String context) {
	DataObjectProperty<E> property = propertyextractor.extract(currentobject);
	if (property == null)
		throw new RuntimeException("Technical error in inserting creation date: property not found");
	if (!(property instanceof Creationlog))
		throw new RuntimeException("Technical error in inserting creation date: property not of correct class: "
				+ property.getClass().getName());
	Creationlog<E> creationlog = (Creationlog<E>) property;
	cell.setCellValue(creationlog.getCreatetime());
	return false;
}
 
Example 4
Source File: PackageServletHandler.java    From urule with Apache License 2.0 5 votes vote down vote up
private void buildSheet(SXSSFWorkbook wb,VariableCategory vc,XSSFCellStyle style){
	String name=vc.getName();
	Sheet sheet=wb.createSheet(name);
	Row row=sheet.createRow(0);
	List<Variable> variables=vc.getVariables();
	for(int i=0;i<variables.size();i++){
		sheet.setColumnWidth(i,4000);
		Cell cell=row.createCell(i);
		Variable var=variables.get(i);
		cell.setCellValue(var.getLabel());
		cell.setCellStyle(style);
	}
}
 
Example 5
Source File: UpdatelogUserFlatFileLoader.java    From Open-Lowcode with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected boolean putContentInCell(E currentobject, Cell cell, String context) {
	DataObjectProperty<E> property = propertyextractor.extract(currentobject);
	if (property == null)
		throw new RuntimeException("Technical error in inserting creation date: property not found");
	if (!(property instanceof Updatelog))
		throw new RuntimeException("Technical error in inserting update date: property not of correct class: "
				+ property.getClass().getName());
	Updatelog<E> updatelog = (Updatelog<E>) property;
	if (updatelog.getUpdateuserid() != null)
		cell.setCellValue(updatelog.getUpdateuserid().getId());
	return false;
}
 
Example 6
Source File: DefaultExcelView.java    From Mario with Apache License 2.0 5 votes vote down vote up
/**
 * 添加 cell
 * 
 * @param row 行号
 * @param column 列号
 * @param val 值
 * @param align 对齐格式
 * @param fieldType 单元格对象
 * @return
 */
private Cell addCell(Row row, int column, Object val, int align, Class<?> fieldType) {
    Cell cell = row.createCell(column);
    try {
        if (val == null) {
            cell.setCellValue("");
        } else if (val instanceof String) {
            cell.setCellValue((String) val);
        } else if (val instanceof Integer) {
            cell.setCellValue((Integer) val);
        } else if (val instanceof Long) {
            cell.setCellValue((Long) val);
        } else if (val instanceof Double) {
            cell.setCellValue((Double) val);
        } else if (val instanceof Float) {
            cell.setCellValue((Float) val);
        } else if (val instanceof Date) {
            cell.setCellValue((Date) val);
        } else {
            if (fieldType != Class.class) {
                cell.setCellValue((String) fieldType.getMethod("setValue", Object.class)
                        .invoke(null, val));
            } else {
                cell.setCellValue((String) Class
                        .forName(
                                this.getClass()
                                        .getName()
                                        .replaceAll(
                                                this.getClass().getSimpleName(),
                                                "fieldtype." + val.getClass().getSimpleName()
                                                        + "Type"))
                        .getMethod("setValue", Object.class).invoke(null, val));
            }
        }
    } catch (Exception ex) {
        cell.setCellValue(val.toString());
    }
    return cell;
}
 
Example 7
Source File: DocumentSheet.java    From tools with Apache License 2.0 5 votes vote down vote up
/**
 * @param comparer
 * @throws SpdxCompareException 
 */
private void importSpdxId(SpdxComparer comparer) throws SpdxCompareException {
	Cell cell = sheet.getRow(getFirstDataRow()).createCell(SPDX_IDENTIFIER_COL);
	cell.setCellValue("N/A");
	// data rows
	for (int i = 0; i < comparer.getNumSpdxDocs(); i++) {
		cell = sheet.getRow(getFirstDataRow()+i+1).createCell(SPDX_IDENTIFIER_COL);
		if (comparer.getSpdxDoc(i).getId() != null) {
			cell.setCellValue(comparer.getSpdxDoc(i).getId());
		}
	}
}
 
Example 8
Source File: ExcelUtil.java    From RuoYi-Vue with MIT License 5 votes vote down vote up
/**
 * 创建单元格
 */
public Cell createCell(Excel attr, Row row, int column)
{
    // 创建列
    Cell cell = row.createCell(column);
    // 写入列信息
    cell.setCellValue(attr.name());
    setDataValidation(attr, row, column);
    cell.setCellStyle(styles.get("header"));
    return cell;
}
 
Example 9
Source File: PoiSheetUtility.java    From jeasypoi with Apache License 2.0 5 votes vote down vote up
private static void cloneCell(Cell cNew, Cell cOld) {
	cNew.setCellComment(cOld.getCellComment());
	cNew.setCellStyle(cOld.getCellStyle());

	switch (cNew.getCellType()) {
	case Cell.CELL_TYPE_BOOLEAN: {
		cNew.setCellValue(cOld.getBooleanCellValue());
		break;
	}
	case Cell.CELL_TYPE_NUMERIC: {
		cNew.setCellValue(cOld.getNumericCellValue());
		break;
	}
	case Cell.CELL_TYPE_STRING: {
		cNew.setCellValue(cOld.getStringCellValue());
		break;
	}
	case Cell.CELL_TYPE_ERROR: {
		cNew.setCellValue(cOld.getErrorCellValue());
		break;
	}
	case Cell.CELL_TYPE_FORMULA: {
		cNew.setCellFormula(cOld.getCellFormula());
		break;
	}
	}

}
 
Example 10
Source File: CreationlogUserFlatFileLoader.java    From Open-Lowcode with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected boolean putContentInCell(E currentobject, Cell cell, String context) {
	DataObjectProperty<E> property = propertyextractor.extract(currentobject);
	if (property == null)
		throw new RuntimeException("Technical error in inserting creation date: property not found");
	if (!(property instanceof Creationlog))
		throw new RuntimeException("Technical error in inserting creation date: property not of correct class: "
				+ property.getClass().getName());
	Creationlog<E> creationlog = (Creationlog<E>) property;
	if (creationlog.getCreateuserid() != null)
		cell.setCellValue(creationlog.getCreateuserid().getId());
	return false;
}
 
Example 11
Source File: excel导出.java    From demo-project with MIT License 5 votes vote down vote up
/**
 * 设置单元格,根据fieldName获取对应的Field类,使用反射得到值
 *
 * @param cell cell
 * @param obj obj
 * @param fieldMap  属性名与Field的映射
 * @param fieldName 属性名
 */
private void setCell(Cell cell, Object obj, Map<String, Field> fieldMap, String fieldName) throws Exception {
    Field field = fieldMap.get(fieldName);
    if(field == null){
        throw new Exception("找不到 "+fieldName+" 数据项");
    }
    Object value = field.get(obj);
    if (value == null) {
        cell.setCellValue("");
    } else {
        switch (field.getGenericType().getTypeName()) {
            case "java.lang.String":
                cell.setCellValue((String) value);
                break;
            case "java.lang.Integer":
            case "int":
                cell.setCellValue((int) value);
                break;
            case "java.lang.Double":
            case "double":
                cell.setCellValue((double) value);
                break;
            case "java.util.Date":
                cell.setCellValue(this.dateFormat.format((Date) value));
                break;
            default:
                cell.setCellValue(obj.toString());
        }
    }
}
 
Example 12
Source File: LicenseSheet.java    From tools with Apache License 2.0 5 votes vote down vote up
public void add(SPDXStandardLicense license) {
	Row row = addRow();
	Cell nameCell = row.createCell(COL_NAME);
	nameCell.setCellValue(license.getName());
	Cell idCell = row.createCell(COL_ID);
	idCell.setCellValue(license.getId());
	if (license.getSourceUrl() != null) {
		Cell sourceUrlCell = row.createCell(COL_SOURCE_URL);
		sourceUrlCell.setCellValue(license.getSourceUrl());
	}
	if (license.getNotes() != null) {
		Cell notesCell = row.createCell(COL_NOTES);
		notesCell.setCellValue(license.getNotes());
	}
	if (license.getStandardLicenseHeader() != null) {
		Cell standardLicenseHeaderCell = row.createCell(COL_STANDARD_LICENSE_HEADER);
		standardLicenseHeaderCell.setCellValue(license.getStandardLicenseHeader());
	}
	Cell textCell = row.createCell(COL_TEXT);
	textCell.setCellValue(license.getText());
	if (license.getTemplate() != null) {
		Cell templateCell = row.createCell(COL_TEMPLATE);
		templateCell.setCellValue(license.getTemplate());
	}
	if (license.isOsiApproved()) {
		Cell osiApprovedCell = row.createCell(COL_OSI_APPROVED);
		osiApprovedCell.setCellValue("YES");
	}
}
 
Example 13
Source File: ExtractedLicenseSheet.java    From tools with Apache License 2.0 5 votes vote down vote up
/**
 * @param comparer
 * @param docNames 
 * @throws InvalidSPDXAnalysisException 
 */
public void importCompareResults(SpdxComparer comparer, String[] docNames) throws SpdxCompareException, InvalidSPDXAnalysisException {
	if (comparer.getNumSpdxDocs() != docNames.length) {
		throw(new SpdxCompareException("Number of document names does not match the number of SPDX documents"));
	}
	this.clear();
	Row header = sheet.getRow(0);
	int[] licenseIndexes = new int[comparer.getNumSpdxDocs()];
	AnyLicenseInfo[][] extractedLicenses = new AnyLicenseInfo[comparer.getNumSpdxDocs()][];
	for (int i = 0; i < extractedLicenses.length; i++) {
		Cell headerCell = header.getCell(FIRST_LIC_ID_COL+i);
		headerCell.setCellValue(docNames[i]);
		AnyLicenseInfo[] docExtractedLicenses = comparer.getSpdxDoc(i).getExtractedLicenseInfos();
		Arrays.sort(docExtractedLicenses, extractedLicenseComparator);
		extractedLicenses[i] = docExtractedLicenses;
		licenseIndexes[i] = 0;
	}
	while (!allLicensesExhausted(extractedLicenses, licenseIndexes)) {
		Row currentRow = this.addRow();
		String extractedLicenseText = getNextExtractedLicenseText(extractedLicenses, licenseIndexes);
		Cell licenseTextCell = currentRow.createCell(EXTRACTED_TEXT_COL);
		licenseTextCell.setCellValue(extractedLicenseText);
		for (int i = 0; i < extractedLicenses.length; i++) {
			if (extractedLicenses[i].length > licenseIndexes[i]) {
				if  (extractedLicenses[i][licenseIndexes[i]] instanceof ExtractedLicenseInfo) {
					String compareExtractedText = ((ExtractedLicenseInfo)extractedLicenses[i][licenseIndexes[i]]).getExtractedText();
					if (LicenseCompareHelper.isLicenseTextEquivalent(extractedLicenseText, 
							compareExtractedText)) {
						Cell licenseIdCell = currentRow.createCell(FIRST_LIC_ID_COL+i);
						licenseIdCell.setCellValue(formatLicenseInfo((ExtractedLicenseInfo)extractedLicenses[i][licenseIndexes[i]]));
						licenseIndexes[i]++;
					}
				} else {
					licenseIndexes[i]++;	// skip any licenses which are not non-standard licenses
				}
			}
		}
	}
}
 
Example 14
Source File: NumberedFlatFileLoader.java    From Open-Lowcode with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected boolean putContentInCell(E currentobject, Cell cell, String context) {
	DataObjectProperty<E> property = propertyextractor.extract(currentobject);
	if (property==null) throw new RuntimeException("could not find property in object");
	if (!( property instanceof Numbered)) throw new RuntimeException("property does not have the correct type, expected Numbered, got "+property.getClass().getSimpleName());
	Numbered<E> numbered = (Numbered<E>) property;
	cell.setCellValue(numbered.getNr());
	return false;
}
 
Example 15
Source File: ExcelUtil.java    From RuoYi-Vue with MIT License 5 votes vote down vote up
/**
 * 添加单元格
 */
public Cell addCell(Excel attr, Row row, T vo, Field field, int column)
{
    Cell cell = null;
    try
    {
        // 设置行高
        row.setHeight((short) (attr.height() * 20));
        // 根据Excel中设置情况决定是否导出,有些情况需要保持为空,希望用户填写这一列.
        if (attr.isExport())
        {
            // 创建cell
            cell = row.createCell(column);
            cell.setCellStyle(styles.get("data"));

            // 用于读取对象中的属性
            Object value = getTargetValue(vo, field, attr);
            String dateFormat = attr.dateFormat();
            String readConverterExp = attr.readConverterExp();
            if (StringUtils.isNotEmpty(dateFormat) && StringUtils.isNotNull(value))
            {
                cell.setCellValue(DateUtils.parseDateToStr(dateFormat, (Date) value));
            }
            else if (StringUtils.isNotEmpty(readConverterExp) && StringUtils.isNotNull(value))
            {
                cell.setCellValue(convertByExp(String.valueOf(value), readConverterExp));
            }
            else
            {
                // 设置列类型
                setCellVo(value, attr, cell);
            }
        }
    }
    catch (Exception e)
    {
        log.error("导出Excel失败{}", e);
    }
    return cell;
}
 
Example 16
Source File: FlatFileExtractor.java    From Open-Lowcode with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * extracts a tree structure into a nodebook
 * 
 * @param sheet            spreadsheet sheet
 * @param line             line to start from
 * @param objecttree       tree of objects to extract
 * @param object           head object
 * @param orderedkeylist   keys list
 * @param normalstyle      the style to use for groupings
 * @param summarystyle     the style to use for summary styles
 * @param columnmaxchar    the size of colums
 * @param recursivebreaker a recursive breaker to avoid server explosion in case
 *                         of recursive structure
 * @return the active line after loading
 */
private int loadWorkbook(Sheet sheet, int line, NodeTree<E> objecttree, E object,
		ArrayList<Triple<String, String, StringDecoder>> orderedkeylist, CellStyle normalstyle,
		CellStyle summarystyle, int[] columnmaxchar, int recursivebreaker) {
	if (recursivebreaker > 1024)
		throw new RuntimeException("Recursive breaker");
	boolean isleaf = false;
	if (objecttree.getChildrenNumber(object) == 0)
		isleaf = true;
	int lineafter = line;
	if (!isleaf) {

		for (int i = 0; i < objecttree.getChildrenNumber(object); i++) {
			lineafter = loadWorkbook(sheet, lineafter, objecttree, objecttree.getChild(object, i), orderedkeylist,
					normalstyle, summarystyle, columnmaxchar, recursivebreaker + 1);
		}
	}
	NamedList<SimpleDataElt> allobjectelements = object.getFieldList();
	Row datarow = sheet.createRow(lineafter);
	for (int i = 0; i < orderedkeylist.size(); i++) {
		String key = orderedkeylist.get(i).getFirst();
		SimpleDataElt elementtostore = allobjectelements.lookupOnName(key);
		Cell cell = datarow.createCell(i + 1);
		if (isleaf)
			cell.setCellStyle(normalstyle);
		if (!isleaf)
			cell.setCellStyle(summarystyle);
		boolean specialformatting = false;
		if (elementtostore == null) {
			cell.setCellValue("");
			specialformatting = true;
		}
		if (elementtostore instanceof DecimalDataElt) {
			BigDecimal payload = ((DecimalDataElt) elementtostore).getPayload();
			if (payload != null)
				cell.setCellValue(payload.doubleValue());
			if (columnmaxchar[i] < 10)
				columnmaxchar[i] = 10;
			specialformatting = true;
		}
		if (elementtostore instanceof DateDataElt) {
			cell.setCellValue(((DateDataElt) elementtostore).getPayload());
			if (columnmaxchar[i] < 15)
				columnmaxchar[i] = 15;
			specialformatting = true;
		}
		if (!specialformatting) {
			StringDecoder decoder = orderedkeylist.get(i).getTriple();
			String value = elementtostore.defaultTextRepresentation();
			if (decoder != null)
				value = decoder.decode(elementtostore.defaultTextRepresentation());
			cell.setCellValue(value);
			if (value != null)
				if (columnmaxchar[i] < value.length())
					columnmaxchar[i] = value.length();

		}
	}
	if (objecttree.getRoot() != object)
		sheet.groupRow(line, lineafter);
	lineafter++;
	return lineafter;

}
 
Example 17
Source File: XLSXDataFormatter.java    From CloverETL-Engine with GNU Lesser General Public License v2.1 4 votes vote down vote up
@SuppressWarnings("deprecation")
@Override
public int write(DataRecord dataRecord) throws IOException {
	if (dataRecord == null) {
		throw new NullPointerException("dataRecord");
	}

	if (sheetData != null) {
		prepareSheet(dataRecord);
		sheet = currentSheetData.sheet;
	} else if (sheet == null) {
		prepareSheet();
	}

	Row newRow = sheet.createRow(currentRowIndex);

	for (int i = 0; i < includedFieldIndices.length; i++) {
		Object fieldValue = dataRecord.getField(includedFieldIndices[i]).getValue();

		if (fieldValue == null) {
			continue;
		}

		Cell newCell = newRow.createCell(firstColumn + i);
		newCell.setCellStyle(cellStyles[i]);

		switch (metadata.getField(includedFieldIndices[i]).getDataType()) {
		case BYTE:
		case CBYTE:
		case STRING:
			newCell.setCellValue(fieldValue.toString());
			break;
		case DATE:
		case DATETIME:
			newCell.setCellValue((Date) fieldValue);
			break;
		case INTEGER:
			newCell.setCellValue((Integer) fieldValue);
			break;
		case LONG:
			newCell.setCellValue((Long) fieldValue);
			break;
		case DECIMAL:
			newCell.setCellValue(((Decimal) fieldValue).getDouble());
			break;
		case NUMBER:
			newCell.setCellValue((Double) fieldValue);
			break;
		case BOOLEAN:
			newCell.setCellValue((Boolean) fieldValue);
			break;
		default:
			break;
		}
	}

	currentRowIndex++;

	if (sheetData != null) {
		currentSheetData.currentRow++;
	}
       
	return 0;
}
 
Example 18
Source File: cfSpreadSheetWrite.java    From openbd-core with GNU General Public License v3.0 4 votes vote down vote up
protected void	writeQueryToSheet( cfQueryResultData queryData, cfSpreadSheetData spreadsheet, String sheetName ) throws dataNotSupportedException{
	Workbook	workbook	= spreadsheet.getWorkBook();
	
	if ( workbook.getSheet(sheetName) != null )
		workbook.removeSheetAt( workbook.getSheetIndex(sheetName) );

	Sheet	sheet	= workbook.createSheet( sheetName );
	
	//WRITE THE SHEET: 1st row to be the columns
	String[] columnList = queryData.getColumnList();
	Row row	= sheet.createRow(0);
	Cell cell;
	for ( int c=0; c < columnList.length; c++ ){
		cell	= row.createCell( c, Cell.CELL_TYPE_STRING );
		cell.setCellValue( columnList[c] );
	}
	
	//WRITE THE SHEET: Write out all the rows
	int rowsToInsert	= queryData.getSize(); 
	for ( int x=0; x < rowsToInsert; x++ ){
		row = sheet.createRow(x + 1);
		
		for ( int c=0; c < columnList.length; c++ ){
			cell	= row.createCell( c );

  		cfData value	= queryData.getCell( x+1, c + 1 );

  		if ( value.getDataType() == cfData.CFNUMBERDATA ){
  			cell.setCellValue( value.getDouble() );
  			cell.setCellType( Cell.CELL_TYPE_NUMERIC );
  		}else if ( value.getDataType() == cfData.CFDATEDATA ){
  			cell.setCellValue( new Date( value.getDateLong() ) );
  		}else if ( value.getDataType() == cfData.CFBOOLEANDATA ){
  			cell.setCellValue( value.getBoolean() );
  			cell.setCellType( Cell.CELL_TYPE_BOOLEAN );
  		}else{
  			cell.setCellValue( value.getString() );
  			cell.setCellType( Cell.CELL_TYPE_STRING );
  		}
  	}
		
	}
}
 
Example 19
Source File: ExcelInsertQuery.java    From micro-integrator with Apache License 2.0 4 votes vote down vote up
private synchronized int executeSQL() throws SQLException {
    int rowCount = 0;
    if (!(getConnection() instanceof TExcelConnection)) {
        throw new SQLException("Connection does not refer to a Excel connection");
    }
    TExcelConnection excelConnection = (TExcelConnection) this.getConnection();
    //begin transaction,
    excelConnection.beginExcelTransaction();
    Workbook workbook = excelConnection.getWorkbook();
    Sheet sheet = workbook.getSheet(getTargetTableName());
    if (sheet == null) {
        throw new SQLException("Excel sheet named '" + this.getTargetTableName() +
                "' does not exist");
    }
    int lastRowNo = sheet.getLastRowNum();

    if (getParameters() != null) {
        Row row = sheet.createRow(lastRowNo + 1);
        for (ParamInfo param : getParameters()) {
            Cell cell = row.createCell(param.getOrdinal());
            switch (param.getSqlType()) {
                case Types.VARCHAR:
                    cell.setCellValue((String) param.getValue());
                    break;
                case Types.INTEGER:
                    cell.setCellValue((Integer) param.getValue());
                    break;
                case Types.DOUBLE:
                    cell.setCellValue((Double) param.getValue());
                    break;
                case Types.BOOLEAN:
                    cell.setCellValue((Boolean) param.getValue());
                    break;
                case Types.DATE:
                    cell.setCellValue((Date) param.getValue());
                    break;
                default:
                    cell.setCellValue((String) param.getValue());
                    break;
            }
        }
        rowCount++;
    }
    TDriverUtil.writeRecords(workbook, ((TExcelConnection) getConnection()).getPath());
    return rowCount;
}
 
Example 20
Source File: PackageInfoSheetV2d2.java    From tools with Apache License 2.0 4 votes vote down vote up
public void add(SpdxPackage pkgInfo) throws InvalidSPDXAnalysisException {
	Row row = addRow();
	Cell nameCell = row.createCell(NAME_COL);
	nameCell.setCellValue(pkgInfo.getName());
	Cell idCell = row.createCell(ID_COL);
	idCell.setCellValue(pkgInfo.getId());
	Cell copyrightCell = row.createCell(DECLARED_COPYRIGHT_COL);
	copyrightCell.setCellValue(pkgInfo.getCopyrightText());
	Cell DeclaredLicenseCol = row.createCell(DECLARED_LICENSE_COL);
	DeclaredLicenseCol.setCellValue(pkgInfo.getLicenseDeclared().toString());
	Cell concludedLicenseCol = row.createCell(CONCLUDED_LICENSE_COL);
	concludedLicenseCol.setCellValue(pkgInfo.getLicenseConcluded().toString());
	Cell fileChecksumCell = row.createCell(FILE_VERIFICATION_VALUE_COL);
	if (pkgInfo.getPackageVerificationCode() != null) {
		fileChecksumCell.setCellValue(pkgInfo.getPackageVerificationCode().getValue());
		Cell verificationExcludedFilesCell = row.createCell(VERIFICATION_EXCLUDED_FILES_COL);
		StringBuilder excFilesStr = new StringBuilder();
		String[] excludedFiles = pkgInfo.getPackageVerificationCode().getExcludedFileNames();
		if (excludedFiles.length > 0) {
			excFilesStr.append(excludedFiles[0]);
			for (int i = 1;i < excludedFiles.length; i++) {
				excFilesStr.append(", ");
				excFilesStr.append(excludedFiles[i]);
			}
		}
		verificationExcludedFilesCell.setCellValue(excFilesStr.toString());
	}

	if (pkgInfo.getDescription() != null) {
		Cell descCell = row.createCell(FULL_DESC_COL);
		descCell.setCellValue(pkgInfo.getDescription());
	}
	Cell fileNameCell = row.createCell(MACHINE_NAME_COL);
	fileNameCell.setCellValue(pkgInfo.getPackageFileName());
	Cell checksumsCell = row.createCell(PACKAGE_CHECKSUMS_COL);
	Checksum[] checksums = pkgInfo.getChecksums();
	checksumsCell.setCellValue(CompareHelper.checksumsToString(checksums));
	// add the license infos in files in multiple rows
	AnyLicenseInfo[] licenseInfosInFiles = pkgInfo.getLicenseInfoFromFiles();
	if (licenseInfosInFiles != null && licenseInfosInFiles.length > 0) {
		StringBuilder sb = new StringBuilder(licenseInfosInFiles[0].toString());
		for (int i = 1; i < licenseInfosInFiles.length; i++) {
			sb.append(',');
			sb.append(licenseInfosInFiles[i].toString());
		}
		row.createCell(LICENSE_INFO_IN_FILES_COL).setCellValue(sb.toString());
	}
	if (pkgInfo.getLicenseComments() != null) {
		row.createCell(LICENSE_COMMENT_COL).setCellValue(pkgInfo.getLicenseComments());
	}
	if (pkgInfo.getSummary() != null) {
		Cell shortDescCell = row.createCell(SHORT_DESC_COL);
		shortDescCell.setCellValue(pkgInfo.getSummary());
	}
	if (pkgInfo.getSourceInfo() != null) {
		Cell sourceInfoCell = row.createCell(SOURCE_INFO_COL);
		sourceInfoCell.setCellValue(pkgInfo.getSourceInfo());
	}
	Cell urlCell = row.createCell(DOWNLOAD_URL_COL);
	urlCell.setCellValue(pkgInfo.getDownloadLocation());
	if (pkgInfo.getVersionInfo() != null) {
		Cell versionInfoCell = row.createCell(VERSION_COL);
		versionInfoCell.setCellValue(pkgInfo.getVersionInfo());
	}
	if (pkgInfo.getOriginator() != null) {
		Cell originatorCell = row.createCell(ORIGINATOR_COL);
		originatorCell.setCellValue(pkgInfo.getOriginator());
	}
	if (pkgInfo.getSupplier() != null) {
		Cell supplierCell = row.createCell(SUPPLIER_COL);
		supplierCell.setCellValue(pkgInfo.getSupplier());
	}
	if (pkgInfo.getHomepage() != null) {
		Cell homePageCell = row.createCell(HOME_PAGE_COL);
		homePageCell.setCellValue(pkgInfo.getHomepage());
	}
	if (pkgInfo.getAttributionText() != null) {
		Cell attributionTextCell = row.createCell(ATTRIBUTION_COL);
		attributionTextCell.setCellValue(PerFileSheet.stringsToCsv(pkgInfo.getAttributionText()));
	}
	Cell filesAnalyzedCell = row.createCell(FILES_ANALYZED_COL);
	if (pkgInfo.isFilesAnalyzed()) {
		filesAnalyzedCell.setCellValue("true");
	} else {
		filesAnalyzedCell.setCellValue("false");
	}
}