@cj-tech-master/excelts 9.5.3 → 9.5.4-canary.20260512125948.f669d62

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.
Files changed (643) hide show
  1. package/dist/browser/modules/excel/utils/string-buf.d.ts +5 -26
  2. package/dist/browser/modules/excel/utils/string-buf.js +4 -81
  3. package/dist/browser/modules/pdf/excel-bridge.d.ts +29 -0
  4. package/dist/browser/modules/pdf/excel-bridge.js +32 -0
  5. package/dist/browser/modules/pdf/font/metrics.d.ts +3 -52
  6. package/dist/browser/modules/pdf/font/metrics.js +3 -237
  7. package/dist/browser/modules/pdf/index.d.ts +1 -1
  8. package/dist/browser/modules/pdf/index.js +1 -1
  9. package/dist/browser/modules/pdf/word-bridge.d.ts +35 -4
  10. package/dist/browser/modules/pdf/word-bridge.js +2226 -143
  11. package/dist/browser/modules/stream/browser/readable.js +5 -5
  12. package/dist/browser/modules/word/advanced/diff.d.ts +61 -0
  13. package/dist/browser/modules/word/advanced/diff.js +167 -0
  14. package/dist/browser/modules/word/advanced/drawing-shapes.d.ts +269 -0
  15. package/dist/browser/modules/word/advanced/drawing-shapes.js +268 -0
  16. package/dist/browser/modules/word/advanced/field-engine.d.ts +43 -0
  17. package/dist/browser/modules/word/advanced/field-engine.js +1169 -0
  18. package/dist/browser/modules/word/advanced/glossary.d.ts +86 -0
  19. package/dist/browser/modules/word/advanced/glossary.js +79 -0
  20. package/dist/browser/modules/word/advanced/math-convert.d.ts +30 -0
  21. package/dist/browser/modules/word/advanced/math-convert.js +595 -0
  22. package/dist/browser/modules/word/advanced/ole-objects.d.ts +115 -0
  23. package/dist/browser/modules/word/advanced/ole-objects.js +271 -0
  24. package/dist/browser/modules/word/advanced/style-map.d.ts +105 -0
  25. package/dist/browser/modules/word/advanced/style-map.js +322 -0
  26. package/dist/browser/modules/word/advanced/validation.d.ts +56 -0
  27. package/dist/browser/modules/word/advanced/validation.js +973 -0
  28. package/dist/browser/modules/word/advanced/vba-project.d.ts +91 -0
  29. package/dist/browser/modules/word/advanced/vba-project.js +243 -0
  30. package/dist/browser/modules/word/bridge/excel-bridge.d.ts +127 -0
  31. package/dist/browser/modules/word/bridge/excel-bridge.js +949 -0
  32. package/dist/browser/modules/word/builder/document-handle.d.ts +151 -0
  33. package/dist/browser/modules/word/builder/document-handle.js +488 -0
  34. package/dist/browser/modules/word/builder/paragraph-builders.d.ts +55 -0
  35. package/dist/browser/modules/word/builder/paragraph-builders.js +87 -0
  36. package/dist/browser/modules/word/builder/run-builders.d.ts +374 -0
  37. package/dist/browser/modules/word/builder/run-builders.js +600 -0
  38. package/dist/browser/modules/word/builder/table-builders.d.ts +23 -0
  39. package/dist/browser/modules/word/builder/table-builders.js +45 -0
  40. package/dist/browser/modules/word/constants.d.ts +39 -1
  41. package/dist/browser/modules/word/constants.js +109 -1
  42. package/dist/browser/modules/word/convert/conversion-ir.d.ts +163 -0
  43. package/dist/browser/modules/word/convert/conversion-ir.js +31 -0
  44. package/dist/browser/modules/word/convert/docx-to-semantic.d.ts +39 -0
  45. package/dist/browser/modules/word/convert/docx-to-semantic.js +420 -0
  46. package/dist/browser/modules/word/convert/flat-opc.d.ts +44 -0
  47. package/dist/browser/modules/word/convert/flat-opc.js +385 -0
  48. package/dist/browser/modules/word/convert/html/html-import.d.ts +50 -0
  49. package/dist/browser/modules/word/convert/html/html-import.js +1849 -0
  50. package/dist/{types/modules/word → browser/modules/word/convert/html}/html-renderer.d.ts +14 -1
  51. package/dist/{esm/modules/word → browser/modules/word/convert/html}/html-renderer.js +414 -67
  52. package/dist/browser/modules/word/convert/html/html.d.ts +15 -0
  53. package/dist/browser/modules/word/convert/html/html.js +15 -0
  54. package/dist/browser/modules/word/convert/markdown/markdown-import.d.ts +55 -0
  55. package/dist/browser/modules/word/convert/markdown/markdown-import.js +1302 -0
  56. package/dist/browser/modules/word/convert/markdown/markdown-renderer.d.ts +25 -0
  57. package/dist/browser/modules/word/convert/markdown/markdown-renderer.js +595 -0
  58. package/dist/browser/modules/word/convert/markdown/markdown.d.ts +15 -0
  59. package/dist/browser/modules/word/convert/markdown/markdown.js +15 -0
  60. package/dist/browser/modules/word/convert/odt/odt.d.ts +41 -0
  61. package/dist/browser/modules/word/convert/odt/odt.js +1932 -0
  62. package/dist/browser/modules/word/{color-utils.d.ts → core/color-utils.d.ts} +8 -1
  63. package/dist/browser/modules/word/core/color-utils.js +43 -0
  64. package/dist/browser/modules/word/core/internal-utils.d.ts +90 -0
  65. package/dist/browser/modules/word/core/internal-utils.js +209 -0
  66. package/dist/browser/modules/word/core/mapper.d.ts +44 -0
  67. package/dist/browser/modules/word/core/mapper.js +420 -0
  68. package/dist/browser/modules/word/core/opc-paths.d.ts +33 -0
  69. package/dist/browser/modules/word/core/opc-paths.js +48 -0
  70. package/dist/browser/modules/word/core/text-utils.d.ts +38 -0
  71. package/dist/browser/modules/word/core/text-utils.js +202 -0
  72. package/dist/browser/modules/word/core/walker.d.ts +119 -0
  73. package/dist/browser/modules/word/core/walker.js +563 -0
  74. package/dist/browser/modules/word/crypto.d.ts +14 -9
  75. package/dist/browser/modules/word/crypto.js +13 -7
  76. package/dist/browser/modules/word/document-io.d.ts +59 -27
  77. package/dist/browser/modules/word/document-io.js +80 -197
  78. package/dist/browser/modules/word/errors.d.ts +32 -1
  79. package/dist/browser/modules/word/errors.js +39 -2
  80. package/dist/browser/modules/word/excel.d.ts +14 -0
  81. package/dist/browser/modules/word/excel.js +13 -0
  82. package/dist/browser/modules/word/font/font-embed.d.ts +112 -0
  83. package/dist/browser/modules/word/font/font-embed.js +646 -0
  84. package/dist/{esm/modules/word → browser/modules/word/font}/font-obfuscation.js +4 -9
  85. package/dist/browser/modules/word/font/hyphenation.d.ts +65 -0
  86. package/dist/browser/modules/word/font/hyphenation.js +4210 -0
  87. package/dist/browser/modules/word/font/text-shaping.d.ts +58 -0
  88. package/dist/browser/modules/word/font/text-shaping.js +635 -0
  89. package/dist/browser/modules/word/html.d.ts +7 -6
  90. package/dist/browser/modules/word/html.js +6 -5
  91. package/dist/browser/modules/word/incremental-edit.d.ts +123 -0
  92. package/dist/browser/modules/word/incremental-edit.js +275 -0
  93. package/dist/browser/modules/word/index.base.d.ts +177 -10
  94. package/dist/browser/modules/word/index.base.js +121 -29
  95. package/dist/browser/modules/word/layout/layout-full.d.ts +26 -0
  96. package/dist/browser/modules/word/layout/layout-full.js +437 -0
  97. package/dist/browser/modules/word/layout/layout-model.d.ts +129 -0
  98. package/dist/browser/modules/word/layout/layout-model.js +10 -0
  99. package/dist/browser/modules/word/layout/layout.d.ts +63 -0
  100. package/dist/browser/modules/word/layout/layout.js +1172 -0
  101. package/dist/browser/modules/word/layout/render-page.d.ts +57 -0
  102. package/dist/browser/modules/word/layout/render-page.js +915 -0
  103. package/dist/browser/modules/word/markdown.d.ts +14 -0
  104. package/dist/browser/modules/word/markdown.js +13 -0
  105. package/dist/browser/modules/word/patcher.d.ts +54 -0
  106. package/dist/browser/modules/word/patcher.js +357 -0
  107. package/dist/browser/modules/word/query/compat.d.ts +25 -0
  108. package/dist/browser/modules/word/query/compat.js +58 -0
  109. package/dist/browser/modules/word/query/data-binding.d.ts +22 -0
  110. package/dist/browser/modules/word/query/data-binding.js +392 -0
  111. package/dist/browser/modules/word/query/form-fields.d.ts +41 -0
  112. package/dist/browser/modules/word/query/form-fields.js +268 -0
  113. package/dist/browser/modules/word/query/format-search.d.ts +99 -0
  114. package/dist/browser/modules/word/query/format-search.js +329 -0
  115. package/dist/browser/modules/word/query/mail-merge.d.ts +25 -0
  116. package/dist/browser/modules/word/query/mail-merge.js +111 -0
  117. package/dist/browser/modules/word/query/merge.d.ts +50 -0
  118. package/dist/browser/modules/word/query/merge.js +617 -0
  119. package/dist/browser/modules/word/query/replace.d.ts +47 -0
  120. package/dist/browser/modules/word/query/replace.js +301 -0
  121. package/dist/browser/modules/word/query/revisions.d.ts +67 -0
  122. package/dist/browser/modules/word/query/revisions.js +879 -0
  123. package/dist/browser/modules/word/query/search.d.ts +129 -0
  124. package/dist/browser/modules/word/query/search.js +346 -0
  125. package/dist/browser/modules/word/query/split.d.ts +44 -0
  126. package/dist/browser/modules/word/query/split.js +135 -0
  127. package/dist/browser/modules/word/query/style-resolve.d.ts +104 -0
  128. package/dist/browser/modules/word/query/style-resolve.js +368 -0
  129. package/dist/browser/modules/word/reader/chart-parser.d.ts +20 -0
  130. package/dist/browser/modules/word/reader/chart-parser.js +768 -0
  131. package/dist/browser/modules/word/reader/doc-props-parsers.d.ts +15 -0
  132. package/dist/browser/modules/word/reader/doc-props-parsers.js +190 -0
  133. package/dist/browser/modules/word/reader/docx-reader.d.ts +27 -0
  134. package/dist/browser/modules/word/reader/docx-reader.js +2653 -0
  135. package/dist/browser/modules/word/reader/drawing-helpers.d.ts +27 -0
  136. package/dist/browser/modules/word/reader/drawing-helpers.js +84 -0
  137. package/dist/browser/modules/word/reader/form-field-parser.d.ts +21 -0
  138. package/dist/browser/modules/word/reader/form-field-parser.js +82 -0
  139. package/dist/browser/modules/word/reader/image-parsers.d.ts +11 -0
  140. package/dist/browser/modules/word/reader/image-parsers.js +291 -0
  141. package/dist/browser/modules/word/reader/math-parser.d.ts +12 -0
  142. package/dist/browser/modules/word/reader/math-parser.js +422 -0
  143. package/dist/browser/modules/word/reader/metadata-parsers.d.ts +17 -0
  144. package/dist/browser/modules/word/reader/metadata-parsers.js +87 -0
  145. package/dist/browser/modules/word/reader/numbering-parser.d.ts +13 -0
  146. package/dist/browser/modules/word/reader/numbering-parser.js +166 -0
  147. package/dist/browser/modules/word/reader/paragraph-section-parsers.d.ts +12 -0
  148. package/dist/browser/modules/word/reader/paragraph-section-parsers.js +503 -0
  149. package/dist/browser/modules/word/reader/parse-utils.d.ts +91 -0
  150. package/dist/browser/modules/word/reader/parse-utils.js +249 -0
  151. package/dist/browser/modules/word/reader/properties-parsers.d.ts +21 -0
  152. package/dist/browser/modules/word/reader/properties-parsers.js +279 -0
  153. package/dist/browser/modules/word/reader/reader-context.d.ts +69 -0
  154. package/dist/browser/modules/word/reader/reader-context.js +61 -0
  155. package/dist/browser/modules/word/reader/sdt-helpers.d.ts +29 -0
  156. package/dist/browser/modules/word/reader/sdt-helpers.js +111 -0
  157. package/dist/browser/modules/word/reader/settings-parser.d.ts +8 -0
  158. package/dist/browser/modules/word/reader/settings-parser.js +263 -0
  159. package/dist/browser/modules/word/reader/styles-parser.d.ts +12 -0
  160. package/dist/browser/modules/word/reader/styles-parser.js +147 -0
  161. package/dist/browser/modules/word/reader/table-properties-parsers.d.ts +12 -0
  162. package/dist/browser/modules/word/reader/table-properties-parsers.js +234 -0
  163. package/dist/browser/modules/word/reader/theme-parser.d.ts +8 -0
  164. package/dist/browser/modules/word/reader/theme-parser.js +167 -0
  165. package/dist/browser/modules/word/security/cfb-reader.d.ts +37 -0
  166. package/dist/browser/modules/word/security/cfb-reader.js +410 -0
  167. package/dist/browser/modules/word/{digital-signatures.d.ts → security/digital-signatures.d.ts} +19 -11
  168. package/dist/browser/modules/word/{digital-signatures.js → security/digital-signatures.js} +34 -34
  169. package/dist/browser/modules/word/security/document-protection.d.ts +93 -0
  170. package/dist/browser/modules/word/security/document-protection.js +201 -0
  171. package/dist/{types/modules/word → browser/modules/word/security}/encryption.d.ts +45 -1
  172. package/dist/browser/modules/word/security/encryption.js +606 -0
  173. package/dist/browser/modules/word/security/policy.d.ts +66 -0
  174. package/dist/browser/modules/word/security/policy.js +88 -0
  175. package/dist/browser/modules/word/template/template-chart.d.ts +56 -0
  176. package/dist/browser/modules/word/template/template-chart.js +167 -0
  177. package/dist/browser/modules/word/template/template-datasource.d.ts +154 -0
  178. package/dist/browser/modules/word/template/template-datasource.js +541 -0
  179. package/dist/browser/modules/word/template/template-engine.d.ts +121 -0
  180. package/dist/browser/modules/word/template/template-engine.js +1435 -0
  181. package/dist/browser/modules/word/types.d.ts +188 -23
  182. package/dist/browser/modules/word/units.d.ts +26 -0
  183. package/dist/browser/modules/word/units.js +43 -14
  184. package/dist/browser/modules/word/{writers → writer}/chart-writer.js +164 -23
  185. package/dist/{types/modules/word/writers → browser/modules/word/writer}/comment-writer.d.ts +2 -1
  186. package/dist/browser/modules/word/{writers → writer}/comment-writer.js +3 -4
  187. package/dist/browser/modules/word/writer/common-parts.d.ts +42 -0
  188. package/dist/browser/modules/word/writer/common-parts.js +101 -0
  189. package/dist/{types/modules/word → browser/modules/word/writer}/content-types.d.ts +2 -2
  190. package/dist/{esm/modules/word → browser/modules/word/writer}/content-types.js +14 -6
  191. package/dist/browser/modules/word/{writers → writer}/document-writer.d.ts +5 -7
  192. package/dist/browser/modules/word/{writers → writer}/document-writer.js +118 -60
  193. package/dist/{types/modules/word → browser/modules/word/writer}/docx-packager.d.ts +5 -1
  194. package/dist/browser/modules/word/writer/docx-packager.js +1430 -0
  195. package/dist/{types/modules/word/writers → browser/modules/word/writer}/footnote-writer.d.ts +3 -2
  196. package/dist/{esm/modules/word/writers → browser/modules/word/writer}/footnote-writer.js +13 -10
  197. package/dist/{types/modules/word/writers → browser/modules/word/writer}/header-footer-writer.d.ts +3 -2
  198. package/dist/{esm/modules/word/writers → browser/modules/word/writer}/header-footer-writer.js +25 -16
  199. package/dist/{types/modules/word/writers → browser/modules/word/writer}/image-writer.d.ts +1 -1
  200. package/dist/browser/modules/word/{writers → writer}/image-writer.js +11 -7
  201. package/dist/{esm/modules/word/writers → browser/modules/word/writer}/numbering-writer.js +2 -1
  202. package/dist/browser/modules/word/{writers → writer}/paragraph-writer.d.ts +2 -1
  203. package/dist/browser/modules/word/{writers → writer}/paragraph-writer.js +52 -38
  204. package/dist/{esm/modules/word/writers → browser/modules/word/writer}/parts-writer.js +43 -1
  205. package/dist/browser/modules/word/writer/reference-scanners.d.ts +36 -0
  206. package/dist/browser/modules/word/writer/reference-scanners.js +105 -0
  207. package/dist/browser/modules/word/writer/relationships.d.ts +52 -0
  208. package/dist/browser/modules/word/writer/relationships.js +117 -0
  209. package/dist/browser/modules/word/writer/render-context.d.ts +93 -0
  210. package/dist/browser/modules/word/writer/render-context.js +35 -0
  211. package/dist/browser/modules/word/{writers → writer}/run-writer.d.ts +9 -1
  212. package/dist/{esm/modules/word/writers → browser/modules/word/writer}/run-writer.js +49 -17
  213. package/dist/browser/modules/word/writer/stream-buf.d.ts +37 -0
  214. package/dist/browser/modules/word/writer/stream-buf.js +73 -0
  215. package/dist/browser/modules/word/writer/streaming-writer.d.ts +244 -0
  216. package/dist/browser/modules/word/writer/streaming-writer.js +1146 -0
  217. package/dist/browser/modules/word/writer/string-buf.d.ts +8 -0
  218. package/dist/browser/modules/word/writer/string-buf.js +7 -0
  219. package/dist/browser/modules/word/{writers → writer}/styles-writer.js +32 -1
  220. package/dist/browser/modules/word/{writers → writer}/table-writer.d.ts +2 -1
  221. package/dist/{esm/modules/word/writers → browser/modules/word/writer}/table-writer.js +7 -7
  222. package/dist/browser/utils/font-metrics.d.ts +63 -0
  223. package/dist/browser/utils/font-metrics.js +293 -0
  224. package/dist/browser/utils/string-buf.d.ts +42 -0
  225. package/dist/browser/utils/string-buf.js +89 -0
  226. package/dist/browser/utils/theme-colors.d.ts +55 -0
  227. package/dist/browser/utils/theme-colors.js +120 -0
  228. package/dist/cjs/modules/excel/utils/string-buf.js +5 -81
  229. package/dist/cjs/modules/pdf/excel-bridge.js +33 -0
  230. package/dist/cjs/modules/pdf/font/metrics.js +11 -244
  231. package/dist/cjs/modules/pdf/index.js +2 -1
  232. package/dist/cjs/modules/pdf/word-bridge.js +2259 -143
  233. package/dist/cjs/modules/stream/browser/readable.js +5 -5
  234. package/dist/cjs/modules/word/advanced/diff.js +170 -0
  235. package/dist/cjs/modules/word/advanced/drawing-shapes.js +279 -0
  236. package/dist/cjs/modules/word/advanced/field-engine.js +1173 -0
  237. package/dist/cjs/modules/word/advanced/glossary.js +87 -0
  238. package/dist/cjs/modules/word/advanced/math-convert.js +599 -0
  239. package/dist/cjs/modules/word/advanced/ole-objects.js +277 -0
  240. package/dist/cjs/modules/word/advanced/style-map.js +329 -0
  241. package/dist/cjs/modules/word/advanced/validation.js +976 -0
  242. package/dist/cjs/modules/word/advanced/vba-project.js +252 -0
  243. package/dist/cjs/modules/word/bridge/excel-bridge.js +989 -0
  244. package/dist/cjs/modules/word/builder/document-handle.js +491 -0
  245. package/dist/cjs/modules/word/builder/paragraph-builders.js +106 -0
  246. package/dist/cjs/modules/word/builder/run-builders.js +676 -0
  247. package/dist/cjs/modules/word/builder/table-builders.js +53 -0
  248. package/dist/cjs/modules/word/constants.js +111 -2
  249. package/dist/cjs/modules/word/convert/conversion-ir.js +34 -0
  250. package/dist/cjs/modules/word/convert/docx-to-semantic.js +423 -0
  251. package/dist/cjs/modules/word/convert/flat-opc.js +390 -0
  252. package/dist/cjs/modules/word/convert/html/html-import.js +1852 -0
  253. package/dist/cjs/modules/word/{html-renderer.js → convert/html/html-renderer.js} +414 -67
  254. package/dist/cjs/modules/word/convert/html/html.js +20 -0
  255. package/dist/cjs/modules/word/convert/markdown/markdown-import.js +1306 -0
  256. package/dist/cjs/modules/word/convert/markdown/markdown-renderer.js +598 -0
  257. package/dist/cjs/modules/word/convert/markdown/markdown.js +21 -0
  258. package/dist/cjs/modules/word/convert/odt/odt.js +1936 -0
  259. package/dist/cjs/modules/word/core/color-utils.js +47 -0
  260. package/dist/cjs/modules/word/core/internal-utils.js +219 -0
  261. package/dist/cjs/modules/word/core/mapper.js +423 -0
  262. package/dist/cjs/modules/word/core/opc-paths.js +53 -0
  263. package/dist/cjs/modules/word/core/text-utils.js +210 -0
  264. package/dist/cjs/modules/word/core/walker.js +570 -0
  265. package/dist/cjs/modules/word/crypto.js +19 -8
  266. package/dist/cjs/modules/word/document-io.js +117 -197
  267. package/dist/cjs/modules/word/errors.js +43 -13
  268. package/dist/cjs/modules/word/excel.js +22 -0
  269. package/dist/cjs/modules/word/font/font-embed.js +652 -0
  270. package/dist/cjs/modules/word/{font-obfuscation.js → font/font-obfuscation.js} +4 -9
  271. package/dist/cjs/modules/word/font/hyphenation.js +4216 -0
  272. package/dist/cjs/modules/word/font/text-shaping.js +640 -0
  273. package/dist/cjs/modules/word/html.js +9 -7
  274. package/dist/cjs/modules/word/incremental-edit.js +280 -0
  275. package/dist/cjs/modules/word/index.base.js +353 -137
  276. package/dist/cjs/modules/word/layout/layout-full.js +440 -0
  277. package/dist/cjs/modules/word/layout/layout-model.js +11 -0
  278. package/dist/cjs/modules/word/layout/layout.js +1175 -0
  279. package/dist/cjs/modules/word/layout/render-page.js +920 -0
  280. package/dist/cjs/modules/word/markdown.js +19 -0
  281. package/dist/cjs/modules/word/patcher.js +359 -0
  282. package/dist/cjs/modules/word/query/compat.js +61 -0
  283. package/dist/cjs/modules/word/query/data-binding.js +395 -0
  284. package/dist/cjs/modules/word/query/form-fields.js +272 -0
  285. package/dist/cjs/modules/word/query/format-search.js +334 -0
  286. package/dist/cjs/modules/word/query/mail-merge.js +114 -0
  287. package/dist/cjs/modules/word/query/merge.js +620 -0
  288. package/dist/cjs/modules/word/query/replace.js +304 -0
  289. package/dist/cjs/modules/word/query/revisions.js +885 -0
  290. package/dist/cjs/modules/word/query/search.js +361 -0
  291. package/dist/cjs/modules/word/query/split.js +138 -0
  292. package/dist/cjs/modules/word/query/style-resolve.js +374 -0
  293. package/dist/cjs/modules/word/reader/chart-parser.js +772 -0
  294. package/dist/cjs/modules/word/reader/doc-props-parsers.js +194 -0
  295. package/dist/cjs/modules/word/reader/docx-reader.js +2656 -0
  296. package/dist/cjs/modules/word/reader/drawing-helpers.js +90 -0
  297. package/dist/cjs/modules/word/reader/form-field-parser.js +85 -0
  298. package/dist/cjs/modules/word/reader/image-parsers.js +293 -0
  299. package/dist/cjs/modules/word/reader/math-parser.js +424 -0
  300. package/dist/cjs/modules/word/reader/metadata-parsers.js +93 -0
  301. package/dist/cjs/modules/word/reader/numbering-parser.js +168 -0
  302. package/dist/cjs/modules/word/reader/paragraph-section-parsers.js +505 -0
  303. package/dist/cjs/modules/word/reader/parse-utils.js +271 -0
  304. package/dist/cjs/modules/word/reader/properties-parsers.js +285 -0
  305. package/dist/cjs/modules/word/reader/reader-context.js +66 -0
  306. package/dist/cjs/modules/word/reader/sdt-helpers.js +114 -0
  307. package/dist/cjs/modules/word/reader/settings-parser.js +265 -0
  308. package/dist/cjs/modules/word/reader/styles-parser.js +149 -0
  309. package/dist/cjs/modules/word/reader/table-properties-parsers.js +237 -0
  310. package/dist/cjs/modules/word/reader/theme-parser.js +169 -0
  311. package/dist/cjs/modules/word/security/cfb-reader.js +414 -0
  312. package/dist/cjs/modules/word/{digital-signatures.js → security/digital-signatures.js} +34 -34
  313. package/dist/cjs/modules/word/security/document-protection.js +208 -0
  314. package/dist/cjs/modules/word/security/encryption.js +616 -0
  315. package/dist/cjs/modules/word/security/policy.js +92 -0
  316. package/dist/cjs/modules/word/template/template-chart.js +170 -0
  317. package/dist/cjs/modules/word/template/template-datasource.js +549 -0
  318. package/dist/cjs/modules/word/template/template-engine.js +1430 -0
  319. package/dist/cjs/modules/word/units.js +44 -14
  320. package/dist/cjs/modules/word/{writers → writer}/chart-writer.js +163 -22
  321. package/dist/cjs/modules/word/{writers → writer}/comment-writer.js +3 -4
  322. package/dist/cjs/modules/word/writer/common-parts.js +104 -0
  323. package/dist/cjs/modules/word/{content-types.js → writer/content-types.js} +14 -6
  324. package/dist/cjs/modules/word/{writers → writer}/document-writer.js +118 -60
  325. package/dist/cjs/modules/word/writer/docx-packager.js +1466 -0
  326. package/dist/cjs/modules/word/{writers → writer}/footnote-writer.js +13 -10
  327. package/dist/cjs/modules/word/{writers → writer}/header-footer-writer.js +24 -15
  328. package/dist/cjs/modules/word/{writers → writer}/image-writer.js +11 -7
  329. package/dist/cjs/modules/word/{writers → writer}/numbering-writer.js +2 -1
  330. package/dist/cjs/modules/word/{writers → writer}/paragraph-writer.js +51 -37
  331. package/dist/cjs/modules/word/{writers → writer}/parts-writer.js +43 -1
  332. package/dist/cjs/modules/word/writer/reference-scanners.js +114 -0
  333. package/dist/cjs/modules/word/writer/relationships.js +124 -0
  334. package/dist/cjs/modules/word/writer/render-context.js +39 -0
  335. package/dist/cjs/modules/word/{writers → writer}/run-writer.js +50 -17
  336. package/dist/cjs/modules/word/writer/stream-buf.js +76 -0
  337. package/dist/cjs/modules/word/writer/streaming-writer.js +1151 -0
  338. package/dist/cjs/modules/word/writer/string-buf.js +11 -0
  339. package/dist/cjs/modules/word/{writers → writer}/styles-writer.js +32 -1
  340. package/dist/cjs/modules/word/{writers → writer}/table-writer.js +7 -7
  341. package/dist/cjs/utils/font-metrics.js +303 -0
  342. package/dist/cjs/utils/string-buf.js +92 -0
  343. package/dist/cjs/utils/theme-colors.js +126 -0
  344. package/dist/esm/modules/excel/utils/string-buf.js +4 -81
  345. package/dist/esm/modules/pdf/excel-bridge.js +32 -0
  346. package/dist/esm/modules/pdf/font/metrics.js +3 -237
  347. package/dist/esm/modules/pdf/index.js +1 -1
  348. package/dist/esm/modules/pdf/word-bridge.js +2226 -143
  349. package/dist/esm/modules/stream/browser/readable.js +5 -5
  350. package/dist/esm/modules/word/advanced/diff.js +167 -0
  351. package/dist/esm/modules/word/advanced/drawing-shapes.js +268 -0
  352. package/dist/esm/modules/word/advanced/field-engine.js +1169 -0
  353. package/dist/esm/modules/word/advanced/glossary.js +79 -0
  354. package/dist/esm/modules/word/advanced/math-convert.js +595 -0
  355. package/dist/esm/modules/word/advanced/ole-objects.js +271 -0
  356. package/dist/esm/modules/word/advanced/style-map.js +322 -0
  357. package/dist/esm/modules/word/advanced/validation.js +973 -0
  358. package/dist/esm/modules/word/advanced/vba-project.js +243 -0
  359. package/dist/esm/modules/word/bridge/excel-bridge.js +949 -0
  360. package/dist/esm/modules/word/builder/document-handle.js +488 -0
  361. package/dist/esm/modules/word/builder/paragraph-builders.js +87 -0
  362. package/dist/esm/modules/word/builder/run-builders.js +600 -0
  363. package/dist/esm/modules/word/builder/table-builders.js +45 -0
  364. package/dist/esm/modules/word/constants.js +109 -1
  365. package/dist/esm/modules/word/convert/conversion-ir.js +31 -0
  366. package/dist/esm/modules/word/convert/docx-to-semantic.js +420 -0
  367. package/dist/esm/modules/word/convert/flat-opc.js +385 -0
  368. package/dist/esm/modules/word/convert/html/html-import.js +1849 -0
  369. package/dist/{browser/modules/word → esm/modules/word/convert/html}/html-renderer.js +414 -67
  370. package/dist/esm/modules/word/convert/html/html.js +15 -0
  371. package/dist/esm/modules/word/convert/markdown/markdown-import.js +1302 -0
  372. package/dist/esm/modules/word/convert/markdown/markdown-renderer.js +595 -0
  373. package/dist/esm/modules/word/convert/markdown/markdown.js +15 -0
  374. package/dist/esm/modules/word/convert/odt/odt.js +1932 -0
  375. package/dist/esm/modules/word/core/color-utils.js +43 -0
  376. package/dist/esm/modules/word/core/internal-utils.js +209 -0
  377. package/dist/esm/modules/word/core/mapper.js +420 -0
  378. package/dist/esm/modules/word/core/opc-paths.js +48 -0
  379. package/dist/esm/modules/word/core/text-utils.js +202 -0
  380. package/dist/esm/modules/word/core/walker.js +563 -0
  381. package/dist/esm/modules/word/crypto.js +13 -7
  382. package/dist/esm/modules/word/document-io.js +80 -197
  383. package/dist/esm/modules/word/errors.js +39 -2
  384. package/dist/esm/modules/word/excel.js +13 -0
  385. package/dist/esm/modules/word/font/font-embed.js +646 -0
  386. package/dist/{browser/modules/word → esm/modules/word/font}/font-obfuscation.js +4 -9
  387. package/dist/esm/modules/word/font/hyphenation.js +4210 -0
  388. package/dist/esm/modules/word/font/text-shaping.js +635 -0
  389. package/dist/esm/modules/word/html.js +6 -5
  390. package/dist/esm/modules/word/incremental-edit.js +275 -0
  391. package/dist/esm/modules/word/index.base.js +121 -29
  392. package/dist/esm/modules/word/layout/layout-full.js +437 -0
  393. package/dist/esm/modules/word/layout/layout-model.js +10 -0
  394. package/dist/esm/modules/word/layout/layout.js +1172 -0
  395. package/dist/esm/modules/word/layout/render-page.js +915 -0
  396. package/dist/esm/modules/word/markdown.js +13 -0
  397. package/dist/esm/modules/word/patcher.js +357 -0
  398. package/dist/esm/modules/word/query/compat.js +58 -0
  399. package/dist/esm/modules/word/query/data-binding.js +392 -0
  400. package/dist/esm/modules/word/query/form-fields.js +268 -0
  401. package/dist/esm/modules/word/query/format-search.js +329 -0
  402. package/dist/esm/modules/word/query/mail-merge.js +111 -0
  403. package/dist/esm/modules/word/query/merge.js +617 -0
  404. package/dist/esm/modules/word/query/replace.js +301 -0
  405. package/dist/esm/modules/word/query/revisions.js +879 -0
  406. package/dist/esm/modules/word/query/search.js +346 -0
  407. package/dist/esm/modules/word/query/split.js +135 -0
  408. package/dist/esm/modules/word/query/style-resolve.js +368 -0
  409. package/dist/esm/modules/word/reader/chart-parser.js +768 -0
  410. package/dist/esm/modules/word/reader/doc-props-parsers.js +190 -0
  411. package/dist/esm/modules/word/reader/docx-reader.js +2653 -0
  412. package/dist/esm/modules/word/reader/drawing-helpers.js +84 -0
  413. package/dist/esm/modules/word/reader/form-field-parser.js +82 -0
  414. package/dist/esm/modules/word/reader/image-parsers.js +291 -0
  415. package/dist/esm/modules/word/reader/math-parser.js +422 -0
  416. package/dist/esm/modules/word/reader/metadata-parsers.js +87 -0
  417. package/dist/esm/modules/word/reader/numbering-parser.js +166 -0
  418. package/dist/esm/modules/word/reader/paragraph-section-parsers.js +503 -0
  419. package/dist/esm/modules/word/reader/parse-utils.js +249 -0
  420. package/dist/esm/modules/word/reader/properties-parsers.js +279 -0
  421. package/dist/esm/modules/word/reader/reader-context.js +61 -0
  422. package/dist/esm/modules/word/reader/sdt-helpers.js +111 -0
  423. package/dist/esm/modules/word/reader/settings-parser.js +263 -0
  424. package/dist/esm/modules/word/reader/styles-parser.js +147 -0
  425. package/dist/esm/modules/word/reader/table-properties-parsers.js +234 -0
  426. package/dist/esm/modules/word/reader/theme-parser.js +167 -0
  427. package/dist/esm/modules/word/security/cfb-reader.js +410 -0
  428. package/dist/esm/modules/word/{digital-signatures.js → security/digital-signatures.js} +34 -34
  429. package/dist/esm/modules/word/security/document-protection.js +201 -0
  430. package/dist/esm/modules/word/security/encryption.js +606 -0
  431. package/dist/esm/modules/word/security/policy.js +88 -0
  432. package/dist/esm/modules/word/template/template-chart.js +167 -0
  433. package/dist/esm/modules/word/template/template-datasource.js +541 -0
  434. package/dist/esm/modules/word/template/template-engine.js +1435 -0
  435. package/dist/esm/modules/word/units.js +43 -14
  436. package/dist/esm/modules/word/{writers → writer}/chart-writer.js +164 -23
  437. package/dist/esm/modules/word/{writers → writer}/comment-writer.js +3 -4
  438. package/dist/esm/modules/word/writer/common-parts.js +101 -0
  439. package/dist/{browser/modules/word → esm/modules/word/writer}/content-types.js +14 -6
  440. package/dist/esm/modules/word/{writers → writer}/document-writer.js +118 -60
  441. package/dist/esm/modules/word/writer/docx-packager.js +1430 -0
  442. package/dist/{browser/modules/word/writers → esm/modules/word/writer}/footnote-writer.js +13 -10
  443. package/dist/{browser/modules/word/writers → esm/modules/word/writer}/header-footer-writer.js +25 -16
  444. package/dist/esm/modules/word/{writers → writer}/image-writer.js +11 -7
  445. package/dist/{browser/modules/word/writers → esm/modules/word/writer}/numbering-writer.js +2 -1
  446. package/dist/esm/modules/word/{writers → writer}/paragraph-writer.js +52 -38
  447. package/dist/{browser/modules/word/writers → esm/modules/word/writer}/parts-writer.js +43 -1
  448. package/dist/esm/modules/word/writer/reference-scanners.js +105 -0
  449. package/dist/esm/modules/word/writer/relationships.js +117 -0
  450. package/dist/esm/modules/word/writer/render-context.js +35 -0
  451. package/dist/{browser/modules/word/writers → esm/modules/word/writer}/run-writer.js +49 -17
  452. package/dist/esm/modules/word/writer/stream-buf.js +73 -0
  453. package/dist/esm/modules/word/writer/streaming-writer.js +1146 -0
  454. package/dist/esm/modules/word/writer/string-buf.js +7 -0
  455. package/dist/esm/modules/word/{writers → writer}/styles-writer.js +32 -1
  456. package/dist/{browser/modules/word/writers → esm/modules/word/writer}/table-writer.js +7 -7
  457. package/dist/esm/utils/font-metrics.js +293 -0
  458. package/dist/esm/utils/string-buf.js +89 -0
  459. package/dist/esm/utils/theme-colors.js +120 -0
  460. package/dist/iife/excelts.iife.js +70418 -70313
  461. package/dist/iife/excelts.iife.js.map +1 -1
  462. package/dist/iife/excelts.iife.min.js +57 -57
  463. package/dist/types/modules/excel/utils/string-buf.d.ts +5 -26
  464. package/dist/types/modules/pdf/excel-bridge.d.ts +29 -0
  465. package/dist/types/modules/pdf/font/metrics.d.ts +3 -52
  466. package/dist/types/modules/pdf/index.d.ts +1 -1
  467. package/dist/types/modules/pdf/word-bridge.d.ts +35 -4
  468. package/dist/types/modules/word/advanced/diff.d.ts +61 -0
  469. package/dist/types/modules/word/advanced/drawing-shapes.d.ts +269 -0
  470. package/dist/types/modules/word/advanced/field-engine.d.ts +43 -0
  471. package/dist/types/modules/word/advanced/glossary.d.ts +86 -0
  472. package/dist/types/modules/word/advanced/math-convert.d.ts +30 -0
  473. package/dist/types/modules/word/advanced/ole-objects.d.ts +115 -0
  474. package/dist/types/modules/word/advanced/style-map.d.ts +105 -0
  475. package/dist/types/modules/word/advanced/validation.d.ts +56 -0
  476. package/dist/types/modules/word/advanced/vba-project.d.ts +91 -0
  477. package/dist/types/modules/word/bridge/excel-bridge.d.ts +127 -0
  478. package/dist/types/modules/word/builder/document-handle.d.ts +151 -0
  479. package/dist/types/modules/word/builder/paragraph-builders.d.ts +55 -0
  480. package/dist/types/modules/word/builder/run-builders.d.ts +374 -0
  481. package/dist/types/modules/word/builder/table-builders.d.ts +23 -0
  482. package/dist/types/modules/word/constants.d.ts +39 -1
  483. package/dist/types/modules/word/convert/conversion-ir.d.ts +163 -0
  484. package/dist/types/modules/word/convert/docx-to-semantic.d.ts +39 -0
  485. package/dist/types/modules/word/convert/flat-opc.d.ts +44 -0
  486. package/dist/types/modules/word/convert/html/html-import.d.ts +50 -0
  487. package/dist/{browser/modules/word → types/modules/word/convert/html}/html-renderer.d.ts +14 -1
  488. package/dist/types/modules/word/convert/html/html.d.ts +15 -0
  489. package/dist/types/modules/word/convert/markdown/markdown-import.d.ts +55 -0
  490. package/dist/types/modules/word/convert/markdown/markdown-renderer.d.ts +25 -0
  491. package/dist/types/modules/word/convert/markdown/markdown.d.ts +15 -0
  492. package/dist/types/modules/word/convert/odt/odt.d.ts +41 -0
  493. package/dist/types/modules/word/{color-utils.d.ts → core/color-utils.d.ts} +8 -1
  494. package/dist/types/modules/word/core/internal-utils.d.ts +90 -0
  495. package/dist/types/modules/word/core/mapper.d.ts +44 -0
  496. package/dist/types/modules/word/core/opc-paths.d.ts +33 -0
  497. package/dist/types/modules/word/core/text-utils.d.ts +38 -0
  498. package/dist/types/modules/word/core/walker.d.ts +119 -0
  499. package/dist/types/modules/word/crypto.d.ts +14 -9
  500. package/dist/types/modules/word/document-io.d.ts +59 -27
  501. package/dist/types/modules/word/errors.d.ts +32 -1
  502. package/dist/types/modules/word/excel.d.ts +14 -0
  503. package/dist/types/modules/word/font/font-embed.d.ts +112 -0
  504. package/dist/types/modules/word/font/hyphenation.d.ts +65 -0
  505. package/dist/types/modules/word/font/text-shaping.d.ts +58 -0
  506. package/dist/types/modules/word/html.d.ts +7 -6
  507. package/dist/types/modules/word/incremental-edit.d.ts +123 -0
  508. package/dist/types/modules/word/index.base.d.ts +177 -10
  509. package/dist/types/modules/word/layout/layout-full.d.ts +26 -0
  510. package/dist/types/modules/word/layout/layout-model.d.ts +129 -0
  511. package/dist/types/modules/word/layout/layout.d.ts +63 -0
  512. package/dist/types/modules/word/layout/render-page.d.ts +57 -0
  513. package/dist/types/modules/word/markdown.d.ts +14 -0
  514. package/dist/types/modules/word/patcher.d.ts +54 -0
  515. package/dist/types/modules/word/query/compat.d.ts +25 -0
  516. package/dist/types/modules/word/query/data-binding.d.ts +22 -0
  517. package/dist/types/modules/word/query/form-fields.d.ts +41 -0
  518. package/dist/types/modules/word/query/format-search.d.ts +99 -0
  519. package/dist/types/modules/word/query/mail-merge.d.ts +25 -0
  520. package/dist/types/modules/word/query/merge.d.ts +50 -0
  521. package/dist/types/modules/word/query/replace.d.ts +47 -0
  522. package/dist/types/modules/word/query/revisions.d.ts +67 -0
  523. package/dist/types/modules/word/query/search.d.ts +129 -0
  524. package/dist/types/modules/word/query/split.d.ts +44 -0
  525. package/dist/types/modules/word/query/style-resolve.d.ts +104 -0
  526. package/dist/types/modules/word/reader/chart-parser.d.ts +20 -0
  527. package/dist/types/modules/word/reader/doc-props-parsers.d.ts +15 -0
  528. package/dist/types/modules/word/reader/docx-reader.d.ts +27 -0
  529. package/dist/types/modules/word/reader/drawing-helpers.d.ts +27 -0
  530. package/dist/types/modules/word/reader/form-field-parser.d.ts +21 -0
  531. package/dist/types/modules/word/reader/image-parsers.d.ts +11 -0
  532. package/dist/types/modules/word/reader/math-parser.d.ts +12 -0
  533. package/dist/types/modules/word/reader/metadata-parsers.d.ts +17 -0
  534. package/dist/types/modules/word/reader/numbering-parser.d.ts +13 -0
  535. package/dist/types/modules/word/reader/paragraph-section-parsers.d.ts +12 -0
  536. package/dist/types/modules/word/reader/parse-utils.d.ts +91 -0
  537. package/dist/types/modules/word/reader/properties-parsers.d.ts +21 -0
  538. package/dist/types/modules/word/reader/reader-context.d.ts +69 -0
  539. package/dist/types/modules/word/reader/sdt-helpers.d.ts +29 -0
  540. package/dist/types/modules/word/reader/settings-parser.d.ts +8 -0
  541. package/dist/types/modules/word/reader/styles-parser.d.ts +12 -0
  542. package/dist/types/modules/word/reader/table-properties-parsers.d.ts +12 -0
  543. package/dist/types/modules/word/reader/theme-parser.d.ts +8 -0
  544. package/dist/types/modules/word/security/cfb-reader.d.ts +37 -0
  545. package/dist/types/modules/word/{digital-signatures.d.ts → security/digital-signatures.d.ts} +19 -11
  546. package/dist/types/modules/word/security/document-protection.d.ts +93 -0
  547. package/dist/{browser/modules/word → types/modules/word/security}/encryption.d.ts +45 -1
  548. package/dist/types/modules/word/security/policy.d.ts +66 -0
  549. package/dist/types/modules/word/template/template-chart.d.ts +56 -0
  550. package/dist/types/modules/word/template/template-datasource.d.ts +154 -0
  551. package/dist/types/modules/word/template/template-engine.d.ts +121 -0
  552. package/dist/types/modules/word/types.d.ts +188 -23
  553. package/dist/types/modules/word/units.d.ts +26 -0
  554. package/dist/{browser/modules/word/writers → types/modules/word/writer}/comment-writer.d.ts +2 -1
  555. package/dist/types/modules/word/writer/common-parts.d.ts +42 -0
  556. package/dist/{browser/modules/word → types/modules/word/writer}/content-types.d.ts +2 -2
  557. package/dist/types/modules/word/{writers → writer}/document-writer.d.ts +5 -7
  558. package/dist/{browser/modules/word → types/modules/word/writer}/docx-packager.d.ts +5 -1
  559. package/dist/{browser/modules/word/writers → types/modules/word/writer}/footnote-writer.d.ts +3 -2
  560. package/dist/{browser/modules/word/writers → types/modules/word/writer}/header-footer-writer.d.ts +3 -2
  561. package/dist/{browser/modules/word/writers → types/modules/word/writer}/image-writer.d.ts +1 -1
  562. package/dist/types/modules/word/{writers → writer}/paragraph-writer.d.ts +2 -1
  563. package/dist/types/modules/word/writer/reference-scanners.d.ts +36 -0
  564. package/dist/types/modules/word/writer/relationships.d.ts +52 -0
  565. package/dist/types/modules/word/writer/render-context.d.ts +93 -0
  566. package/dist/types/modules/word/{writers → writer}/run-writer.d.ts +9 -1
  567. package/dist/types/modules/word/writer/stream-buf.d.ts +37 -0
  568. package/dist/types/modules/word/writer/streaming-writer.d.ts +244 -0
  569. package/dist/types/modules/word/writer/string-buf.d.ts +8 -0
  570. package/dist/types/modules/word/{writers → writer}/table-writer.d.ts +2 -1
  571. package/dist/types/utils/font-metrics.d.ts +63 -0
  572. package/dist/types/utils/string-buf.d.ts +42 -0
  573. package/dist/types/utils/theme-colors.d.ts +55 -0
  574. package/package.json +117 -39
  575. package/dist/browser/modules/word/color-utils.js +0 -94
  576. package/dist/browser/modules/word/document.d.ts +0 -657
  577. package/dist/browser/modules/word/document.js +0 -1533
  578. package/dist/browser/modules/word/docx-packager.js +0 -822
  579. package/dist/browser/modules/word/docx-reader.d.ts +0 -11
  580. package/dist/browser/modules/word/docx-reader.js +0 -4929
  581. package/dist/browser/modules/word/encryption.js +0 -274
  582. package/dist/browser/modules/word/internal-utils.d.ts +0 -23
  583. package/dist/browser/modules/word/internal-utils.js +0 -54
  584. package/dist/browser/modules/word/namespaces.d.ts +0 -159
  585. package/dist/browser/modules/word/namespaces.js +0 -189
  586. package/dist/browser/modules/word/relationships.d.ts +0 -30
  587. package/dist/browser/modules/word/relationships.js +0 -48
  588. package/dist/cjs/modules/word/color-utils.js +0 -97
  589. package/dist/cjs/modules/word/document.js +0 -1645
  590. package/dist/cjs/modules/word/docx-packager.js +0 -825
  591. package/dist/cjs/modules/word/docx-reader.js +0 -4932
  592. package/dist/cjs/modules/word/encryption.js +0 -282
  593. package/dist/cjs/modules/word/internal-utils.js +0 -59
  594. package/dist/cjs/modules/word/namespaces.js +0 -192
  595. package/dist/cjs/modules/word/relationships.js +0 -55
  596. package/dist/esm/modules/word/color-utils.js +0 -94
  597. package/dist/esm/modules/word/document.js +0 -1533
  598. package/dist/esm/modules/word/docx-packager.js +0 -822
  599. package/dist/esm/modules/word/docx-reader.js +0 -4929
  600. package/dist/esm/modules/word/encryption.js +0 -274
  601. package/dist/esm/modules/word/internal-utils.js +0 -54
  602. package/dist/esm/modules/word/namespaces.js +0 -189
  603. package/dist/esm/modules/word/relationships.js +0 -48
  604. package/dist/types/modules/word/document.d.ts +0 -657
  605. package/dist/types/modules/word/docx-reader.d.ts +0 -11
  606. package/dist/types/modules/word/internal-utils.d.ts +0 -23
  607. package/dist/types/modules/word/namespaces.d.ts +0 -159
  608. package/dist/types/modules/word/relationships.d.ts +0 -30
  609. /package/dist/browser/modules/word/{font-obfuscation.d.ts → font/font-obfuscation.d.ts} +0 -0
  610. /package/dist/browser/modules/word/{writers → writer}/chart-writer.d.ts +0 -0
  611. /package/dist/browser/modules/word/{writers → writer}/checkbox-writer.d.ts +0 -0
  612. /package/dist/browser/modules/word/{writers → writer}/checkbox-writer.js +0 -0
  613. /package/dist/browser/modules/word/{writers → writer}/math-writer.d.ts +0 -0
  614. /package/dist/browser/modules/word/{writers → writer}/math-writer.js +0 -0
  615. /package/dist/browser/modules/word/{writers → writer}/numbering-writer.d.ts +0 -0
  616. /package/dist/browser/modules/word/{writers → writer}/parts-writer.d.ts +0 -0
  617. /package/dist/browser/modules/word/{writers → writer}/section-writer.d.ts +0 -0
  618. /package/dist/browser/modules/word/{writers → writer}/section-writer.js +0 -0
  619. /package/dist/browser/modules/word/{writers → writer}/styles-writer.d.ts +0 -0
  620. /package/dist/browser/modules/word/{writers → writer}/textbox-writer.d.ts +0 -0
  621. /package/dist/browser/modules/word/{writers → writer}/textbox-writer.js +0 -0
  622. /package/dist/browser/modules/word/{writers → writer}/toc-writer.d.ts +0 -0
  623. /package/dist/browser/modules/word/{writers → writer}/toc-writer.js +0 -0
  624. /package/dist/cjs/modules/word/{writers → writer}/checkbox-writer.js +0 -0
  625. /package/dist/cjs/modules/word/{writers → writer}/math-writer.js +0 -0
  626. /package/dist/cjs/modules/word/{writers → writer}/section-writer.js +0 -0
  627. /package/dist/cjs/modules/word/{writers → writer}/textbox-writer.js +0 -0
  628. /package/dist/cjs/modules/word/{writers → writer}/toc-writer.js +0 -0
  629. /package/dist/esm/modules/word/{writers → writer}/checkbox-writer.js +0 -0
  630. /package/dist/esm/modules/word/{writers → writer}/math-writer.js +0 -0
  631. /package/dist/esm/modules/word/{writers → writer}/section-writer.js +0 -0
  632. /package/dist/esm/modules/word/{writers → writer}/textbox-writer.js +0 -0
  633. /package/dist/esm/modules/word/{writers → writer}/toc-writer.js +0 -0
  634. /package/dist/types/modules/word/{font-obfuscation.d.ts → font/font-obfuscation.d.ts} +0 -0
  635. /package/dist/types/modules/word/{writers → writer}/chart-writer.d.ts +0 -0
  636. /package/dist/types/modules/word/{writers → writer}/checkbox-writer.d.ts +0 -0
  637. /package/dist/types/modules/word/{writers → writer}/math-writer.d.ts +0 -0
  638. /package/dist/types/modules/word/{writers → writer}/numbering-writer.d.ts +0 -0
  639. /package/dist/types/modules/word/{writers → writer}/parts-writer.d.ts +0 -0
  640. /package/dist/types/modules/word/{writers → writer}/section-writer.d.ts +0 -0
  641. /package/dist/types/modules/word/{writers → writer}/styles-writer.d.ts +0 -0
  642. /package/dist/types/modules/word/{writers → writer}/textbox-writer.d.ts +0 -0
  643. /package/dist/types/modules/word/{writers → writer}/toc-writer.d.ts +0 -0
