)
);
}
HSSFCellStyle cellStyle = initCreateCell(gridCell, colIndex, rowIndex, baseStyle);
cell.setCellType(HSSFCell.CELL_TYPE_FORMULA);
cell.setCellFormula(formula);
endCreateCell(cellStyle);
return;
}
catch(Exception e)//FIXMENOW what exceptions could we get here?
{
if(log.isWarnEnabled())
{
log.warn(e.getMessage());
}
}
}
if (isDetectCellType)
{
TextValue value = getTextValue(textElement, textStr);
value.handle(new TextValueHandler()
{
public void handle(StringTextValue textValue)
{
HSSFCellStyle cellStyle = initCreateCell(gridCell, colIndex, rowIndex, baseStyle);
if (JRCommonText.MARKUP_NONE.equals(textElement.getMarkup()))
{
setStringCellValue(textValue.getText());
}
else
{
setRichTextStringCellValue(styledText, forecolor, textElement, getTextLocale(textElement));
}
endCreateCell(cellStyle);
}
public void handle(NumberTextValue textValue)
{
if (textValue.getPattern() != null)
{
baseStyle.setDataFormat(
dataFormat.getFormat(
getConvertedPattern(textValue.getPattern())
)
);
}
HSSFCellStyle cellStyle = initCreateCell(gridCell, colIndex, rowIndex, baseStyle);
if (textValue.getValue() == null)
{
cell.setCellType(HSSFCell.CELL_TYPE_BLANK);
}
else
{
cell.setCellValue(textValue.getValue().doubleValue());
}
endCreateCell(cellStyle);
}
public void handle(DateTextValue textValue)
{
baseStyle.setDataFormat(
dataFormat.getFormat(
getConvertedPattern(textValue.getPattern())
)
);
HSSFCellStyle cellStyle = initCreateCell(gridCell, colIndex, rowIndex, baseStyle);
if (textValue.getValue() == null)
{
cell.setCellType(HSSFCell.CELL_TYPE_BLANK);
}
else
{
cell.setCellValue(textValue.getValue());
}
endCreateCell(cellStyle);
}
public void handle(BooleanTextValue textValue)
{
HSSFCellStyle cellStyle = initCreateCell(gridCell, colIndex, rowIndex, baseStyle);
if (textValue.getValue() == null)
{
cell.setCellType(HSSFCell.CELL_TYPE_BLANK);
}
else
{
cell.setCellValue(textValue.getValue().booleanValue());
}
endCreateCell(cellStyle);
}
});
}
else if (isAutoDetectCellType)
{
HSSFCellStyle cellStyle = initCreateCell(gridCell, colIndex, rowIndex, baseStyle);
try
{
cell.setCellValue(Double.parseDouble(textStr));
}
catch(NumberFormatException e)
{
if (JRCommonText.MARKUP_NONE.equals(textElement.getMarkup()))
{
setStringCellValue(textStr);
}
else
{
setRichTextStringCellValue(styledText, forecolor, textElement, getTextLocale(textElement));
}
}
endCreateCell(cellStyle);
}
else
{
HSSFCellStyle cellStyle = initCreateCell(gridCell, colIndex, rowIndex, baseStyle);
if (JRCommonText.MARKUP_NONE.equals(textElement.getMarkup()))
{
setStringCellValue(textStr);
}
else