}
switch (type)
{
case text:
return new Label(column, row, data.toString(), cellFormat);
case number:
try {
return new jxl.write.Number(column, row, Double.parseDouble(data.toString()), cellFormat);
} catch (NumberFormatException e) {
String message = Interpolator.instance().interpolate(ResourceBundle.instance().getString("org.jboss.seam.excel.not_a_number"), data.toString());
return new Label(column, row, message, cellFormat);
}
case date:
try {
return new DateTime(column, row, (Date) data, cellFormat);
} catch (ClassCastException e) {
String message = Interpolator.instance().interpolate(ResourceBundle.instance().getString("org.jboss.seam.excel.not_a_date"), data.toString());
return new Label(column, row, message, cellFormat);
}
case formula:
return new Formula(column, row, data.toString(), cellFormat);
case bool:
return new jxl.write.Boolean(column, row, Boolean.parseBoolean(data.toString()), cellFormat);
default:
return new Label(column, row, data.toString(), cellFormat);
}
}