@@ -1,29 +1,8 @@
1
1
  /**
2
- * StringBuf - Cross-Platform String Buffer
2
+ * Re-export of the shared {@link StringBuf} from `@utils/string-buf`.
3
3
  *
4
- * A way to keep string memory operations to a minimum while building XML strings.
5
- * Uses TextEncoder and Uint8Array for cross-platform compatibility (Node.js + Browser).
4
+ * Kept as a thin alias so existing imports (`@excel/utils/string-buf`)
5
+ * continue to work without churn.
6
6
  */
7
- interface StringBufOptions {
8
- size?: number;
9
- encoding?: string;
10
- }
11
- /**
12
- * StringBuf - efficient string builder using Uint8Array
13
- * Works identically in Node.js and Browser environments.
14
- */
15
- declare class StringBuf {
16
- private _buf;
17
- private _inPos;
18
- private _buffer;
19
- constructor(options?: StringBufOptions);
20
- get length(): number;
21
- get capacity(): number;
22
- get buffer(): Uint8Array;
23
- toBuffer(): Uint8Array;
24
- reset(position?: number): void;
25
- private _grow;
26
- addText(text: string): void;
27
- addStringBuf(inBuf: StringBuf): void;
28
- }
29
- export { StringBuf };
7
+ export { StringBuf } from "../../../utils/string-buf.js";
8
+ export type { StringBufOptions } from "../../../utils/string-buf.js";
@@ -1,84 +1,7 @@
1
1
  /**
2
- * StringBuf - Cross-Platform String Buffer
2
+ * Re-export of the shared {@link StringBuf} from `@utils/string-buf`.
3
3
  *
4
- * A way to keep string memory operations to a minimum while building XML strings.
5
- * Uses TextEncoder and Uint8Array for cross-platform compatibility (Node.js + Browser).
4
+ * Kept as a thin alias so existing imports (`@excel/utils/string-buf`)
5
+ * continue to work without churn.
6
6
  */
