當前位置: 首頁>>代碼示例>>Java>>正文


Java HSSFCell.getRichStringCellValue方法代碼示例

本文整理匯總了Java中org.apache.poi.hssf.usermodel.HSSFCell.getRichStringCellValue方法的典型用法代碼示例。如果您正苦於以下問題:Java HSSFCell.getRichStringCellValue方法的具體用法?Java HSSFCell.getRichStringCellValue怎麽用?Java HSSFCell.getRichStringCellValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.poi.hssf.usermodel.HSSFCell的用法示例。


在下文中一共展示了HSSFCell.getRichStringCellValue方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: findMatchColumn

import org.apache.poi.hssf.usermodel.HSSFCell; //導入方法依賴的package包/類
public static Integer findMatchColumn(final HSSFRow row, final String str) {
    for (int colNum = row.getFirstCellNum(); colNum <= row.getLastCellNum(); colNum++) {
        final HSSFCell cell = row.getCell(colNum);

        if (cell == null) {
            continue;
        }

        if (cell.getCellType() != Cell.CELL_TYPE_STRING) {
            continue;
        }

        final HSSFRichTextString cellValue = cell.getRichStringCellValue();

        if (cellValue.getString().matches(str)) {
            return Integer.valueOf(colNum);
        }
    }

    return null;
}
 
開發者ID:roundrop,項目名稱:ermasterr,代碼行數:22,代碼來源:POIUtils.java

示例2: findColumn

import org.apache.poi.hssf.usermodel.HSSFCell; //導入方法依賴的package包/類
public static Integer findColumn(final HSSFRow row, final String str) {
    for (int colNum = row.getFirstCellNum(); colNum <= row.getLastCellNum(); colNum++) {
        final HSSFCell cell = row.getCell(colNum);

        if (cell == null) {
            continue;
        }

        if (cell.getCellType() == Cell.CELL_TYPE_STRING) {
            final HSSFRichTextString cellValue = cell.getRichStringCellValue();

            if (str.equals(cellValue.getString())) {
                return Integer.valueOf(colNum);
            }
        }
    }

    return null;
}
 
開發者ID:roundrop,項目名稱:ermasterr,代碼行數:20,代碼來源:POIUtils.java

示例3: findCell

import org.apache.poi.hssf.usermodel.HSSFCell; //導入方法依賴的package包/類
public static CellLocation findCell(final HSSFSheet sheet, final String str, final int colNum) {
    for (int rowNum = sheet.getFirstRowNum(); rowNum < sheet.getLastRowNum() + 1; rowNum++) {
        final HSSFRow row = sheet.getRow(rowNum);
        if (row == null) {
            continue;
        }

        final HSSFCell cell = row.getCell(colNum);

        if (cell == null) {
            continue;
        }
        final HSSFRichTextString cellValue = cell.getRichStringCellValue();

        if (!Check.isEmpty(cellValue.getString())) {
            if (cellValue.getString().equals(str)) {
                return new CellLocation(rowNum, (short) colNum);
            }
        }
    }

    return null;
}
 
開發者ID:roundrop,項目名稱:ermasterr,代碼行數:24,代碼來源:POIUtils.java

示例4: getCellValue

import org.apache.poi.hssf.usermodel.HSSFCell; //導入方法依賴的package包/類
public static String getCellValue(final HSSFSheet sheet, final int r, final int c) {
    final HSSFRow row = sheet.getRow(r);

    if (row == null) {
        return null;
    }

    final HSSFCell cell = row.getCell(c);

    if (cell == null) {
        return null;
    }

    final HSSFRichTextString cellValue = cell.getRichStringCellValue();

    return cellValue.toString();
}
 
開發者ID:roundrop,項目名稱:ermasterr,代碼行數:18,代碼來源:POIUtils.java

示例5: findColumn

import org.apache.poi.hssf.usermodel.HSSFCell; //導入方法依賴的package包/類
public static Integer findColumn(HSSFRow row, String str) {
	for (int colNum = row.getFirstCellNum(); colNum <= row.getLastCellNum(); colNum++) {
		HSSFCell cell = row.getCell(colNum);

		if (cell == null) {
			continue;
		}

		if (cell.getCellType() == HSSFCell.CELL_TYPE_STRING) {
			HSSFRichTextString cellValue = cell.getRichStringCellValue();

			if (str.equals(cellValue.getString())) {
				return Integer.valueOf(colNum);
			}
		}
	}

	return null;
}
 
開發者ID:kozake,項目名稱:ermaster-k,代碼行數:20,代碼來源:POIUtils.java

示例6: findMatchColumn

import org.apache.poi.hssf.usermodel.HSSFCell; //導入方法依賴的package包/類
public static Integer findMatchColumn(HSSFRow row, String str) {
	for (int colNum = row.getFirstCellNum(); colNum <= row.getLastCellNum(); colNum++) {
		HSSFCell cell = row.getCell(colNum);

		if (cell == null) {
			continue;
		}

		if (cell.getCellType() != HSSFCell.CELL_TYPE_STRING) {
			continue;
		}

		HSSFRichTextString cellValue = cell.getRichStringCellValue();

		if (cellValue.getString().matches(str)) {
			return Integer.valueOf(colNum);
		}
	}

	return null;
}
 
開發者ID:kozake,項目名稱:ermaster-k,代碼行數:22,代碼來源:POIUtils.java

示例7: findCell

