jxl colour 颜色列表
| unknown |
| black |
| white |
| default background |
| default background |
| black |
| red |
| bright green |
| blue |
| yellow |
| pink |
| turquoise |
| dark red |
| green |
| dark blue |
| dark yellow |
| violet |
| teal |
| grey 25% |
| grey 50% |
| periwinkle% |
| plum |
| ivory |
| light turquoise |
| dark purple |
| coral |
| ocean blue |
| ice blue |
| dark blue |
| pink |
| yellow |
| turqoise |
| violet |
| dark red |
| teal |
| blue |
| sky blue |
| light turquoise |
| light green |
| very light yellow |
| pale blue |
| rose |
| lavender |
| tan |
| light blue |
| aqua |
| lime |
| gold |
| light orange |
| orange |
| blue grey |
| grey 40% |
| dark teal |
| sea green |
| dark green |
| olive green |
| brown |
| plum |
| indigo |
| grey 80% |
| automatic |
package excel;
imp
imp
imp
imp
imp
imp
imp
imp
imp
imp
imp
imp
imp
imp
imp
imp
imp
imp
imp
public class WriteExcel {
/**
*
* @author smart *
*/
public static void main(String[] args) {
try {
String filePath = "D:/workspace/upload/file/test.xls";
WritableWorkbook wwb;
OutputStream os = new FileOutputStream(filePath);
wwb = Workbook.createWorkbook(os);
WritableSheet sheet = wwb.createSheet("product list", 0);
int off_col = 0;
int off_row = 0;
Colour[] colors = Colour.getAllColours();
for (int i = 0; i < colors.length; i ) {
WritableCellFormat wcf = new WritableCellFormat();
wcf.setBackground(colors[i]);
jxl.write.Label label = new jxl.write.Label(off_col, i, colors[i].getDescription());
label.setCellFormat(wcf);
sheet.addCell(label);
}
wwb.write();
wwb.close();
} catch (Exception e) {
System.out.println("---exception---");
e.printStackTrace();
}
}}
浙公网安备 33010602011771号