7
- const encoder = new TextEncoder();
8
- /**
9
- * StringBuf - efficient string builder using Uint8Array
10
- * Works identically in Node.js and Browser environments.
11
- */
12
- class StringBuf {
13
- constructor(options) {
14
- this._buf = new Uint8Array((options && options.size) || 16384);
15
- // TextEncoder only supports UTF-8, so encoding option is ignored
16
- this._inPos = 0;
17
- this._buffer = undefined;
18
- }
19
- get length() {
20
- return this._inPos;
21
- }
22
- get capacity() {
23
- return this._buf.length;
24
- }
25
- get buffer() {
26
- return this._buf;
27
- }
28
- toBuffer() {
29
- // Return the current data as a single enclosing buffer
30
- if (!this._buffer) {
31
- this._buffer = this._buf.slice(0, this._inPos);
32
- }
33
- return this._buffer;
34
- }
35
- reset(position) {
36
- position = position ?? 0;
37
- this._buffer = undefined;
38
- this._inPos = position;
39
- }
40
- _grow(min) {
41
- let size = this._buf.length * 2;
42
- while (size < min) {
43
- size *= 2;
44
- }
45
- const buf = new Uint8Array(size);
46
- buf.set(this._buf);
47
- this._buf = buf;
48
- }
49
- addText(text) {
50
- this._buffer = undefined;
51
- // Ensure there's room for at least the string length (optimistic: 1 byte per char).
52
- const optimistic = this._inPos + text.length;
53
- if (optimistic > this._buf.length - 4) {
54
- this._grow(optimistic);
55
- }
56
- // Use encodeInto to write directly into the buffer, avoiding the
57
- // intermediate Uint8Array allocation that encoder.encode() creates.
58
- const target = this._buf.subarray(this._inPos);
59
- const result = encoder.encodeInto(text, target);
60
- if (result.read < text.length) {
61
- // Didn't fit — text has multi-byte UTF-8 chars that exceed the optimistic estimate.
62
- // Grow to accommodate the remainder (worst case: 3 bytes per remaining char).
63
- const remaining = text.length - result.read;
64
- this._grow(this._inPos + result.written + remaining * 3);
65
- const result2 = encoder.encodeInto(text.substring(result.read), this._buf.subarray(this._inPos + result.written));
66
- this._inPos += result.written + result2.written;
67
- }
68
- else {
69
- this._inPos += result.written;
70
- }
71
- }
72
- addStringBuf(inBuf) {
73
- if (inBuf.length) {
74
- this._buffer = undefined;
75
- if (this.length + inBuf.length > this.capacity) {
76
- this._grow(this.length + inBuf.length);
77
- }
78
- // Copy bytes from input buffer
79
- this._buf.set(inBuf._buf.subarray(0, inBuf.length), this._inPos);
80
- this._inPos += inBuf.length;
81
- }
82
- }
83
- }
84
- export { StringBuf };
7
+ export { StringBuf } from "../../../utils/string-buf.js";
@@ -3,6 +3,7 @@
3
3
  *
