类 WDocument

java.lang.Object
org.anyline.office.docx.entity.Welement
org.anyline.office.docx.entity.WDocument

public class WDocument extends Welement
  • 字段详细资料

    • IS_HTML_ESCAPE

      public boolean IS_HTML_ESCAPE
  • 构造器详细资料

    • WDocument

      public WDocument(File file)
    • WDocument

      public WDocument(String file)
    • WDocument

      public WDocument(File file, String charset)
    • WDocument

      public WDocument(String file, String charset)
  • 方法详细资料

    • reload

      public void reload()
      覆盖:
      reload 在类中 Welement
    • rel

      public org.dom4j.Element rel(String id)
      根据资源文件id获取element
      参数:
      id - 文件id
      返回:
      Element
    • read

      public InputStream read(String path)
    • flush

      public void flush()
    • loadStyle

      public void loadStyle(String html)
    • replace

      public void replace(String key, String content)
    • replace

      public void replace(String key, File... words)
    • replace

      public void replace(String key, List<File> words)
    • save

      public void save()
    • save

      public void save(Charset charset)
    • replace

      public void replace(org.dom4j.Element box, Map<String,String> replaces)
      执行替换
      参数:
      box - 最外层元素
      replaces - k:v
    • before

      public org.dom4j.Element before(org.dom4j.Element element, String html)
      在element之前插入节点
      参数:
      element - element
      html - html
    • before

      public org.dom4j.Element before(org.dom4j.Element point, org.dom4j.Element element)
    • before

      public org.dom4j.Element before(org.dom4j.Element point, Wtable table)
    • after

      public org.dom4j.Element after(org.dom4j.Element point, org.dom4j.Element element)
    • after

      public org.dom4j.Element after(org.dom4j.Element point, Wtable table)
    • after

      public org.dom4j.Element after(org.dom4j.Element element, String html)
      在element之后 插入节点 解析html有可能解析出多个element这里会返回最外层的最后一个
      参数:
      element - element
      html - html
      返回:
      Element
    • insert

      public org.dom4j.Element insert(org.dom4j.Element parent, String html)
    • insert

      public org.dom4j.Element insert(int index, org.dom4j.Element parent, String html)
    • insert

      public org.dom4j.Element insert(org.dom4j.Element parent, org.dom4j.Element element)
    • insert

      public org.dom4j.Element insert(org.dom4j.Element parent, Wtable table)
    • insert

      public org.dom4j.Element insert(int index, org.dom4j.Element parent, org.dom4j.Element element)
    • insert

      public org.dom4j.Element insert(int index, org.dom4j.Element parent, Wtable table)
    • parent

      public org.dom4j.Element parent(String bookmark, String tag)
      获取书签所在的标签 通常用来定位
      参数:
      bookmark - 书签
      tag - 上一级标签名 如tbl
      返回:
      Element
    • parent

      public org.dom4j.Element parent(String bookmark)
    • table

      public Wtable table(String bookmark)
      读取书签所有的table
      参数:
      bookmark - 书签
      返回:
      docx table
    • tables

      public List<Wtable> tables(boolean recursion)
      获取body下的table
      参数:
      recursion - 是否递归获取所有级别的table,正常情况下不需要,word中的tbl一般在src下的最顶级,除非有表格嵌套
      返回:
      tables
    • tables

      public List<Wtable> tables()
    • setOrient

      public void setOrient(org.dom4j.Element prev, String orient, Map<String,String> styles)
    • setOrient

      public void setOrient(org.dom4j.Element prev, String orient)
    • insertPageBreak

      public void insertPageBreak(org.dom4j.Element prev)
    • getUploader

      public org.anyline.handler.Uploader getUploader()
    • setUploader

      public void setUploader(org.anyline.handler.Uploader uploader)
    • getDownloader

      public org.anyline.handler.Downloader getDownloader()
    • setDownloader

      public void setDownloader(org.anyline.handler.Downloader downloader)
    • index

      public static int index(org.dom4j.Element parent, org.dom4j.Element element)
    • pr

      public org.dom4j.Element pr(org.dom4j.Element element, Map<String,String> styles)
    • parent

      public org.dom4j.Element parent(org.dom4j.Element element, String... tags)
    • pp

      public org.dom4j.Element pp(org.dom4j.Element element)
      找到到当前p的上一级(用来创建与当前所在p平级的新p,遇到tc停止)
      参数:
      element - 当前节点
      返回:
      Element
    • p

      public org.dom4j.Element p(org.dom4j.Element element)
    • table

      public org.dom4j.Element table(org.dom4j.Element box, org.dom4j.Element after, org.dom4j.Element src)
    • tr

      public org.dom4j.Element tr(org.dom4j.Element parent, org.anyline.entity.html.Tr tr)
    • tc

      public org.dom4j.Element tc(org.dom4j.Element parent, org.anyline.entity.html.Td td)
    • prevStyle

      public org.dom4j.Element prevStyle(org.dom4j.Element prev)
    • block

      public org.dom4j.Element block(org.dom4j.Element parent, org.dom4j.Element prev, org.dom4j.Element element, Map<String,String> styles)
    • parseHtml

      public org.dom4j.Element parseHtml(org.dom4j.Element parent, org.dom4j.Element prev, org.dom4j.Element html, Map<String,String> styles, boolean copyPrevStyle)
      解析html
      参数:
      parent - 上一级
      prev - 放在prev之后
      html - html
      styles - 样式
      copyPrevStyle - 是否复制前一个标签的样式,在替换书签时需要用到,但在div中嵌套的span需要避免复制闰一个标签的样式
      返回:
      prev
    • remove

      public WDocument remove(org.dom4j.Element element)
    • remove

      public WDocument remove(Wtable table)
    • parseHtml

      public org.dom4j.Element parseHtml(org.dom4j.Element parent, org.dom4j.Element prev, org.dom4j.Element html, Map<String,String> styles)
    • p

      public org.dom4j.Element p(org.dom4j.Element parent, String text, Map<String,String> styles)
    • r

      public org.dom4j.Element r(org.dom4j.Element parent, String text, Map<String,String> styles)
    • style

      public Map<String,String> style(org.dom4j.Element element)
    • listStyle

      public String listStyle(String key)
      根据关键字查找样式列表ID
      返回:
      List
    • insert

      public org.dom4j.Element insert(org.dom4j.Element prev, File file)
      插入模板文件
      参数:
      prev - 在prev元素之前插入
      file - 模板文件
      返回:
      element
    • listStyles

      public List<String> listStyles()
      根据关键字查找样式列表ID
      返回:
      List
    • html

      public String html(org.anyline.handler.Uploader uploader, int lvl)
      覆盖:
      html 在类中 Welement