当前位置: 首页>>代码示例>>Java>>正文


Java XSSFCell.CELL_TYPE_BLANK属性代码示例

本文整理汇总了Java中org.apache.poi.xssf.usermodel.XSSFCell.CELL_TYPE_BLANK属性的典型用法代码示例。如果您正苦于以下问题:Java XSSFCell.CELL_TYPE_BLANK属性的具体用法?Java XSSFCell.CELL_TYPE_BLANK怎么用?Java XSSFCell.CELL_TYPE_BLANK使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.poi.xssf.usermodel.XSSFCell的用法示例。


在下文中一共展示了XSSFCell.CELL_TYPE_BLANK属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCellValue

/**
 * Gets the cell value.
 *
 * @param cell the cell
 * @return the cell value
 */
private String getCellValue( XSSFCell cell )
{
	if (cell != null)
	{
		switch (cell.getCellType())
		{
			case XSSFCell.CELL_TYPE_BLANK:
				return null;
			case XSSFCell.CELL_TYPE_BOOLEAN:
				return String.valueOf( cell.getBooleanCellValue() );
			case XSSFCell.CELL_TYPE_NUMERIC:
				return String.valueOf( ( int ) cell.getNumericCellValue() );
			case XSSFCell.CELL_TYPE_STRING:
				return cell.getRichStringCellValue().toString();

		}
	}
	return null;
}
 
开发者ID:xframium,项目名称:xframium-java,代码行数:25,代码来源:ExcelDataProvider.java

示例2: stringValueOf

protected String stringValueOf(CellValue value) {
    switch (value.getCellType()) {
        case XSSFCell.CELL_TYPE_STRING:
            return value.getStringValue();
        case XSSFCell.CELL_TYPE_NUMERIC:
            return String.valueOf(value.getNumberValue());
        case XSSFCell.CELL_TYPE_BLANK:
            return "";
        case XSSFCell.CELL_TYPE_BOOLEAN:
            return String.valueOf(value.getBooleanValue());
        case XSSFCell.CELL_TYPE_ERROR:
            return "error";
        default:
            return "unknown";
    }
}
 
开发者ID:aalexandrov,项目名称:arch-tools,代码行数:16,代码来源:ClusteringService.java

示例3: getCellValue

/**
 * Gets the cell value.
 *
 * @param cell the cell
 * @return the cell value
 */
private String getCellValue( XSSFCell cell )
{
	if (cell != null)
	{
		switch (cell.getCellType())
		{
			case XSSFCell.CELL_TYPE_BLANK:
				return null;
			case XSSFCell.CELL_TYPE_BOOLEAN:
				return String.valueOf( cell.getBooleanCellValue() );
			case XSSFCell.CELL_TYPE_NUMERIC:
				return String.valueOf( cell.getNumericCellValue() );
			case XSSFCell.CELL_TYPE_STRING:
				return cell.getRichStringCellValue().toString();
		}
	}
	return null;
}
 
开发者ID:xframium,项目名称:xframium-java,代码行数:24,代码来源:ExcelCloudProvider.java

示例4: getCellValue

/**
 * Gets the cell value.
 *
 * @param cell the cell
 * @return the cell value
 */
private String getCellValue( XSSFCell cell )
{
	if (cell != null)
	{
		switch (cell.getCellType())
		{
			case XSSFCell.CELL_TYPE_BLANK:
				return null;
			case XSSFCell.CELL_TYPE_BOOLEAN:
				return String.valueOf( cell.getBooleanCellValue() );
			case XSSFCell.CELL_TYPE_NUMERIC:
			{
			    String useValue = String.valueOf( cell.getNumericCellValue() );
			    if ( useValue.endsWith( ".0" ) )
			        return useValue.split( "\\." )[0];
			    else
			        return useValue;
			}
			case XSSFCell.CELL_TYPE_STRING:
				return cell.getRichStringCellValue().toString();
		}
	}
	return null;
}
 
开发者ID:xframium,项目名称:xframium-java,代码行数:30,代码来源:ExcelPageDataProvider.java

示例5: getCellValue

private String getCellValue( XSSFCell cell )
{
    if (cell != null )
    {
        switch (cell.getCellType())
        {
            case XSSFCell.CELL_TYPE_BLANK:
                return null;
            case XSSFCell.CELL_TYPE_BOOLEAN:
                return String.valueOf( cell.getBooleanCellValue() );
            case XSSFCell.CELL_TYPE_NUMERIC:
                return String.valueOf( cell.getNumericCellValue() );
            case XSSFCell.CELL_TYPE_STRING:
                return cell.getRichStringCellValue().toString();
        }
    }
    return null;
}
 
开发者ID:xframium,项目名称:xframium-java,代码行数:18,代码来源:ExcelKeyWordProvider.java

示例6: getCellTypeName