4
4
  * Converts Excel Workbook data into the PDF module's independent data model.
5
5
  * This is the ONLY file in the PDF module that imports from @excel.
6
+ * It also imports from @word/bridge/excel-bridge for Word chart → ChartModel mapping.
6
7
  *
7
8
  * @example
8
9
  * ```typescript
@@ -16,6 +17,8 @@
16
17
  */
17
18
  import type { Chart, RegionMapDataOptions } from "../excel/chart/index.js";
18
19
  import type { Workbook } from "../excel/workbook.js";
20
+ import type { Chart as WordChart } from "../word/types.js";
21
+ import { type PdfPageBuilder } from "./builder/document-builder.js";
19
22
  import { type PdfExportOptions } from "./types.js";
20
23
  /**
21
24
  * Export an Excel Workbook directly to PDF.
@@ -97,3 +100,29 @@ export interface ChartToPdfOptions {
97
100
  * `@cj-tech-master/excelts/pdf` alongside `excelToPdf`.
98
101
  */
99
102
  export declare function chartToPdf(chart: Chart, options?: ChartToPdfOptions): Promise<Uint8Array>;
103
+ /**
104
+ * Create a chart renderer callback for use with `docxToPdf`.
105
+ *
106
+ * This factory returns a function that converts Word Chart definitions
107
+ * into Excel's internal ChartModel and renders them using the full
108
+ * Excel chart rendering engine (8000+ lines of vector drawing logic).
109
+ *
110
+ * Requires `installChartSupport()` to have been called.
111
+ *
112
+ * @example
113
+ * ```typescript
114
+ * import { installChartSupport } from "excelts/chart";
115
+ * import { docxToPdf, createWordChartPdfRenderer } from "excelts/pdf";
116
+ *
117
+ * installChartSupport();
118
+ * const pdfBytes = await docxToPdf(doc, {
119
+ * chartRenderer: createWordChartPdfRenderer()
120
+ * });
121
+ * ```
122
+ */
123
+ export declare function createWordChartPdfRenderer(): (chart: WordChart, page: PdfPageBuilder, rect: {
124
+ x: number;
125
+ y: number;
126
+ width: number;
127
+ height: number;
128
+ }) => void;
@@ -3,6 +3,7 @@
3
3
  *
4
4
  * Converts Excel Workbook data into the PDF module's independent data model.
5
5
  * This is the ONLY file in the PDF module that imports from @excel.
6
+ * It also imports from @word/bridge/excel-bridge for Word chart → ChartModel mapping.
6
7
  *
7
8
  * @example
8
9
  * ```typescript
