分类: Java
2013-04-23 16:31:01
WritableFont font = new WritableFont(WritableFont.createFont("宋体"),
10, WritableFont.NO_BOLD, false,
UnderlineStyle.NO_UNDERLINE);
//表格背景色在WritableCellFormat中设置
WritableCellFormat normalFormat = new WritableCellFormat(
new WritableFont(WritableFont.createFont("宋体"), 10,
WritableFont.NO_BOLD, false,
UnderlineStyle.NO_UNDERLINE));
//设置背景色
normalFormat.setBackground(jxl.format.Colour.WHITE);
//设置边框及边框颜色
normalFormat.setBorder(Border.ALL, BorderLineStyle.THIN,
jxl.format.Colour.GRAY_25);
Label label = new Label( //将normalFormat传给label,那么label的背景色和边框就会改变为你设置的样式
j, //j列
(i + 1), //i+1行
StringProcess
.restoreSomeSymbol(productproperty[j]),
normalFormat);
ws.addCell(label); //WritableSheet ws 将label加入excel sheet中
转自:http://blog.163.com/szy1986311@126/blog/static/141088673201093103051413/