/**
 * 获取单元格类型名称
 *
 * @param cell
 * @return
 *
 */
public static String getCellTypeName(XSSFCell cell) {
    if (cell == null) {
        return "null";
    }

    switch (cell.getCellType()) {
    case XSSFCell.CELL_TYPE_BLANK: return "CELL_TYPE_BLANK";
    case XSSFCell.CELL_TYPE_BOOLEAN: return "CELL_TYPE_BOOLEAN";
    case XSSFCell.CELL_TYPE_ERROR: return "CELL_TYPE_ERROR";
    case XSSFCell.CELL_TYPE_FORMULA: return "CELL_TYPE_FORMULA";
    case XSSFCell.CELL_TYPE_NUMERIC: return "CELL_TYPE_NUMERIC";
    case XSSFCell.CELL_TYPE_STRING: return "CELL_TYPE_STRING";
    default: return "unknown";
    }
}
 
开发者ID:hjj2017,项目名称:xgame-code_server,代码行数:22,代码来源:XSSFUtil.java

示例7: cellValues2String

/**
 * Get the value of the excel-cell as String.
 * 
 * @param workbook
 *            workbook (excel) for evaluating cell formulas
 * @param cell
 *            cell (excel)
 * 
 * @return the value of the excel-cell as String
 */
static String cellValues2String(XSSFWorkbook workbook, XSSFCell cell) {
	if (cell == null) {
		return null;
	}
	switch (cell.getCellType()) {
	case XSSFCell.CELL_TYPE_NUMERIC:
		if (HSSFDateUtil.isCellDateFormatted(cell)) {
			return new SimpleDateFormat(JExUnitConfig.getStringProperty(JExUnitConfig.ConfigKey.DATE_PATTERN))
					.format(cell.getDateCellValue());
		} else {
			return String.valueOf(cell.getNumericCellValue());
		}
	case XSSFCell.CELL_TYPE_STRING:
		return cell.getStringCellValue();
	case XSSFCell.CELL_TYPE_FORMULA:
		return evaluateCellFormula(workbook, cell);
	case XSSFCell.CELL_TYPE_BLANK:
		return cell.getStringCellValue();
	case XSSFCell.CELL_TYPE_BOOLEAN:
		return String.valueOf(cell.getBooleanCellValue());
	case XSSFCell.CELL_TYPE_ERROR:
		return String.valueOf(cell.getErrorCellValue());
	}
	return null;
}
 
开发者ID:fhm84,项目名称:jexunit,代码行数:35,代码来源:ExcelLoader.java

示例8: copyCell

/**
 * @param oldCell
 * @param newCell
 * @param styleMap
 */
public static void copyCell(XSSFCell oldCell, XSSFCell newCell, Map<Integer, XSSFCellStyle> styleMap) {
    if (styleMap != null) {
        if (oldCell.getSheet().getWorkbook() == newCell.getSheet().getWorkbook()) {
            newCell.setCellStyle(oldCell.getCellStyle());
        } else {
            int stHashCode = oldCell.getCellStyle().hashCode();
            XSSFCellStyle newCellStyle = styleMap.get(stHashCode);
            if (newCellStyle == null) {
                newCellStyle = newCell.getSheet().getWorkbook().createCellStyle();
                newCellStyle.cloneStyleFrom(oldCell.getCellStyle());
                styleMap.put(stHashCode, newCellStyle);
            }
            newCell.setCellStyle(newCellStyle);
        }
    }
    switch (oldCell.getCellType()) {
        case XSSFCell.CELL_TYPE_STRING:
            newCell.setCellValue(oldCell.getStringCellValue());
            break;
        case XSSFCell.CELL_TYPE_NUMERIC:
            newCell.setCellValue(oldCell.getNumericCellValue());
            break;
        case XSSFCell.CELL_TYPE_BLANK:
            newCell.setCellType(XSSFCell.CELL_TYPE_BLANK);
            break;
        case XSSFCell.CELL_TYPE_BOOLEAN:
            newCell.setCellValue(oldCell.getBooleanCellValue());
            break;
        case XSSFCell.CELL_TYPE_ERROR:
            newCell.setCellErrorValue(oldCell.getErrorCellValue());
            break;
        case XSSFCell.CELL_TYPE_FORMULA:
            newCell.setCellFormula(oldCell.getCellFormula());
            break;
        default:
            break;
    }

}
 
开发者ID:likelet,项目名称:DAtools,代码行数:44,代码来源:Util.java

示例9: shiftRange