@@ -25,6 +26,7 @@ import { ValueType } from "../excel/enums.js";
25
26
  import { formatCellValue } from "../excel/utils/cell-format.js";
26
27
  import { tryInvokeFormulaEngine } from "../formula/host-registry.js";
27
28
  import { base64ToUint8Array } from "../../utils/utils.base.js";
29
+ import { wordChartToChartModel } from "../word/bridge/excel-bridge.js";
28
30
  import { PdfDocumentBuilder } from "./builder/document-builder.js";
29
31
  import { exportPdf } from "./render/pdf-exporter.js";
30
32
  import { PdfCellType } from "./types.js";
@@ -1140,3 +1142,33 @@ async function convertChartsheet(cs) {
1140
1142
  pageSetup
1141
1143
  };
1142
1144
  }
1145
+ // =============================================================================
1146
+ // Word Chart → PDF Integration
1147
+ // =============================================================================
1148
+ /**
1149
+ * Create a chart renderer callback for use with `docxToPdf`.
1150
+ *
1151
+ * This factory returns a function that converts Word Chart definitions
1152
+ * into Excel's internal ChartModel and renders them using the full
1153
+ * Excel chart rendering engine (8000+ lines of vector drawing logic).
1154
+ *
1155
+ * Requires `installChartSupport()` to have been called.
1156
+ *
1157
+ * @example
1158
+ * ```typescript
1159
+ * import { installChartSupport } from "excelts/chart";
1160
+ * import { docxToPdf, createWordChartPdfRenderer } from "excelts/pdf";
1161
+ *
1162
+ * installChartSupport();
1163
+ * const pdfBytes = await docxToPdf(doc, {
1164
+ * chartRenderer: createWordChartPdfRenderer()
1165
+ * });
1166
+ * ```
1167
+ */
1168
+ export function createWordChartPdfRenderer() {
1169
+ return (chart, page, rect) => {
1170
+ const support = getChartSupport();
1171
+ const model = wordChartToChartModel(chart);
1172
+ support.drawChartPdf(page, model, rect);
1173
+ };
1174
+ }
@@ -1,59 +1,10 @@
1
1
  /**
2
2
  * Character width metrics for the 14 PDF standard Type 1 fonts.
3
3
  *
4
- * These metrics are specified in 1/1000 of a text unit. To get the actual width
5
- * of a character at a given font size:
6
- * width_in_points = (charWidth / 1000) * fontSize
7
- *
8
- * The 14 standard fonts are guaranteed to be available in every PDF viewer:
9
- * - Helvetica, Helvetica-Bold, Helvetica-Oblique, Helvetica-BoldOblique
10
- * - Times-Roman, Times-Bold, Times-Italic, Times-BoldItalic
11
- * - Courier, Courier-Bold, Courier-Oblique, Courier-BoldOblique
12
- * - Symbol, ZapfDingbats
13
- *
14
- * We provide metrics for the most commonly needed: Helvetica and Times families,
15
- * plus Courier (fixed-width). For other fonts, we fall back to Helvetica metrics.
16
- *
17
- * Character widths are for the Latin-1 (ISO 8859-1) encoding.
4
+ * This module re-exports from the shared @utils/font-metrics to avoid
5
+ * data duplication while maintaining backward compatibility.
18
6
  *
19
7
  * @see PDF Reference 1.7, Appendix D - Standard Type 1 Fonts
20
8
  * @see Adobe Font Metrics files (AFM) for canonical widths
21
9
  */
