define your own color Class extending HSSFColor like the following sample. does not need to be static since it might be an Inner Class.
public final static class DARK_TEAL
extends HSSFColor
{
public final static short index = 0x38;
public final static short[] triplet =
{
0, 51, 102
};
public final static String hexString = "0:3333:6666"; public short getIndex()
{
return index;
} public short [] getTriplet()
{
return triplet;
} public String getHexString()
{
return hexString;
}
}
public final static class DARK_TEAL
extends HSSFColor
{
public final static short index = 0x38;
public final static short[] triplet =
{
0, 51, 102
};
public final static String hexString = "0:3333:6666"; public short getIndex()
{
return index;
} public short [] getTriplet()
{
return triplet;
} public String getHexString()
{
return hexString;
}
}
POI包中已经定义了可以在EXCEL中使用的颜色值, 如HSSFColor.RED,
对于任意一个RGB的颜色值, 我们必须找出一个与之最接近的HSSF(也就是
EXCEL)中的颜色值, 然后用来设置单元格的颜色值.是这样吧?
Excel本来就不是什么标准的东西,可以不用就不用,因为你会碰到根多的麻烦。
比如如何判断cell是时间还是数值?比如if condition poi还不支持。
用EXCEL这玩意, 所以老板要求提供将报表转成EXCEL的能力.