81,092
社区成员
发帖
与我相关
我的任务
分享
import jxl.write.WritableCellFormat;
import jxl.write.Border;
import jxl.write.BorderLineStyle;
String[] s1 = { "a", "s" };
String[] s2 = { "z", "x" };
String data[][] = { s1, s2 };
Label label = null;
WritableSheet sheet = null;
try {
WritableWorkbook wb = Workbook.createWorkbook(new File(filePath));
WritableCellFormat normalFormat = new WritableCellFormat();
// 设置边框及边框颜色
normalFormat.setBorder(Border.ALL, BorderLineStyle.THICK,
jxl.format.Colour.RED);
sheet = wb.createSheet("1", 0);
for (int i = 0; i < 2; i++)
for (int j = 0; j < 2; j++) {
label = new Label(j, i, data[i][j], normalFormat);
sheet.addCell(label);
}
wb.write();
wb.close();
} catch (Exception e) {
}