jxl边框颜色设置

yanandeyu 2009-08-10 07:32:06
jxl怎样设定excel的边框,不想对每个单元格一次次的设定,有直接设定整个Excel边框的办法吗?

就这点分了,希望不要闲弃!!
...全文
133 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
和玉米 2010-08-11
  • 打赏
  • 举报
回复
我也想知道
pockethong 2010-06-20
  • 打赏
  • 举报
回复
简单明了,jxl2.6.12试下来The type Border is deprecated。不过还能用。 可以参考api最新写法
filemon 2009-08-10
  • 打赏
  • 举报
回复
支持一楼
andytom 2009-08-10
  • 打赏
  • 举报
回复

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) {
}

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