private void shiftRange(int numRowsDown, int rowStart, int rowEnd, int colStart, int colEnd) throws Exception {
        // loop through from bottom row up to either SHIFT the whole row, or copy necessary columns, insert  new row below, insert the data from the cell and then delete all style and format from the original cell
        for(int j=rowEnd;j>rowStart;j--) {
            XSSFRow row = worksheet.getRow(j);
            XSSFRow newRow = worksheet.getRow(j+numRowsDown);
            if(row == null && newRow == null) 
                continue;
            else if (row == null) {
                worksheet.removeRow(newRow);
                continue;
            }
            if(newRow == null) {
                newRow = worksheet.createRow(j+numRowsDown);
            }
//            newRow = worksheet.getRow(j+numRowsDown);
            //if(row ==null) continue;
            for(int k=colStart;k<=colEnd;k++) {
                XSSFCell cell = row.getCell(k);
                if(cell != null) {
                    XSSFCell newCell = newRow.getCell(k)==null ? newRow.createCell(k) : newRow.getCell(k);
                    if(cell==null) continue;
                    if(cell.getCellType() == XSSFCell.CELL_TYPE_FORMULA) {
                        String calc = cell.getCellFormula();
                        newCell.setCellStyle(cell.getCellStyle());
                        cell.setCellType(XSSFCell.CELL_TYPE_BLANK);
                        this.setCellFormula(newCell, calc);
                    } else if(cell.getCellType()==XSSFCell.CELL_TYPE_BLANK) {
                        newCell.setCellType(XSSFCell.CELL_TYPE_BLANK);
                    } else {
                        newCell.copyCellFrom(cell, new CellCopyPolicy());
                        newCell.setCellStyle(cell.getCellStyle());
                    }
                }
            }
        }
    }
 
开发者ID:linearblue,项目名称:ExcelInjector,代码行数:36,代码来源:ExcelTableInjector.java

示例10: checkForContent

private int checkForContent(int rowStart, int rowEnd, int colStart, int colEnd) throws Exception {
    for(int j=rowEnd;j>rowStart;j--) {
        XSSFRow row = worksheet.getRow(j);
        if(row ==null) continue;
        for(int k=colStart;k<=colEnd;k++) {
            XSSFCell cell = row.getCell(k);
            if(cell==null) continue;
            if(cell.getCellType() == XSSFCell.CELL_TYPE_BLANK) continue;
            return j;
        }
    }
    return 0;
}
 
开发者ID:linearblue,项目名称:ExcelInjector,代码行数:13,代码来源:ExcelTableInjector.java

示例11: readInt

/**
 * 读取 Int 数值
 *
 * @return
 *
 */
public Integer readInt() {
    final XSSFCell cell = this.readCell();

    if (cell == null ||
        cell.getCellType() == XSSFCell.CELL_TYPE_BLANK) {
        return null;
    } else {
        return XSSFUtil.getIntCellVal(cell);
    }
}
 
开发者ID:hjj2017,项目名称:xgame-code_server,代码行数:16,代码来源:XSSFRowReadStream.java

示例12: readLong

/**
 * 读取 Long 数值
 *
 * @return
 *
 */
public Long readLong() {
    final XSSFCell cell = this.readCell();

    if (cell == null ||
        cell.getCellType() == XSSFCell.CELL_TYPE_BLANK) {
        return null;
    } else {
        return XSSFUtil.getLongCellVal(cell);
    }
}
 
开发者ID:hjj2017,项目名称:xgame-code_server,代码行数:16,代码来源:XSSFRowReadStream.java

示例13: readShort

/**
 * 读取 Short 数值
 *
 * @return
 *
 */
public Short readShort() {
    final XSSFCell cell = this.readCell();

    if (cell == null ||
        cell.getCellType() == XSSFCell.CELL_TYPE_BLANK) {
        return null;
    } else {
        return XSSFUtil.getShortCellVal(cell);
    }
}
 
开发者ID:hjj2017,项目名称:xgame-code_server,代码行数:16,代码来源:XSSFRowReadStream.java

示例14: readStr

/**
 * 读取 Str 数值
 *
 * @return
 *
 */
public String readStr() {
    final XSSFCell cell = this.readCell();

    if (cell == null ||
        cell.getCellType() == XSSFCell.CELL_TYPE_BLANK) {
        return null;
    } else {
        return XSSFUtil.getStrCellVal(cell);
    }
}
 
开发者ID:hjj2017,项目名称:xgame-code_server,代码行数:16,代码来源:XSSFRowReadStream.java

示例15: readBool

/**
 * 读取 Bool 数值
 *
 * @return
 *
 */
public Boolean readBool() {
    final XSSFCell cell = this.readCell();

    if (cell == null ||
        cell.getCellType() == XSSFCell.CELL_TYPE_BLANK) {
        return false;
    } else {
        return XSSFUtil.getBoolCellVal(cell);
    }
}
 
开发者ID:hjj2017,项目名称:xgame-code_server,代码行数:16,代码来源:XSSFRowReadStream.java


注:本文中的org.apache.poi.xssf.usermodel.XSSFCell.CELL_TYPE_BLANK属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。