本文整理了Java中org.apache.poi.xssf.usermodel.XSSFRichTextString.getString()
方法的一些代码示例,展示了XSSFRichTextString.getString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XSSFRichTextString.getString()
方法的具体详情如下:
包路径:org.apache.poi.xssf.usermodel.XSSFRichTextString
类名称:XSSFRichTextString
方法名:getString
[英]Returns the plain string representation.
[中]返回纯字符串表示形式。
代码示例来源:origin: org.apache.poi/poi-ooxml
/**
* Returns the plain string representation.
*/
public String toString() {
return getString();
}
代码示例来源:origin: org.apache.poi/poi-ooxml
/**
* Returns the number of characters in this string.
*/
public int length() {
return getString().length();
}
代码示例来源:origin: org.apache.poi/poi-ooxml
/**
* Get the value of the cell as a string
* <p>
* For numeric cells we throw an exception. For blank cells we return an empty string.
* For formulaCells that are not string Formulas, we throw an exception
* </p>
* @return the value of the cell as a string
*/
@Override
public String getStringCellValue() {
return getRichStringCellValue().getString();
}
代码示例来源:origin: org.apache.poi/poi-ooxml
/**
* Sets the font of the entire string.
* @param font The font to use.
*/
public void applyFont(Font font) {
String text = getString();
applyFont(0, text.length(), font);
}
代码示例来源:origin: org.apache.poi/poi-ooxml
@Override
public String getStringCellValue() {
return _cell.getRichStringCellValue().getString();
}
代码示例来源:origin: org.apache.poi/poi-ooxml
/**
* Removes any formatting that may have been applied to the string.
*/
public void clearFormatting() {
String text = getString();
st.setRArray(null);
st.setT(text);
}
代码示例来源:origin: org.apache.poi/poi-ooxml
@Override
public void cell(String cellRef, String formattedValue, XSSFComment comment) {
if (firstCellOfRow) {
firstCellOfRow = false;
} else {
output.append('\t');
}
if (formattedValue != null) {
checkMaxTextSize(output, formattedValue);
output.append(formattedValue);
}
if (includeCellComments && comment != null) {
String commentText = comment.getString().getString().replace('\n', ' ');
output.append(formattedValue != null ? " Comment by " : "Comment by ");
checkMaxTextSize(output, commentText);
if (commentText.startsWith(comment.getAuthor() + ": ")) {
output.append(commentText);
} else {
output.append(comment.getAuthor()).append(": ").append(commentText);
}
}
}
代码示例来源:origin: org.apache.poi/poi-ooxml
/**
* Applies the specified font to the entire string.
*
* @param fontIndex the font to apply.
*/
public void applyFont(short fontIndex) {
XSSFFont font;
if(styles == null) {
font = new XSSFFont();
font.setFontName("#" + fontIndex);
} else {
font = styles.getFontAt(fontIndex);
}
String text = getString();
applyFont(0, text.length(), font);
}
代码示例来源:origin: org.apache.poi/poi-ooxml
int sstIndex = Integer.parseInt(_cell.getV());
XSSFRichTextString rt = new XSSFRichTextString(_sharedStringSource.getEntryAt(sstIndex));
String text = rt.getString();
return Boolean.parseBoolean(text);
case NUMERIC:
代码示例来源:origin: org.apache.poi/poi-ooxml
int sstIndex = Integer.parseInt(_cell.getV());
XSSFRichTextString rt = new XSSFRichTextString(_sharedStringSource.getEntryAt(sstIndex));
return rt.getString();
case NUMERIC:
case ERROR:
代码示例来源:origin: org.apache.poi/poi-ooxml
/**
* Set a rich string value for the cell.
*
* @param value value to set the cell to. For formulas: we'll set the formula
* string, for String cells: we'll set its value. For other types we will
* change the cell to a string cell and set its value.
* If value is null then we will change the cell to a Blank cell.
*/
@Override
public void setCellValue(RichTextString value)
{
XSSFRichTextString xvalue = (XSSFRichTextString)value;
if (xvalue != null && xvalue.getString() != null) {
ensureRichTextStringType();
if (xvalue.length() > SpreadsheetVersion.EXCEL2007.getMaxTextLength()) {
throw new IllegalArgumentException("The maximum length of cell contents (text) is 32,767 characters");
}
((RichTextValue)_value).setValue(xvalue);
} else {
setCellType(CellType.BLANK);
}
}
代码示例来源:origin: looly/hutool
try {
final int index = Integer.parseInt(value);
result = new XSSFRichTextString(sharedStringsTable.getEntryAt(index)).getString();
} catch (NumberFormatException e) {
result = value;
代码示例来源:origin: looly/hutool
try {
final int index = Integer.parseInt(value);
result = new XSSFRichTextString(sharedStringsTable.getEntryAt(index)).getString();
} catch (NumberFormatException e) {
result = value;
代码示例来源:origin: org.apache.poi/poi-ooxml
/**
* Applies a font to the specified characters of a string.
*
* @param startIndex The start index to apply the font to (inclusive)
* @param endIndex The end index to apply to font to (exclusive)
* @param font The index of the font to use.
*/
public void applyFont(int startIndex, int endIndex, Font font) {
if (startIndex > endIndex)
throw new IllegalArgumentException("Start index must be less than end index, but had " + startIndex + " and " + endIndex);
if (startIndex < 0 || endIndex > length())
throw new IllegalArgumentException("Start and end index not in range, but had " + startIndex + " and " + endIndex);
if (startIndex == endIndex)
return;
if(st.sizeOfRArray() == 0 && st.isSetT()) {
//convert <t>string</t> into a text run: <r><t>string</t></r>
st.addNewR().setT(st.getT());
st.unsetT();
}
String text = getString();
XSSFFont xssfFont = (XSSFFont)font;
TreeMap<Integer, CTRPrElt> formats = getFormatMap(st);
CTRPrElt fmt = CTRPrElt.Factory.newInstance();
setRunAttributes(xssfFont.getCTFont(), fmt);
applyFont(formats, startIndex, endIndex, fmt);
CTRst newSt = buildCTRst(text, formats);
st.set(newSt);
}
代码示例来源:origin: org.apache.poi/poi-ooxml
rPr.setLang("en-US");
rPr.setSz(1100);
r.setT(str.getString());
代码示例来源:origin: org.apache.poi/poi-ooxml
rPr.setLang("en-US");
rPr.setSz(1100);
r.setT(str.getString());
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
/**
* Returns the plain string representation.
*/
public String toString() {
return getString();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
/**
* Returns the number of characters in this string.
*/
public int length() {
return getString().length();
}
代码示例来源:origin: apache/tika
public void cell(String cellRef, String formattedValue, XSSFComment comment) {
try {
// Handle any missing cells
int colNum = (new CellReference(cellRef)).getCol();
for (int cn=lastSeenCol+1; cn<colNum; cn++) {
xhtml.startElement("td");
xhtml.endElement("td");
}
lastSeenCol = colNum;
// Start this cell
xhtml.startElement("td");
// Main cell contents
if (formattedValue != null) {
xhtml.characters(formattedValue);
}
// Comments
if (comment != null) {
xhtml.startElement("br");
xhtml.endElement("br");
xhtml.characters(comment.getAuthor());
xhtml.characters(": ");
xhtml.characters(comment.getString().getString());
}
xhtml.endElement("td");
} catch (SAXException e) {
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
/**
* Get the value of the cell as a string
* <p>
* For numeric cells we throw an exception. For blank cells we return an empty string.
* For formulaCells that are not string Formulas, we throw an exception
* </p>
* @return the value of the cell as a string
*/
@Override
public String getStringCellValue() {
return getRichStringCellValue().getString();
}
内容来源于网络,如有侵权,请联系作者删除!