22
- /**
23
- * Get the width of a character in a given font.
24
- * @param charCode - Unicode code point (or char code)
25
- * @param fontName - PDF standard font name
26
- * @returns Width in thousandths of a unit
27
- */
28
- export declare function getCharWidth(charCode: number, fontName: string): number;
29
- /**
30
- * Measure the width of a text string in the given font and size.
31
- * @param text - The string to measure
32
- * @param fontName - PDF standard font name
33
- * @param fontSize - Font size in points
34
- * @returns Width in points
35
- */
36
- export declare function measureText(text: string, fontName: string, fontSize: number): number;
37
- /**
38
- * Get the font ascent for a given font and size.
39
- * @returns Ascent in points (positive, distance above baseline)
40
- */
41
- export declare function getFontAscent(fontName: string, fontSize: number): number;
42
- /**
43
- * Get the font descent for a given font and size.
44
- * @returns Descent in points (negative, distance below baseline)
45
- */
46
- export declare function getFontDescent(fontName: string, fontSize: number): number;
47
- /**
48
- * Get the total line height (ascent - descent) for a font.
49
- * @returns Line height in points
50
- */
51
- export declare function getLineHeight(fontName: string, fontSize: number): number;
52
- /**
53
- * Check if a font name is a known standard PDF font.
54
- */
55
- export declare function isStandardFont(fontName: string): boolean;
56
- /**
57
- * Get all supported standard font names.
58
- */
59
- export declare function getStandardFontNames(): string[];
10
+ export { measureTextWidth as measureText, getCharWidth, getFontAscent, getFontDescent, getLineHeight, isStandardFont, getStandardFontNames } from "../../../utils/font-metrics.js";
@@ -1,244 +1,10 @@
1
1
  /**
2
2
  * Character width metrics for the 14 PDF standard Type 1 fonts.
3
3
  *
4
- * These metrics are specified in 1/1000 of a text unit. To get the actual width
5
- * of a character at a given font size:
6
- * width_in_points = (charWidth / 1000) * fontSize
7
- *
8
- * The 14 standard fonts are guaranteed to be available in every PDF viewer:
9
- * - Helvetica, Helvetica-Bold, Helvetica-Oblique, Helvetica-BoldOblique
10
- * - Times-Roman, Times-Bold, Times-Italic, Times-BoldItalic
11
- * - Courier, Courier-Bold, Courier-Oblique, Courier-BoldOblique
12
- * - Symbol, ZapfDingbats
13
- *
14
- * We provide metrics for the most commonly needed: Helvetica and Times families,
15
- * plus Courier (fixed-width). For other fonts, we fall back to Helvetica metrics.
16
- *
17
- * Character widths are for the Latin-1 (ISO 8859-1) encoding.
4
+ * This module re-exports from the shared @utils/font-metrics to avoid
5
+ * data duplication while maintaining backward compatibility.
18
6
  *
19
7
  * @see PDF Reference 1.7, Appendix D - Standard Type 1 Fonts
20
8
  * @see Adobe Font Metrics files (AFM) for canonical widths
21
9
  */
