欢迎访问悦橙教程(wld5.com),关注java教程。悦橙教程  java问答|  每日更新
页面导航 : > > 文章正文

itext向word中插入table代码示例,itexttable,// 注意至少要知道要插

来源: javaer 分享于  点击 49127 次 点评:258

itext向word中插入table代码示例,itexttable,// 注意至少要知道要插


// 注意至少要知道要插入表格的列数,行数可以不定Table table = new Table(3);table.setBorderWidth(1);table.setBorderColor(new Color(0, 0, 255));table.setPadding(5);table.setSpacing(5);Cell cell = new Cell("header");cell.setHeader(true);cell.setColspan(3);table.addCell(cell);table.endHeaders();cell = new Cell("example cell with colspan 1 and rowspan 2");cell.setRowspan(2);cell.setBorderColor(new Color(255, 0, 0));table.addCell(cell);table.addCell("1.1");table.addCell("2.1");table.addCell("1.2");table.addCell("2.2");table.addCell("cell test1");cell = new Cell("big cell");cell.setRowspan(2);cell.setColspan(2);table.addCell(cell);table.addCell("cell test2");

以上表格的样子如下:

itext table

相关栏目:

用户点评