• word table

    table分两种
    word中的table对应org.anyline.office.docx.entity.Wtable

    与html中的table对就org.anyline.office.docx.entity.html.Table

    word中的Table需要从Document中提取
    根据书签获取word中的表格,需要在表格中添加一个书签,在任务一个单元格添加都可以。
    WDocument doc = new WDocument("file path");
    Wtable table = doc.getTable("mk_table");

  • 根据书签获取word中的表格

    根据书签获取word中的表格,需要在表格中添加一个书签,在任务一个单元格添加都可以。 WDocument doc = new WDocument(tar); Wtable table = doc.getTable("mk_table");
  • 在表格中根据书签获取指定行

    需要在tr中插入书签,在当前行的任意单元格都可以 Wtr tr = table.getTr("mk_tr");
  • 在表格中插入一行

    在表格中插入一行
  • 根据数据集合往word中的table插入行

    现有表格中插入行 有些表格的样式比较复杂,可以先在word中创建好模版,把数据插入到模版中,并复制模版中的样式,这样html中就不需要设置复杂的css只填充数据就可以。 首先在表格中插入一个书签 通过WTable table = WDocumnt.getTable("书签名");获取表格 如果表格大于2行,将自动以最后一行作为样式模板。执行完插入后,模版行将被删除,表格中经常以空行作为最后一行并在这一行上设置字体等样式。
  • 现有表格中插入行(根据模板行样式)

    现有表格中插入行(根据模板行样式) 首先在表格的模版中插入一个书签 通过WTable table = WDocumnt.getTable("书签名");获取表格 通过WTr template = WDocumnt.getTr("书签名");获取模版行
  • 根据数据集生成tr插入table

    根据数据集生成tr插入table,如果是集合则会插入多行,否则插入一行
  • 根据数据集生成tr插入table的指定位置

    table.insert(index, list, "ID","NAME"); index表示需要插入的下标位置
  • table获取行或列

    Wtr tr = table.getTr(rows); Wtc tc = table.getTc(rows, cols);
  • 设置单元格内容(含css样式)

    设置单元格内容(含css样式)
  • 在指定位置添加行列,默认复制上一行(列)样式

    所有行添加一列,并复制前一列的样式 table.addColumns(1); 从下标1位置开始添加10行,并复制上一行的样式 table.addRows(1,10);
  • 设置单元格背景色

    table.setBackgroundColor(rows, cols, "red"); 支持css颜色值
  • 设置默认边框

    table.setBorder(rows, cols); 边框线条以4为一个单位 table.setBorder(rows, cols, 4, "red", "single"); ​
  • 设置所有单元格边框

    设置所有单元格边框 边框有top bootom left right tl2br tr2bl insideH insideV table.setTcBorder(); table.setTl2brBorder(rows, cols); table.removeBorder(rows, cols); table.removeLeftBorder(rows, cols);
  • 设置高度宽度

    高度表示整行高度 宽度表示整列宽度 table.setHeight(rwos, '100px'); table.setWidth(cols, '100px');
  • 设置对齐方式

    水平对齐 table.setAlign(rows, cols, "right");  垂直对齐 table.stVerticalAlign(rows, cols, "top");
  • 设置字体

    字号支持word字号与html字号 table.setFontSize(rows, cols, "一号"); table.setFontSize(rows, cols, "30pt"); table.setFontFamily(rows, cols, "黑体")
  • 合并单元格

    根据起止行列合并 table.merge(rows, cols, rowspan, colspan);
  • 粗体、斜体、下划线、删除线

    table.setBold(rows, cols, true); table.setUnderline(rows, cols, true); table.setStrike(rows, cols, true); table.setItalic(rows, cols, true);
  • 删除样式、边框、背景

    table.removeBackgroundColor(rows, cols); table.removeColor(rows, cols); table.removeStyle(rows, cols);
  • 合并单元格顺序与优先级

    根据内容合并与 直接设置 colspan rowspan 只执行先设置的一种 执行合并后再设置其他方式无效
第一页 上一页 下一页 最后页