Methods
(async) WHtml2docx(fpInHtml, fpOutDocx, optopt) → {Promise}
- Description:
Html檔轉Docx檔
- Source:
Example
import w from 'wsemi'
import WHtml2docx from './src/WHtml2docx.mjs'
//import WHtml2docx from 'w-html2docx/src/WHtml2docx.mjs'
//import WHtml2docx from 'w-html2docx'
async function test() {
let fpIn = `./test/ztmp.html`
let fpOut = `./test/ztmp.docx`
let opt = {
imgRatioWidthMax: 0.5,
}
let r = await WHtml2docx(fpIn, fpOut, opt)
console.log(r)
// => ok
w.fsDeleteFile(fpOut)
}
test()
.catch((err) => {
console.log('catch', err)
})
Parameters:
| Name | Type | Attributes | Default | Description | |||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
fpInHtml |
String | 輸入來源Html檔位置字串 |
|||||||||||||||||||||||||||
fpOutDocx |
String | 輸入轉出Docx檔位置字串 |
|||||||||||||||||||||||||||
opt |
Object |
<optional> |
{}
|
輸入設定物件,預設{} Properties
|
Returns:
回傳Promise,resolve回傳成功訊息,reject回傳錯誤訊息
- Type
- Promise