22
- // =============================================================================
23
- // Helvetica Metrics (afm data: Helvetica)
24
- // =============================================================================
25
- /**
26
- * Average character widths per font. We store only a representative subset:
27
- * ASCII 32-126. For characters outside this range, we use the average width.
28
- *
29
- * Values are in thousandths of a unit of text space.
30
- */
31
- // prettier-ignore
32
- const HELVETICA_WIDTHS = {
33
- 32: 278, 33: 278, 34: 355, 35: 556, 36: 556, 37: 889, 38: 667, 39: 191, 40: 333, 41: 333,
34
- 42: 389, 43: 584, 44: 278, 45: 333, 46: 278, 47: 278, 48: 556, 49: 556, 50: 556, 51: 556,
35
- 52: 556, 53: 556, 54: 556, 55: 556, 56: 556, 57: 556, 58: 278, 59: 278, 60: 584, 61: 584,
36
- 62: 584, 63: 556, 64: 1015, 65: 667, 66: 667, 67: 722, 68: 722, 69: 667, 70: 611, 71: 778,
37
- 72: 722, 73: 278, 74: 500, 75: 667, 76: 556, 77: 833, 78: 722, 79: 778, 80: 667, 81: 778,
38
- 82: 722, 83: 667, 84: 611, 85: 722, 86: 667, 87: 944, 88: 667, 89: 667, 90: 611, 91: 278,
39
- 92: 278, 93: 278, 94: 469, 95: 556, 96: 333, 97: 556, 98: 556, 99: 500, 100: 556, 101: 556,
40
- 102: 278, 103: 556, 104: 556, 105: 222, 106: 222, 107: 500, 108: 222, 109: 833, 110: 556,
41
- 111: 556, 112: 556, 113: 556, 114: 333, 115: 500, 116: 278, 117: 556, 118: 500, 119: 722,
42
- 120: 500, 121: 500, 122: 500, 123: 334, 124: 260, 125: 334, 126: 584
43
- };
44
- // prettier-ignore
45
- const HELVETICA_BOLD_WIDTHS = {
46
- 32: 278, 33: 333, 34: 474, 35: 556, 36: 556, 37: 889, 38: 722, 39: 238, 40: 333, 41: 333,
47
- 42: 389, 43: 584, 44: 278, 45: 333, 46: 278, 47: 278, 48: 556, 49: 556, 50: 556, 51: 556,
48
- 52: 556, 53: 556, 54: 556, 55: 556, 56: 556, 57: 556, 58: 333, 59: 333, 60: 584, 61: 584,
49
- 62: 584, 63: 611, 64: 975, 65: 722, 66: 722, 67: 722, 68: 722, 69: 667, 70: 611, 71: 778,
50
- 72: 722, 73: 278, 74: 556, 75: 722, 76: 611, 77: 833, 78: 722, 79: 778, 80: 667, 81: 778,
51
- 82: 722, 83: 667, 84: 611, 85: 722, 86: 667, 87: 944, 88: 667, 89: 667, 90: 611, 91: 333,
52
- 92: 278, 93: 333, 94: 584, 95: 556, 96: 333, 97: 556, 98: 611, 99: 556, 100: 611, 101: 556,
53
- 102: 333, 103: 611, 104: 611, 105: 278, 106: 278, 107: 556, 108: 278, 109: 889, 110: 611,
54
- 111: 611, 112: 611, 113: 611, 114: 389, 115: 556, 116: 333, 117: 611, 118: 556, 119: 778,
55
- 120: 556, 121: 556, 122: 500, 123: 389, 124: 280, 125: 389, 126: 584
56
- };
57
- // prettier-ignore
58
- const TIMES_ROMAN_WIDTHS = {
59
- 32: 250, 33: 333, 34: 408, 35: 500, 36: 500, 37: 833, 38: 778, 39: 180, 40: 333, 41: 333,
60
- 42: 500, 43: 564, 44: 250, 45: 333, 46: 250, 47: 278, 48: 500, 49: 500, 50: 500, 51: 500,
61
- 52: 500, 53: 500, 54: 500, 55: 500, 56: 500, 57: 500, 58: 278, 59: 278, 60: 564, 61: 564,
62
- 62: 564, 63: 444, 64: 921, 65: 722, 66: 667, 67: 667, 68: 722, 69: 611, 70: 556, 71: 722,
63
- 72: 722, 73: 333, 74: 389, 75: 722, 76: 611, 77: 889, 78: 722, 79: 722, 80: 556, 81: 722,
64
- 82: 667, 83: 556, 84: 611, 85: 722, 86: 722, 87: 944, 88: 722, 89: 722, 90: 611, 91: 333,
65
- 92: 278, 93: 333, 94: 469, 95: 500, 96: 333, 97: 444, 98: 500, 99: 444, 100: 500, 101: 444,
66
- 102: 333, 103: 500, 104: 500, 105: 278, 106: 278, 107: 500, 108: 278, 109: 778, 110: 500,
67
- 111: 500, 112: 500, 113: 500, 114: 333, 115: 389, 116: 278, 117: 500, 118: 500, 119: 722,
68
- 120: 500, 121: 500, 122: 444, 123: 480, 124: 200, 125: 480, 126: 541
69
- };
70
- // prettier-ignore
71
- const TIMES_BOLD_WIDTHS = {
72
- 32: 250, 33: 333, 34: 555, 35: 500, 36: 500, 37: 1000, 38: 833, 39: 278, 40: 333, 41: 333,
73
- 42: 500, 43: 570, 44: 250, 45: 333, 46: 250, 47: 278, 48: 500, 49: 500, 50: 500, 51: 500,
74
- 52: 500, 53: 500, 54: 500, 55: 500, 56: 500, 57: 500, 58: 333, 59: 333, 60: 570, 61: 570,
75
- 62: 570, 63: 500, 64: 930, 65: 722, 66: 667, 67: 722, 68: 722, 69: 667, 70: 611, 71: 778,
76
- 72: 778, 73: 389, 74: 500, 75: 778, 76: 667, 77: 944, 78: 722, 79: 778, 80: 611, 81: 778,
77
- 82: 722, 83: 556, 84: 667, 85: 722, 86: 722, 87: 1000, 88: 722, 89: 722, 90: 667, 91: 333,
78
- 92: 278, 93: 333, 94: 581, 95: 500, 96: 333, 97: 500, 98: 556, 99: 444, 100: 556, 101: 444,
79
- 102: 333, 103: 500, 104: 556, 105: 278, 106: 333, 107: 556, 108: 278, 109: 833, 110: 556,
80
- 111: 500, 112: 556, 113: 556, 114: 444, 115: 389, 116: 333, 117: 556, 118: 500, 119: 722,
81
- 120: 500, 121: 500, 122: 444, 123: 394, 124: 220, 125: 394, 126: 520
82
- };
83
- // Courier is monospaced - every character is 600 units wide
84
- const COURIER_WIDTH = 600;
85
- const FONT_DESCRIPTORS = {
86
- Helvetica: {
87
- ascent: 718,
88
- descent: -207,
89
- capHeight: 718,
90
- avgWidth: 513,
91
- widths: HELVETICA_WIDTHS
92
- },
93
- "Helvetica-Bold": {
94
- ascent: 718,
95
- descent: -207,
96
- capHeight: 718,
97
- avgWidth: 535,
98
- widths: HELVETICA_BOLD_WIDTHS
99
- },
100
- "Helvetica-Oblique": {
101
- ascent: 718,
102
- descent: -207,
103
- capHeight: 718,
104
- avgWidth: 513,
105
- widths: HELVETICA_WIDTHS // same widths as regular
106
- },
107
- "Helvetica-BoldOblique": {
108
- ascent: 718,
109
- descent: -207,
110
- capHeight: 718,
111
- avgWidth: 535,
112
- widths: HELVETICA_BOLD_WIDTHS
113
- },
114
- "Times-Roman": {
115
- ascent: 683,
116
- descent: -217,
117
- capHeight: 662,
118
- avgWidth: 478,
119
- widths: TIMES_ROMAN_WIDTHS
120
- },
121
- "Times-Bold": {
122
- ascent: 683,
123
- descent: -217,
124
- capHeight: 676,
125
- avgWidth: 505,
126
- widths: TIMES_BOLD_WIDTHS
127
- },
128
- "Times-Italic": {
129
- ascent: 683,
130
- descent: -217,
131
- capHeight: 653,
132
- avgWidth: 478,
133
- widths: TIMES_ROMAN_WIDTHS // approximate
134
- },
135
- "Times-BoldItalic": {
136
- ascent: 683,
137
- descent: -217,
138
- capHeight: 669,
139
- avgWidth: 505,
140
- widths: TIMES_BOLD_WIDTHS // approximate
141
- },
142
- Courier: {
143
- ascent: 629,
144
- descent: -157,
145
- capHeight: 562,
146
- avgWidth: 600,
147
- widths: null,
148
- monoWidth: COURIER_WIDTH
149
- },
150
- "Courier-Bold": {
151
- ascent: 629,
152
- descent: -157,
153
- capHeight: 562,
154
- avgWidth: 600,
155
- widths: null,
156
- monoWidth: COURIER_WIDTH
157
- },
158
- "Courier-Oblique": {
159
- ascent: 629,
160
- descent: -157,
161
- capHeight: 562,
162
- avgWidth: 600,
163
- widths: null,
164
- monoWidth: COURIER_WIDTH
165
- },
166
- "Courier-BoldOblique": {
167
- ascent: 629,
168
- descent: -157,
169
- capHeight: 562,
170
- avgWidth: 600,
171
- widths: null,
172
- monoWidth: COURIER_WIDTH
173
- }
174
- };
175
- // =============================================================================
176
- // Public API
177
- // =============================================================================
178
- /**
179
- * Get the width of a character in a given font.
180
- * @param charCode - Unicode code point (or char code)
181
- * @param fontName - PDF standard font name
182
- * @returns Width in thousandths of a unit
183
- */
184
- export function getCharWidth(charCode, fontName) {
185
- const desc = FONT_DESCRIPTORS[fontName];
186
- if (!desc) {
187
- // Fall back to Helvetica
188
- return getCharWidth(charCode, "Helvetica");
189
- }
190
- if (desc.monoWidth !== undefined) {
191
- return desc.monoWidth;
192
- }
193
- return desc.widths?.[charCode] ?? desc.avgWidth;
194
- }
195
- /**
196
- * Measure the width of a text string in the given font and size.
197
- * @param text - The string to measure
198
- * @param fontName - PDF standard font name
199
- * @param fontSize - Font size in points
200
- * @returns Width in points
201
- */
202
- export function measureText(text, fontName, fontSize) {
203
- let totalWidth = 0;
204
- for (let i = 0; i < text.length; i++) {
205
- totalWidth += getCharWidth(text.charCodeAt(i), fontName);
206
- }
207
- return (totalWidth / 1000) * fontSize;
208
- }
209
- /**
210
- * Get the font ascent for a given font and size.
211
- * @returns Ascent in points (positive, distance above baseline)
212
- */
213
- export function getFontAscent(fontName, fontSize) {
214
- const desc = FONT_DESCRIPTORS[fontName] ?? FONT_DESCRIPTORS["Helvetica"];
215
- return (desc.ascent / 1000) * fontSize;
216
- }
217
- /**
218
- * Get the font descent for a given font and size.
219
- * @returns Descent in points (negative, distance below baseline)
220
- */
221
- export function getFontDescent(fontName, fontSize) {
222
- const desc = FONT_DESCRIPTORS[fontName] ?? FONT_DESCRIPTORS["Helvetica"];
223
- return (desc.descent / 1000) * fontSize;
224
- }
225
- /**
226
- * Get the total line height (ascent - descent) for a font.
227
- * @returns Line height in points
228
- */
229
- export function getLineHeight(fontName, fontSize) {
230
- const desc = FONT_DESCRIPTORS[fontName] ?? FONT_DESCRIPTORS["Helvetica"];
231
- return ((desc.ascent - desc.descent) / 1000) * fontSize;
232
- }
233
- /**
234
- * Check if a font name is a known standard PDF font.
235
- */
236
- export function isStandardFont(fontName) {
237
- return fontName in FONT_DESCRIPTORS;
238
- }
239
- /**
240
- * Get all supported standard font names.
241
- */
242
- export function getStandardFontNames() {
243
- return Object.keys(FONT_DESCRIPTORS);
244
- }
10
+ export { measureTextWidth as measureText, getCharWidth, getFontAscent, getFontDescent, getLineHeight, isStandardFont, getStandardFontNames } from "../../../utils/font-metrics.js";
@@ -43,7 +43,7 @@
43
43
  /** Standalone PDF generation — accepts plain arrays, sheet objects, or workbooks. */
