搜索 提交
  • 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");
    也可以获取所有table
    List<Wtable> tables = doc.tables();

  • 关于行列合并

    word中行列合并与html有所区别 列合并 与HTML类似,都是设置合并几列,右面被合并的列直接删除标签,如合并2列,右面的1列会被删除 html中通过属性colspan表示,如<td colspan='2'></td> word中通过 tcPr>gridS
  • 根据模板插入行

    插入行 如果模板位于当前表中则从当前模板位置往后插入,否则插入到最后一行 Wtable.insert(Wtr template, String html) 如果提供了下标,则插入到下标位置 Wtable.insert(Integet index, Wtr template, String html
  • 提取word中的所有table

    WDocument doc = new WDocument(file); List<Wtable> tables = doc.tables();
  • 提取单元格(tc)中的文本

    Wtc tc = 一般通过上级Wtr.getTcs()获取 也可以直接通过Wtable.getTc(行,列)获取 tc.getText() 查找直接子级t标签文本,tc中可能有多个 t标签,可以调用getTextList或getText返回所有t标签文本(不限层级) t
  • 单元格文本替换

    /**      * 文本替换,不限层级查的所有t标签      * @param target 查找target      * @param replacement 替换成replacement  
  • 设置所有单元格边框

    设置所有单元格边框 边框有top bootom left right tl2br tr2bl insideH insideV table.setTcBorder(); table.setTl2brBorder(rows, cols); table.removeBorder(rows, cols); table.removeLeftBorder(rows, cols);
  • 现有表格中插入行(根据模板行样式)

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

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

    table.insert(index, list, "ID","NAME"); index表示需要插入的下标位置
  • 在指定位置添加行列,默认复制上一行(列)样式

    所有行添加一列,并复制前一列的样式 table.addColumns(1); 从下标1位置开始添加10行,并复制上一行的样式 table.addRows(1,10);
第一页 上一页 下一页 最后页