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


Java HSSFRichTextString.toString方法代碼示例

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


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

示例1: getHSSFRichString

import org.apache.poi.hssf.usermodel.HSSFRichTextString; //導入方法依賴的package包/類
/**
 * 03版本複雜數據
 * @param rich
 * @return
 */
private String getHSSFRichString(HSSFRichTextString rich) {
    int nums = rich.numFormattingRuns();
    StringBuilder sb = new StringBuilder();
    String text = rich.toString();
    int currentIndex = 0;
    sb.append(text.substring(0, rich.getIndexOfFormattingRun(0)));
    for (int i = 0; i < nums; i++) {
        sb.append("<span ");
        sb.append("class='font_" + rich.getFontOfFormattingRun(i));
        sb.append("_");
        sb.append(cssRandom);
        sb.append("'>");
        currentIndex = rich.getIndexOfFormattingRun(i);
        if (i < nums - 1) {
            sb.append(XmlEscapers.xmlContentEscaper()
                .escape(text.substring(currentIndex, rich.getIndexOfFormattingRun(i + 1))));
        } else {
            sb.append(XmlEscapers.xmlContentEscaper()
                .escape(text.substring(currentIndex, text.length())));
        }
        sb.append("</span>");
    }
    return sb.toString();
}
 
開發者ID:rushingpig,項目名稱:poix,代碼行數:30,代碼來源:CellValueHelper.java

示例2: getHSSFRichString

import org.apache.poi.hssf.usermodel.HSSFRichTextString; //導入方法依賴的package包/類
/**
 * 03版本複雜數據
 * @param rich
 * @return
 */
private String getHSSFRichString(HSSFRichTextString rich) {
    int nums = rich.numFormattingRuns();
    StringBuilder sb = new StringBuilder();
    String text = rich.toString();
    int currentIndex = 0;
    sb.append(text.substring(0, rich.getIndexOfFormattingRun(0)));
    for (int i = 0; i < nums; i++) {
        sb.append("<span ");
        sb.append("class='font_" + rich.getFontOfFormattingRun(i));
        sb.append("_");
        sb.append(cssRandom);
        sb.append("'>");
        currentIndex = rich.getIndexOfFormattingRun(i);
        if (i < nums - 1) {
            sb.append(XmlEscapers.xmlContentEscaper().escape(
                text.substring(currentIndex, rich.getIndexOfFormattingRun(i + 1))));
        } else {
            sb.append(XmlEscapers.xmlContentEscaper().escape(
                text.substring(currentIndex, text.length())));
        }
        sb.append("</span>");
    }
    return sb.toString();
}
 
開發者ID:xiaolanglang,項目名稱:easypoi,代碼行數:30,代碼來源:CellValueHelper.java

示例3: getCellValue

import org.apache.poi.hssf.usermodel.HSSFRichTextString; //導入方法依賴的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

示例4: getCellValue

import org.apache.poi.hssf.usermodel.HSSFRichTextString; //導入方法依賴的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

示例5: isTextEmpty

import org.apache.poi.hssf.usermodel.HSSFRichTextString; //導入方法依賴的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.HSSFRichTextString.toString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。