w-html2docx 1.0.8 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -49,3 +49,14 @@ test()
49
49
  console.log('catch', err)
50
50
  })
51
51
  ```
52
+
53
+ ### 外部提供docx模板要點
54
+
55
+ 轉檔時以docx模板為基底產出文件,可透過`opt.fpInTemp`指定外部模板;未指定時依序使用`./src/tmp.docx`或`./node_modules/w-html2docx/src/tmp.docx`(套件內建模板)。
56
+
57
+ 外部提供模板時須注意:
58
+
59
+ 1. **內容附加於模板文末**:轉檔係將html內容(含格式)插入至模板既有內容之後再另存,故模板一般提供空白文件;模板內既有內容會保留於輸出文件開頭。
60
+ 2. **頁面設定由模板決定**:輸出文件之紙張大小、邊界等頁面設定沿用模板;圖片縮放上限(滿版寬高)亦依模板版心(紙張大小扣除邊界)計算。
61
+ 3. **模板settings會帶入輸出文件**:模板`word/settings.xml`內之文件層級設定,轉檔後會保留於輸出docx。
62
+ 4. **建議帶入停用影像壓縮旗標**:模板`word/settings.xml`須含`<w:doNotAutoCompressPictures/>`,否則Word轉檔時會將寬圖(約超過1270px)自動降採樣至220ppi並轉存JPEG,導致圖內文字模糊。套件內建模板已含此旗標;外部模板可於Word開啟模板後,勾選[檔案 > 選項 > 進階 > 影像大小和品質 > 不壓縮檔案中的影像]再存檔,或直接編輯`word/settings.xml`加入該元素。
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * w-html2docx v1.0.8
2
+ * w-html2docx v1.0.9
3
3
  * (c) 2018-2021 yuda-lyu(semisphere)
4
4
  * Released under the MIT License.
5
5
  */
@@ -246,7 +246,7 @@ export default WHtml2docx
246
246
  <br class="clear">
247
247
 
248
248
  <footer>
249
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Wed Jul 08 2026 21:09:13 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
249
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sat Jul 11 2026 21:54:41 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
250
250
  </footer>
251
251
 
252
252
  <script>prettyPrint();</script>
package/docs/global.html CHANGED
@@ -593,7 +593,7 @@
593
593
  <br class="clear">
594
594
 
595
595
  <footer>
596
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Wed Jul 08 2026 21:09:13 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
596
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sat Jul 11 2026 21:54:41 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
597
597
  </footer>
598
598
 
599
599
  <script>prettyPrint();</script>
package/docs/index.html CHANGED
@@ -71,7 +71,7 @@
71
71
  <br class="clear">
72
72
 
73
73
  <footer>
74
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Wed Jul 08 2026 21:09:13 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
74
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sat Jul 11 2026 21:54:41 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
75
75
  </footer>
76
76
 
77
77
  <script>prettyPrint();</script>
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "w-html2docx",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "main": "dist/w-html2docx.umd.js",
5
5
  "dependencies": {
6
6
  "lodash-es": "^4.18.1",
7
- "wsemi": "^1.8.63"
7
+ "wsemi": "^1.8.64"
8
8
  },
9
9
  "devDependencies": {
10
10
  "w-package-tools": "^1.1.10"
package/src/tmp.docx CHANGED
Binary file
package/test/ztmp.html CHANGED
@@ -294,6 +294,7 @@
294
294
  <hr>
295
295
 
296
296
  <h2>四、成果內容</h2>
297
+
297
298
  <h3>4.1 表格測試</h3>
298
299
  <table>
299
300
  <thead>
@@ -318,7 +319,38 @@
318
319
  <td>80%</td>
319
320
  <td>預計下期延伸</td>
320
321
  </tr>
321
- </tbody></table>
322
+ </tbody>
323
+ </table>
324
+
325
+ <h3>4.2 表格測試(水平置中)</h3>
326
+ <div style="text-align:center;">
327
+ <table style="display:inline-table;">
328
+ <thead>
329
+ <tr>
330
+ <th>項目</th>
331
+ <th>完成度</th>
332
+ <th>備註</th>
333
+ </tr>
334
+ </thead>
335
+ <tbody><tr>
336
+ <td>自動化流程</td>
337
+ <td>100%</td>
338
+ <td>已完成</td>
339
+ </tr>
340
+ <tr>
341
+ <td>系統效能優化</td>
342
+ <td>95%</td>
343
+ <td>尚可持續改善</td>
344
+ </tr>
345
+ <tr>
346
+ <td>介面改善</td>
347
+ <td>80%</td>
348
+ <td>預計下期延伸</td>
349
+ </tr>
350
+ </tbody>
351
+ </table>
352
+ </div>
353
+
322
354
  <hr>
323
355
 
324
356
  <h2>五、圖片、連結與註腳</h2>
@@ -399,34 +431,6 @@
399
431
 
400
432
  <hr>
401
433
 
402
- <h2>八、表格水平置中測試(轉Docx)</h2>
403
-
404
- <h3>8.1 基本表格(對照組, 預設靠左)</h3>
405
- <table>
406
- <thead>
407
- <tr><th>欄位一</th><th>欄位二</th><th>欄位三</th></tr>
408
- </thead>
409
- <tbody>
410
- <tr><td>A1</td><td>B1</td><td>C1</td></tr>
411
- <tr><td>A2</td><td>B2</td><td>C2</td></tr>
412
- </tbody>
413
- </table>
414
-
415
- <h3>8.2 表格水平置中(div+text-align:center轉Docx水平置中)</h3>
416
- <div style="text-align:center;">
417
- <table align="center" _style="margin:0 auto;">
418
- <thead>
419
- <tr><th>欄位一</th><th>欄位二</th><th>欄位三</th></tr>
420
- </thead>
421
- <tbody>
422
- <tr><td>A1</td><td>B1</td><td>C1</td></tr>
423
- <tr><td>A2</td><td>B2</td><td>C2</td></tr>
424
- </tbody>
425
- </table>
426
- </div>
427
-
428
- <hr>
429
-
430
434
  <h2>註腳</h2>
431
435
  <section class="footnotes" data-footnotes>
432
436
  <h2 id="footnote-label" class="sr-only" style="height:0px; line-height:0px; min-height:0px; overflow:hidden;">Footnotes</h2>
Binary file