本身基於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 useagecss