Itext导出word的问题!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

不关橙猫猫事的哦 2014-09-27 09:39:15
没办法设置表格的边框为0啊。
不管是table还是cell都有setBorderWidth和setBorder,但是设置为0了还是显示出来。。
...全文
148 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
引用 3 楼 bill0605030109 的回复:
[quote=引用 2 楼 fangmingshijie 的回复:]


Table table = new Table(2, 3);
table.setBorderWidth(0f);
Cell cell = new Cell(“test”);
cell.setBorder(0);
table.addCell(cell);



这样是有效果的吧,没有边框。


不行的。。我试过了。。算了。[/quote]不行那是你没有使用好,那么多人用就你自己不行?我已经说过多次了,我解决问题,不是想得分。


Document document = new Document(PageSize.A4);
RtfWriter2.getInstance(document, new FileOutputStream(
"D:/test/word.doc"));
document.open();
Table table = new Table(2, 3);
table.setBorderWidth(4f);
table.setAlignment(2);
int[] widths = { 200, 100 };
table.setWidths(widths);
Cell cell = new Cell("test");
cell.setBorder(0);
table.addCell(cell);
document.add(table);
document.close();
//对应下图1

Document document = new Document(PageSize.A4);
RtfWriter2.getInstance(document, new FileOutputStream(
"D:/test/word.doc"));
document.open();
Table table = new Table(2, 3);
table.setBorderWidth(0f);
table.setAlignment(2);
int[] widths = { 200, 100 };
table.setWidths(widths);
Cell cell = new Cell("test");
cell.setBorder(0);
table.addCell(cell);
document.add(table);
document.close();
//对应下图2


图一


图二



图二你看到边框了?还是自己用这个测试代码看看。
  • 打赏
  • 举报
回复


Table table = new Table(2, 3); 
table.setBorderWidth(0f); 
Cell cell = new Cell(“test”); 
cell.setBorder(0); 
table.addCell(cell); 

这样是有效果的吧,没有边框。
  • 打赏
  • 举报
回复
csdn越来越不行了。。
  • 打赏
  • 举报
回复
引用 2 楼 fangmingshijie 的回复:


Table table = new Table(2, 3); 
table.setBorderWidth(0f); 
Cell cell = new Cell(“test”); 
cell.setBorder(0); 
table.addCell(cell); 

这样是有效果的吧,没有边框。
一个人狂赚200,明天又要上榜了。。
  • 打赏
  • 举报
回复
引用 2 楼 fangmingshijie 的回复:


Table table = new Table(2, 3); 
table.setBorderWidth(0f); 
Cell cell = new Cell(“test”); 
cell.setBorder(0); 
table.addCell(cell); 

这样是有效果的吧,没有边框。
不行的。。我试过了。。算了。

81,092

社区成员

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

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