2020-01-21

2020-01-21  本文已影响0人  xuqingcheng

## 自己基于html-docx-js封装的功能更全的转word库

## 新的功能点

* word的页眉页脚可以通过标签进行配制

* 可以自动生成目录

* 可以给word添加标签页(首页不同)

* 可以在任意时候结束当前页,新开一个页面

## 用法

#### Usage and demo

```

yarn add html-docx  npm install html-docx --save

import HtmlToDocx from 'html-docx'

HtmlDocx({

    exportElement: '#html-docx', // 需要转换为word的html标签

    exportFileName: 'list.docx', // 转换之后word文档的文件名称

    StringStyle: '', // css样式以字符串的形式插入进去

    margins:{top: 1440,right: 1440,bottom: 1440,left: 1440,header: 720,footer: 720,gutter: 0} // word的边距配置

})

```

#### use in-inline in html

[you can use it refer to the example useage](https://github.com/forever-chen/html-docx/blob/master/test/sample.html)

上一篇 下一篇

猜你喜欢

热点阅读