import org.apache.poi.hssf.usermodel.HSSFCell; //導入方法依賴的package包/類
public static CellLocation findCell(HSSFSheet sheet, String str, int colNum) {
	for (int rowNum = sheet.getFirstRowNum(); rowNum < sheet
			.getLastRowNum() + 1; rowNum++) {
		HSSFRow row = sheet.getRow(rowNum);
		if (row == null) {
			continue;
		}

		HSSFCell cell = row.getCell(colNum);

		if (cell == null) {
			continue;
		}
		HSSFRichTextString cellValue = cell.getRichStringCellValue();

		if (!Check.isEmpty(cellValue.getString())) {
			if (cellValue.getString().equals(str)) {
				return new CellLocation(rowNum, (short) colNum);
			}
		}
	}

	return null;
}
 
開發者ID:kozake,項目名稱:ermaster-k,代碼行數:25,代碼來源:POIUtils.java

示例8: getCellValue

import org.apache.poi.hssf.usermodel.HSSFCell; //導入方法依賴的package包/類
public static String getCellValue(HSSFSheet sheet, int r, int c) {
	HSSFRow row = sheet.getRow(r);

	if (row == null) {
		return null;
	}

	HSSFCell cell = row.getCell(c);

	if (cell == null) {
		return null;
	}

	HSSFRichTextString cellValue = cell.getRichStringCellValue();

	return cellValue.toString();
}
 
開發者ID:kozake,項目名稱:ermaster-k,代碼行數:18,代碼來源:POIUtils.java

示例9: getCellData

import org.apache.poi.hssf.usermodel.HSSFCell; //導入方法依賴的package包/類
/**
 * Get cell value based on the excel column data type
 *
 * @param myCell
 * @return
 */
private static String getCellData(HSSFCell myCell) throws Exception {
    String cellData = "";
    if (myCell == null) {
        cellData += CVS_SEPERATOR_CHAR;;
    } else {
        switch (myCell.getCellType()) {
            case HSSFCell.CELL_TYPE_STRING:
            case HSSFCell.CELL_TYPE_BOOLEAN:
                cellData += myCell.getRichStringCellValue() + CVS_SEPERATOR_CHAR;
                break;
            case HSSFCell.CELL_TYPE_NUMERIC:
                cellData += getNumericValue(myCell);
                break;
            case HSSFCell.CELL_TYPE_FORMULA:
                cellData += getFormulaValue(myCell);
            default:
                cellData += CVS_SEPERATOR_CHAR;
                ;
        }
    }
    return cellData;
}
 
開發者ID:rmage,項目名稱:gnvc-ims,代碼行數:29,代碼來源:ReportModel.java

示例10: getFormulaValue

import org.apache.poi.hssf.usermodel.HSSFCell; //導入方法依賴的package包/類
/**
 * Get the formula value from a cell
 *
 * @param myCell
 * @return
 * @throws Exception
 */
private static String getFormulaValue(HSSFCell myCell) throws Exception {
    String cellData = "";
    if (myCell.getCachedFormulaResultType() == HSSFCell.CELL_TYPE_STRING || myCell.getCellType() == HSSFCell.CELL_TYPE_BOOLEAN) {
        cellData += myCell.getRichStringCellValue() + CVS_SEPERATOR_CHAR;
    } else if (myCell.getCachedFormulaResultType() == HSSFCell.CELL_TYPE_NUMERIC) {
        cellData += getNumericValue(myCell) + CVS_SEPERATOR_CHAR;
    }
    return cellData;
}
 
開發者ID:rmage,項目名稱:gnvc-ims,代碼行數:17,代碼來源:ReportModel.java

示例11: isTextEmpty

import org.apache.poi.hssf.usermodel.HSSFCell; //導入方法依賴的package包/類
protected boolean isTextEmpty( HSSFCell cell )
{
    final String value;
    switch ( cell.getCellType() )
    {
    case HSSFCell.CELL_TYPE_STRING:
        // XXX: enrich
        value = cell.getRichStringCellValue().getString();
        break;
    case HSSFCell.CELL_TYPE_FORMULA:
        switch ( cell.getCachedFormulaResultType() )
        {
        case HSSFCell.CELL_TYPE_STRING:
            HSSFRichTextString str = cell.getRichStringCellValue();
            if ( str == null || str.length() <= 0 )
                return false;

            value = str.toString();
            break;
        case HSSFCell.CELL_TYPE_NUMERIC:
            HSSFCellStyle style = cell.getCellStyle();
            if ( style == null )
            {
                return false;
            }

            value = ( _formatter.formatRawCellContents(
                    cell.getNumericCellValue(), style.getDataFormat(),
                    style.getDataFormatString() ) );
            break;
        case HSSFCell.CELL_TYPE_BOOLEAN:
            value = String.valueOf( cell.getBooleanCellValue() );
            break;
        case HSSFCell.CELL_TYPE_ERROR:
            value = ErrorEval.getText( cell.getErrorCellValue() );
            break;
        default:
            value = ExcelToHtmlUtils.EMPTY;
            break;
        }
        break;
    case HSSFCell.CELL_TYPE_BLANK:
        value = ExcelToHtmlUtils.EMPTY;
        break;
    case HSSFCell.CELL_TYPE_NUMERIC:
        value = _formatter.formatCellValue( cell );
        break;
    case HSSFCell.CELL_TYPE_BOOLEAN:
        value = String.valueOf( cell.getBooleanCellValue() );
        break;
    case HSSFCell.CELL_TYPE_ERROR:
        value = ErrorEval.getText( cell.getErrorCellValue() );
        break;
    default:
        return true;
    }

    return ExcelToHtmlUtils.isEmpty( value );
}
 
開發者ID:rmage,項目名稱:gnvc-ims,代碼行數:60,代碼來源:AbstractExcelConverter.java


注:本文中的org.apache.poi.hssf.usermodel.HSSFCell.getRichStringCellValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。