{
cellFormat = new WritableCellFormat(NumberFormats.DEFAULT);
}
else
{
DisplayFormat displayFormat = JXLFactory.createNumberFormat(cellStyle.formatMask);
if (displayFormat != null)
{
cellFormat = new WritableCellFormat(displayFormat);
}
else
{
try
{
cellFormat = new WritableCellFormat(new NumberFormat(cellStyle.formatMask));
}
catch (IllegalArgumentException e)
{
throw new ExcelWorkbookException(Interpolator.instance().interpolate("Could not create number format for mask {0}", cellStyle.formatMask), e);
}
}
}
break;
case date:
/*
* If there is no mask, creates a default date format cell If there is
* a mask, tries to match it against a constant name If the constant
* can't be created, creates a custom date format from the mask
*/
if (cellStyle.formatMask == null)
{
cellFormat = new WritableCellFormat(DateFormats.DEFAULT);
}
else
{
DisplayFormat displayFormat = JXLFactory.createDateFormat(cellStyle.formatMask);
if (displayFormat != null)
{
cellFormat = new WritableCellFormat(displayFormat);
}
else
{
try
{
cellFormat = new WritableCellFormat(new DateFormat(cellStyle.formatMask));
}
catch (IllegalArgumentException e)
{
throw new ExcelWorkbookException(Interpolator.instance().interpolate("Could not create date format for mask {0}", cellStyle.formatMask), e);
}
}
}
break;
case formula:
DisplayFormat displayFormat = getGenericDisplayFormat(cellStyle.formatMask);
cellFormat = displayFormat != null ? new WritableCellFormat(displayFormat) : new WritableCellFormat();
break;
case bool:
cellFormat = new WritableCellFormat();
break;