final int textLength = styledText == null ? 0 : styledText.length();
final String textStr = styledText.getText();
TextValue textValue = null;
if (isDetectCellType)
{
textValue = getTextValue(text, textStr);
}
cellHelper.exportHeader(
gridCell, rowIndex, colIndex, textValue,
getConvertedPattern(text.getPattern()),
getTextLocale(text),
isWrapText(gridCell.getElement()),
isCellHidden(gridCell.getElement()),
isCellLocked(gridCell.getElement())
);
sheetHelper.exportMergedCells(rowIndex, colIndex, gridCell.getRowSpan(), gridCell.getColSpan());
String textFormula = getFormula(text);
if (textFormula != null)
{
sheetHelper.write("<f>" + textFormula + "</f>\n");
}
// if (text.getLineSpacing() != JRTextElement.LINE_SPACING_SINGLE)
// {
// styleBuffer.append("line-height: " + text.getLineSpacingFactor() + "; ");
// }
// if (styleBuffer.length() > 0)
// {
// writer.write(" style=\"");
// writer.write(styleBuffer.toString());
// writer.write("\"");
// }
//
// writer.write(">");
// tableHelper.getParagraphHelper().exportProps(text);
// insertPageAnchor();
// if (text.getAnchorName() != null)
// {
// tempBodyWriter.write("<text:bookmark text:name=\"");
// tempBodyWriter.write(text.getAnchorName());
// tempBodyWriter.write("\"/>");
// }
String href = getHyperlinkURL(text);
if (href != null)
{
sheetHelper.exportHyperlink(rowIndex, colIndex, href);
}
TextValueHandler handler =
new TextValueHandler()
{
public void handle(BooleanTextValue textValue) throws JRException {
writeText();
}
public void handle(DateTextValue textValue) throws JRException {
Date date = textValue.getValue();
sheetHelper.write(
"<v>"
+ (date == null ? "" : JRDataUtils.getExcelSerialDayNumber(
date,
getTextLocale(text),
getTextTimeZone(text)
))
+ "</v>"
);
}
public void handle(NumberTextValue textValue) throws JRException {
Number number = textValue.getValue();
sheetHelper.write(
"<v>"
+ (number == null ? "" : number)
+ "</v>"
);
}
public void handle(StringTextValue textValue) throws JRException {
writeText();
}
private void writeText() throws JRException {
sheetHelper.write("<is>");//FIXMENOW make writer util; check everywhere
if (textLength > 0)
{
exportStyledText(text.getStyle(), styledText, getTextLocale(text));
}
sheetHelper.write("</is>");
}
};
if (textValue != null)
{
//detect cell type
textValue.handle(handler);
}
else
{
handler.handle((StringTextValue)null);
}