convertVAlignment(getVerticalAlignment().getCode());
style.setVerticalAlignment(cnvvalign);
style.setFillPattern((short)getShade());
Workbook workbook = getWorkbook();
HSSFDataFormat dataformat = workbook.createDataFormat();
if (getShade() == 1) {
// TODO: change to constant when upgrade to new HSSF
// solid w/foreground, bg doesn't matter
if (getLogger().isDebugEnabled()) {
getLogger().debug("shade = 1");
}
HSSFColor color =
(HSSFColor)colorhash.get(getBackgroundColor().toString());
if (color == null) {
if (getLogger().isDebugEnabled()) {
getLogger().debug("s1 BG couldn't find color for "
+ getBackgroundColor().toString());
}
color = new HSSFColor.WHITE();
}
style.setFillForegroundColor(color.getIndex());
color = (HSSFColor)colorhash.get(getPatternColor().toString());
if (color == null) {
if (getLogger().isDebugEnabled()) {
getLogger().debug("s1 PC couldn't find color for "
+ getPatternColor().toString());
}
color = new HSSFColor.BLACK();
}
style.setFillBackgroundColor(color.getIndex());
} else {
HSSFColor color =
(HSSFColor)colorhash.get(getBackgroundColor().toString());
if (color == null) {
if (getLogger().isDebugEnabled()) {
getLogger().debug(
"BG couldn't find color for "
+ getBackgroundColor().toString());
}
color = new HSSFColor.BLACK();
}
style.setFillBackgroundColor(color.getIndex());
color = (HSSFColor)colorhash.get(getPatternColor().toString());
if (color == null) {
if (getLogger().isDebugEnabled()) {
getLogger().debug("PC couldn't find color for "
+ getPatternColor().toString());
}
color = new HSSFColor.WHITE();
}
style.setFillForegroundColor(color.getIndex());
}
style.setWrapText(getWrapText());
style.setLocked(true);
String format = null;
try {
format = getFormat();
} catch (NullPointerException e) {
format = _general_format;
}
if (!format.equals(_general_format)) {
short valuenumber;
format = kludgeForGnumericMisformats(format);
format = kludgeForGnumericDateDivergence(format);
if (getLogger().isDebugEnabled()) {
getLogger().debug("setting format to " + format);
}
Object o =
workbook.getValidate(format, dataformat.getFormat(format));
Short sh = null;
sh = (Short)o;
valuenumber = sh.shortValue();
style.setDataFormat(valuenumber);
}