44
44
  export { pdf } from "./pdf.js";
45
45
  /** Excel-to-PDF conversion — accepts an Excel Workbook instance. */
46
- export { excelToPdf, chartToPdf, type ChartToPdfOptions } from "./excel-bridge.js";
46
+ export { excelToPdf, chartToPdf, createWordChartPdfRenderer, type ChartToPdfOptions } from "./excel-bridge.js";
47
47
  /** Word-to-PDF conversion — accepts a DocxDocument. */
48
48
  export { docxToPdf } from "./word-bridge.js";
49
49
  export type { DocxToPdfOptions } from "./word-bridge.js";
@@ -46,7 +46,7 @@
46
46
  /** Standalone PDF generation — accepts plain arrays, sheet objects, or workbooks. */
47
47
  export { pdf } from "./pdf.js";
48
48
  /** Excel-to-PDF conversion — accepts an Excel Workbook instance. */
49
- export { excelToPdf, chartToPdf } from "./excel-bridge.js";
49
+ export { excelToPdf, chartToPdf, createWordChartPdfRenderer } from "./excel-bridge.js";
50
50
  /** Word-to-PDF conversion — accepts a DocxDocument. */
51
51
  export { docxToPdf } from "./word-bridge.js";
52
52
  // =============================================================================
@@ -14,10 +14,12 @@
14
14
  * const pdfBytes = await docxToPdf(doc);
15
15
  * ```
16
16
  *
17
- * Note: This is a simple flow-based renderer. For high-fidelity output,
18
- * consider using Microsoft Word or LibreOffice.
17
+ * Note: This is a flow-based renderer with run-level formatting, images,
18
+ * lists, tables, headers/footers, and watermarks. For pixel-perfect output,
19
+ * consider Microsoft Word or LibreOffice.
19
20
  */
20
- import type { DocxDocument } from "../word/types.js";
21
+ import type { DocxDocument, Chart } from "../word/types.js";
22
+ import { type PdfPageBuilder } from "./builder/document-builder.js";
21
23
  /** Options for DOCX → PDF conversion. */
22
24
  export interface DocxToPdfOptions {
23
25
  /** Page width in points (default: from document sectPr or 612 US Letter). */
@@ -32,10 +34,39 @@ export interface DocxToPdfOptions {
32
34
  readonly marginLeft?: number;
33
35
  /** Right margin in points (default: from sectPr or 72). */
34
36
  readonly marginRight?: number;
35
- /** Default font family (default: "Times-Roman"). */
37
+ /** Default font family (default: "Helvetica"). */
36
38
  readonly defaultFont?: string;
37
39
  /** Default font size in points (default: 11). */
38
40
  readonly defaultFontSize?: number;
41
+ /** Header margin from top edge in points (default: 36). */
42
+ readonly headerMargin?: number;
43
+ /** Footer margin from bottom edge in points (default: 36). */
44
+ readonly footerMargin?: number;
45
+ /**
46
+ * Optional high-quality chart renderer callback.
47
+ *
48
+ * When provided, Word charts are rendered using the injected renderer
49
+ * instead of the built-in simplified renderer. This allows consumers
50
+ * to plug in the Excel chart renderer for publication-quality output:
51
+ *
52
+ * ```typescript
53
+ * import { installChartSupport } from "excelts/chart";
54
+ * import { createWordChartPdfRenderer } from "excelts/pdf";
55
+ * installChartSupport();
56
+ * const pdfBytes = await docxToPdf(doc, {
57
+ * chartRenderer: createWordChartPdfRenderer()
58
+ * });
59
+ * ```
60
+ *
61
+ * The callback receives the Word Chart definition and a PdfPageBuilder,
62
+ * and should draw the chart into the specified rectangle.
63
+ */
64
+ readonly chartRenderer?: (chart: Chart, page: PdfPageBuilder, rect: {
65
+ x: number;
66
+ y: number;
67
+ width: number;
68
+ height: number;
69
+ }) => void;
39
70
  }
40
71
  /**
41
72
  * Convert a DocxDocument to PDF bytes.