}
// Set the text content in this cell. If content is null, it will display
// the empty string instead.
private void setDisplayTextContent(String content, String stylename) {
WhitespaceProcessor textProcessor = new WhitespaceProcessor();
OdfStylableElement element = OdfElement.findFirstChildNode(OdfTextParagraph.class, mCellElement);
if (element == null) {
removeContent();
element = new OdfTextParagraph((OdfFileDom) mCellElement.getOwnerDocument());
mCellElement.appendChild(element);
} else {
String formerContent = element.getTextContent();
while (formerContent == null || "".equals(formerContent)) {
OdfTextSpan span = OdfElement.findFirstChildNode(OdfTextSpan.class, element);
if (span == null) {
break;
}
formerContent = span.getTextContent();
element = span;
}
}
if ((stylename != null) && (stylename.length() > 0)) {
element.setStyleName(stylename);
}
element.setTextContent(null);
textProcessor.append(element, content);
optimizeCellSize(content);
}