@cj-tech-master/excelts 9.4.2 → 9.5.0

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 (618) hide show
  1. package/dist/browser/index.browser.d.ts +8 -5
  2. package/dist/browser/index.browser.js +19 -1
  3. package/dist/browser/index.d.ts +4 -2
  4. package/dist/browser/index.js +9 -1
  5. package/dist/browser/modules/excel/chart/cache-populator.d.ts +49 -0
  6. package/dist/browser/modules/excel/chart/cache-populator.js +1171 -0
  7. package/dist/browser/modules/excel/chart/chart-api.d.ts +92 -0
  8. package/dist/browser/modules/excel/chart/chart-api.js +364 -0
  9. package/dist/browser/modules/excel/chart/chart-builder.d.ts +48 -0
  10. package/dist/browser/modules/excel/chart/chart-builder.js +2432 -0
  11. package/dist/browser/modules/excel/chart/chart-ex-builder.d.ts +36 -0
  12. package/dist/browser/modules/excel/chart/chart-ex-builder.js +903 -0
  13. package/dist/browser/modules/excel/chart/chart-ex-parser.d.ts +8 -0
  14. package/dist/browser/modules/excel/chart/chart-ex-parser.js +1205 -0
  15. package/dist/browser/modules/excel/chart/chart-ex-renderer.d.ts +187 -0
  16. package/dist/browser/modules/excel/chart/chart-ex-renderer.js +5352 -0
  17. package/dist/browser/modules/excel/chart/chart-ex-types.d.ts +531 -0
  18. package/dist/browser/modules/excel/chart/chart-ex-types.js +11 -0
  19. package/dist/browser/modules/excel/chart/chart-images.d.ts +78 -0
  20. package/dist/browser/modules/excel/chart/chart-images.js +363 -0
  21. package/dist/browser/modules/excel/chart/chart-presets.d.ts +392 -0
  22. package/dist/browser/modules/excel/chart/chart-presets.js +179 -0
  23. package/dist/browser/modules/excel/chart/chart-renderer.d.ts +550 -0
  24. package/dist/browser/modules/excel/chart/chart-renderer.js +6440 -0
  25. package/dist/browser/modules/excel/chart/chart-sidecar.d.ts +21 -0
  26. package/dist/browser/modules/excel/chart/chart-sidecar.js +427 -0
  27. package/dist/browser/modules/excel/chart/chart-utils.d.ts +306 -0
  28. package/dist/browser/modules/excel/chart/chart-utils.js +821 -0
  29. package/dist/browser/modules/excel/chart/chart.d.ts +504 -0
  30. package/dist/browser/modules/excel/chart/chart.js +1320 -0
  31. package/dist/browser/modules/excel/chart/glyph-rasterizer.d.ts +62 -0
  32. package/dist/browser/modules/excel/chart/glyph-rasterizer.js +658 -0
  33. package/dist/browser/modules/excel/chart/index.d.ts +54 -0
  34. package/dist/browser/modules/excel/chart/index.js +46 -0
  35. package/dist/browser/modules/excel/chart/install.d.ts +44 -0
  36. package/dist/browser/modules/excel/chart/install.js +91 -0
  37. package/dist/browser/modules/excel/chart/shape-properties.d.ts +156 -0
  38. package/dist/browser/modules/excel/chart/shape-properties.js +1557 -0
  39. package/dist/browser/modules/excel/chart/stroke-font.d.ts +36 -0
  40. package/dist/browser/modules/excel/chart/stroke-font.js +1556 -0
  41. package/dist/browser/modules/excel/chart/topojson.d.ts +98 -0
  42. package/dist/browser/modules/excel/chart/topojson.js +236 -0
  43. package/dist/browser/modules/excel/chart/types.d.ts +2559 -0
  44. package/dist/browser/modules/excel/chart/types.js +8 -0
  45. package/dist/browser/modules/excel/chart-host-registry.d.ts +157 -0
  46. package/dist/browser/modules/excel/chart-host-registry.js +90 -0
  47. package/dist/browser/modules/excel/chartsheet.d.ts +102 -0
  48. package/dist/browser/modules/excel/chartsheet.js +196 -0
  49. package/dist/browser/modules/excel/defined-names.d.ts +35 -0
  50. package/dist/browser/modules/excel/defined-names.js +44 -4
  51. package/dist/browser/modules/excel/errors.d.ts +6 -0
  52. package/dist/browser/modules/excel/errors.js +9 -0
  53. package/dist/browser/modules/excel/form-control.d.ts +6 -0
  54. package/dist/browser/modules/excel/form-control.js +17 -0
  55. package/dist/browser/modules/excel/image.js +12 -2
  56. package/dist/browser/modules/excel/pivot-chart.d.ts +7 -0
  57. package/dist/browser/modules/excel/pivot-chart.js +53 -0
  58. package/dist/browser/modules/excel/pivot-table.d.ts +55 -0
  59. package/dist/browser/modules/excel/pivot-table.js +35 -0
  60. package/dist/browser/modules/excel/range.js +5 -1
  61. package/dist/browser/modules/excel/sparkline/index.d.ts +7 -0
  62. package/dist/browser/modules/excel/sparkline/index.js +7 -0
  63. package/dist/browser/modules/excel/sparkline/sparkline.d.ts +206 -0
  64. package/dist/browser/modules/excel/sparkline/sparkline.js +750 -0
  65. package/dist/browser/modules/excel/stream/worksheet-writer.js +3 -2
  66. package/dist/browser/modules/excel/table.js +42 -6
  67. package/dist/browser/modules/excel/types.d.ts +72 -0
  68. package/dist/browser/modules/excel/utils/address.d.ts +18 -0
  69. package/dist/browser/modules/excel/utils/address.js +28 -0
  70. package/dist/browser/modules/excel/utils/drawing-utils.js +11 -6
  71. package/dist/browser/modules/excel/utils/guid.d.ts +15 -0
  72. package/dist/browser/modules/excel/utils/guid.js +35 -0
  73. package/dist/browser/modules/excel/utils/ooxml-paths.d.ts +74 -0
  74. package/dist/browser/modules/excel/utils/ooxml-paths.js +206 -9
  75. package/dist/browser/modules/excel/utils/ooxml-validator/check-chart-sidecar.d.ts +35 -0
  76. package/dist/browser/modules/excel/utils/ooxml-validator/check-chart-sidecar.js +101 -0
  77. package/dist/browser/modules/excel/utils/ooxml-validator/check-chart.d.ts +32 -0
  78. package/dist/browser/modules/excel/utils/ooxml-validator/check-chart.js +2125 -0
  79. package/dist/browser/modules/excel/utils/ooxml-validator/check-chartsheet.d.ts +9 -0
  80. package/dist/browser/modules/excel/utils/ooxml-validator/check-chartsheet.js +26 -0
  81. package/dist/browser/modules/excel/utils/ooxml-validator/check-content-types.d.ts +16 -0
  82. package/dist/browser/modules/excel/utils/ooxml-validator/check-content-types.js +181 -0
  83. package/dist/browser/modules/excel/utils/ooxml-validator/check-drawing.d.ts +34 -0
  84. package/dist/browser/modules/excel/utils/ooxml-validator/check-drawing.js +267 -0
  85. package/dist/browser/modules/excel/utils/ooxml-validator/check-pivot.d.ts +14 -0
  86. package/dist/browser/modules/excel/utils/ooxml-validator/check-pivot.js +104 -0
  87. package/dist/browser/modules/excel/utils/ooxml-validator/check-relationships.d.ts +18 -0
  88. package/dist/browser/modules/excel/utils/ooxml-validator/check-relationships.js +184 -0
  89. package/dist/browser/modules/excel/utils/ooxml-validator/check-structure.d.ts +21 -0
  90. package/dist/browser/modules/excel/utils/ooxml-validator/check-structure.js +56 -0
  91. package/dist/browser/modules/excel/utils/ooxml-validator/check-styles.d.ts +15 -0
  92. package/dist/browser/modules/excel/utils/ooxml-validator/check-styles.js +89 -0
  93. package/dist/browser/modules/excel/utils/ooxml-validator/check-table.d.ts +31 -0
  94. package/dist/browser/modules/excel/utils/ooxml-validator/check-table.js +177 -0
  95. package/dist/browser/modules/excel/utils/ooxml-validator/check-workbook.d.ts +19 -0
  96. package/dist/browser/modules/excel/utils/ooxml-validator/check-workbook.js +163 -0
  97. package/dist/browser/modules/excel/utils/ooxml-validator/check-worksheet.d.ts +25 -0
  98. package/dist/browser/modules/excel/utils/ooxml-validator/check-worksheet.js +569 -0
  99. package/dist/browser/modules/excel/utils/ooxml-validator/context.d.ts +85 -0
  100. package/dist/browser/modules/excel/utils/ooxml-validator/context.js +191 -0
  101. package/dist/browser/modules/excel/utils/ooxml-validator/index.d.ts +31 -0
  102. package/dist/browser/modules/excel/utils/ooxml-validator/index.js +102 -0
  103. package/dist/browser/modules/excel/utils/ooxml-validator/path-utils.d.ts +67 -0
  104. package/dist/browser/modules/excel/utils/ooxml-validator/path-utils.js +156 -0
  105. package/dist/browser/modules/excel/utils/ooxml-validator/reporter.d.ts +41 -0
  106. package/dist/browser/modules/excel/utils/ooxml-validator/reporter.js +61 -0
  107. package/dist/browser/modules/excel/utils/ooxml-validator/types.d.ts +109 -0
  108. package/dist/browser/modules/excel/utils/ooxml-validator/types.js +12 -0
  109. package/dist/browser/modules/excel/utils/ooxml-validator/xml-utils.d.ts +38 -0
  110. package/dist/browser/modules/excel/utils/ooxml-validator/xml-utils.js +100 -0
  111. package/dist/browser/modules/excel/workbook.browser.d.ts +248 -30
  112. package/dist/browser/modules/excel/workbook.browser.js +966 -31
  113. package/dist/browser/modules/excel/workbook.d.ts +43 -0
  114. package/dist/browser/modules/excel/workbook.js +48 -0
  115. package/dist/browser/modules/excel/worksheet.d.ts +157 -3
  116. package/dist/browser/modules/excel/worksheet.js +394 -35
  117. package/dist/browser/modules/excel/xlsx/rel-type.d.ts +40 -0
  118. package/dist/browser/modules/excel/xlsx/rel-type.js +41 -1
  119. package/dist/browser/modules/excel/xlsx/xform/book/defined-name-xform.d.ts +1 -0
  120. package/dist/browser/modules/excel/xlsx/xform/book/defined-name-xform.js +11 -2
  121. package/dist/browser/modules/excel/xlsx/xform/book/external-link-xform.js +12 -10
  122. package/dist/browser/modules/excel/xlsx/xform/book/workbook-xform.js +96 -22
  123. package/dist/browser/modules/excel/xlsx/xform/chart/chart-space-xform.d.ts +353 -0
  124. package/dist/browser/modules/excel/xlsx/xform/chart/chart-space-xform.js +6000 -0
  125. package/dist/browser/modules/excel/xlsx/xform/comment/threaded-comments-xform.d.ts +60 -0
  126. package/dist/browser/modules/excel/xlsx/xform/comment/threaded-comments-xform.js +213 -0
  127. package/dist/browser/modules/excel/xlsx/xform/core/content-types-xform.js +150 -11
  128. package/dist/browser/modules/excel/xlsx/xform/drawing/absolute-anchor-xform.js +20 -1
  129. package/dist/browser/modules/excel/xlsx/xform/drawing/base-cell-anchor-xform.js +1 -1
  130. package/dist/browser/modules/excel/xlsx/xform/drawing/drawing-xform.d.ts +30 -0
  131. package/dist/browser/modules/excel/xlsx/xform/drawing/drawing-xform.js +109 -5
  132. package/dist/browser/modules/excel/xlsx/xform/drawing/graphic-frame-xform.d.ts +54 -0
  133. package/dist/browser/modules/excel/xlsx/xform/drawing/graphic-frame-xform.js +225 -0
  134. package/dist/browser/modules/excel/xlsx/xform/drawing/one-cell-anchor-xform.d.ts +3 -1
  135. package/dist/browser/modules/excel/xlsx/xform/drawing/one-cell-anchor-xform.js +18 -3
  136. package/dist/browser/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.d.ts +46 -0
  137. package/dist/browser/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.js +294 -12
  138. package/dist/browser/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.d.ts +13 -2
  139. package/dist/browser/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.js +32 -6
  140. package/dist/browser/modules/excel/xlsx/xform/sheet/chartsheet-xform.d.ts +185 -0
  141. package/dist/browser/modules/excel/xlsx/xform/sheet/chartsheet-xform.js +441 -0
  142. package/dist/browser/modules/excel/xlsx/xform/sheet/ext-lst-xform.d.ts +1 -0
  143. package/dist/browser/modules/excel/xlsx/xform/sheet/ext-lst-xform.js +51 -2
  144. package/dist/browser/modules/excel/xlsx/xform/sheet/worksheet-xform.js +196 -20
  145. package/dist/browser/modules/excel/xlsx/xform/table/auto-filter-xform.js +16 -1
  146. package/dist/browser/modules/excel/xlsx/xform/table/table-column-xform.js +17 -2
  147. package/dist/browser/modules/excel/xlsx/xform/xsd-values.d.ts +63 -0
  148. package/dist/browser/modules/excel/xlsx/xform/xsd-values.js +101 -0
  149. package/dist/browser/modules/excel/xlsx/xlsx.browser.d.ts +115 -21
  150. package/dist/browser/modules/excel/xlsx/xlsx.browser.js +4422 -78
  151. package/dist/browser/modules/pdf/builder/document-builder.d.ts +74 -0
  152. package/dist/browser/modules/pdf/builder/document-builder.js +507 -2
  153. package/dist/browser/modules/pdf/builder/pdf-editor.js +48 -3
  154. package/dist/browser/modules/pdf/excel-bridge.d.ts +69 -0
  155. package/dist/browser/modules/pdf/excel-bridge.js +683 -12
  156. package/dist/browser/modules/pdf/font/font-manager.d.ts +25 -0
  157. package/dist/browser/modules/pdf/font/font-manager.js +39 -0
  158. package/dist/browser/modules/pdf/index.d.ts +5 -2
  159. package/dist/browser/modules/pdf/index.js +3 -1
  160. package/dist/browser/modules/pdf/render/chart-surface.d.ts +33 -0
  161. package/dist/browser/modules/pdf/render/chart-surface.js +200 -0
  162. package/dist/browser/modules/pdf/render/layout-engine.d.ts +22 -1
  163. package/dist/browser/modules/pdf/render/layout-engine.js +436 -56
  164. package/dist/browser/modules/pdf/render/page-renderer.js +169 -28
  165. package/dist/browser/modules/pdf/render/pdf-exporter.js +117 -7
  166. package/dist/browser/modules/pdf/types.d.ts +227 -23
  167. package/dist/browser/modules/pdf/types.js +4 -0
  168. package/dist/browser/modules/pdf/word-bridge.d.ts +47 -0
  169. package/dist/browser/modules/pdf/word-bridge.js +304 -0
  170. package/dist/browser/modules/word/constants.d.ts +179 -0
  171. package/dist/browser/modules/word/constants.js +231 -0
  172. package/dist/browser/modules/word/content-types.d.ts +27 -0
  173. package/dist/browser/modules/word/content-types.js +53 -0
  174. package/dist/browser/modules/word/digital-signatures.d.ts +87 -0
  175. package/dist/browser/modules/word/digital-signatures.js +134 -0
  176. package/dist/browser/modules/word/document.d.ts +728 -0
  177. package/dist/browser/modules/word/document.js +1795 -0
  178. package/dist/browser/modules/word/docx-packager.d.ts +14 -0
  179. package/dist/browser/modules/word/docx-packager.js +822 -0
  180. package/dist/browser/modules/word/docx-reader.d.ts +11 -0
  181. package/dist/browser/modules/word/docx-reader.js +4929 -0
  182. package/dist/browser/modules/word/encryption.d.ts +102 -0
  183. package/dist/browser/modules/word/encryption.js +274 -0
  184. package/dist/browser/modules/word/errors.d.ts +49 -0
  185. package/dist/browser/modules/word/errors.js +68 -0
  186. package/dist/browser/modules/word/font-obfuscation.d.ts +31 -0
  187. package/dist/browser/modules/word/font-obfuscation.js +83 -0
  188. package/dist/browser/modules/word/html-renderer.d.ts +38 -0
  189. package/dist/browser/modules/word/html-renderer.js +782 -0
  190. package/dist/browser/modules/word/index.base.d.ts +19 -0
  191. package/dist/browser/modules/word/index.base.js +51 -0
  192. package/dist/browser/modules/word/index.browser.d.ts +4 -0
  193. package/dist/browser/modules/word/index.browser.js +4 -0
  194. package/dist/browser/modules/word/index.d.ts +4 -0
  195. package/dist/browser/modules/word/index.js +4 -0
  196. package/dist/browser/modules/word/internal-utils.d.ts +23 -0
  197. package/dist/browser/modules/word/internal-utils.js +54 -0
  198. package/dist/browser/modules/word/relationships.d.ts +31 -0
  199. package/dist/browser/modules/word/relationships.js +56 -0
  200. package/dist/browser/modules/word/types.d.ts +2325 -0
  201. package/dist/browser/modules/word/types.js +10 -0
  202. package/dist/browser/modules/word/units.d.ts +49 -0
  203. package/dist/browser/modules/word/units.js +111 -0
  204. package/dist/browser/modules/word/writers/chart-writer.d.ts +10 -0
  205. package/dist/browser/modules/word/writers/chart-writer.js +385 -0
  206. package/dist/browser/modules/word/writers/checkbox-writer.d.ts +9 -0
  207. package/dist/browser/modules/word/writers/checkbox-writer.js +42 -0
  208. package/dist/browser/modules/word/writers/comment-writer.d.ts +15 -0
  209. package/dist/browser/modules/word/writers/comment-writer.js +70 -0
  210. package/dist/browser/modules/word/writers/document-writer.d.ts +16 -0
  211. package/dist/browser/modules/word/writers/document-writer.js +461 -0
  212. package/dist/browser/modules/word/writers/footnote-writer.d.ts +11 -0
  213. package/dist/browser/modules/word/writers/footnote-writer.js +72 -0
  214. package/dist/browser/modules/word/writers/header-footer-writer.d.ts +13 -0
  215. package/dist/browser/modules/word/writers/header-footer-writer.js +129 -0
  216. package/dist/browser/modules/word/writers/image-writer.d.ts +10 -0
  217. package/dist/browser/modules/word/writers/image-writer.js +185 -0
  218. package/dist/browser/modules/word/writers/math-writer.d.ts +9 -0
  219. package/dist/browser/modules/word/writers/math-writer.js +428 -0
  220. package/dist/browser/modules/word/writers/numbering-writer.d.ts +10 -0
  221. package/dist/browser/modules/word/writers/numbering-writer.js +125 -0
  222. package/dist/browser/modules/word/writers/paragraph-writer.d.ts +13 -0
  223. package/dist/browser/modules/word/writers/paragraph-writer.js +516 -0
  224. package/dist/browser/modules/word/writers/parts-writer.d.ts +26 -0
  225. package/dist/browser/modules/word/writers/parts-writer.js +660 -0
  226. package/dist/browser/modules/word/writers/run-writer.d.ts +15 -0
  227. package/dist/browser/modules/word/writers/run-writer.js +649 -0
  228. package/dist/browser/modules/word/writers/section-writer.d.ts +10 -0
  229. package/dist/browser/modules/word/writers/section-writer.js +238 -0
  230. package/dist/browser/modules/word/writers/styles-writer.d.ts +10 -0
  231. package/dist/browser/modules/word/writers/styles-writer.js +242 -0
  232. package/dist/browser/modules/word/writers/table-writer.d.ts +10 -0
  233. package/dist/browser/modules/word/writers/table-writer.js +503 -0
  234. package/dist/browser/modules/word/writers/textbox-writer.d.ts +9 -0
  235. package/dist/browser/modules/word/writers/textbox-writer.js +53 -0
  236. package/dist/browser/modules/word/writers/toc-writer.d.ts +9 -0
  237. package/dist/browser/modules/word/writers/toc-writer.js +79 -0
  238. package/dist/browser/modules/xml/encode.d.ts +56 -7
  239. package/dist/browser/modules/xml/encode.js +157 -11
  240. package/dist/cjs/index.js +13 -2
  241. package/dist/cjs/modules/excel/chart/cache-populator.js +1178 -0
  242. package/dist/cjs/modules/excel/chart/chart-api.js +371 -0
  243. package/dist/cjs/modules/excel/chart/chart-builder.js +2440 -0
  244. package/dist/cjs/modules/excel/chart/chart-ex-builder.js +907 -0
  245. package/dist/cjs/modules/excel/chart/chart-ex-parser.js +1208 -0
  246. package/dist/cjs/modules/excel/chart/chart-ex-renderer.js +5364 -0
  247. package/dist/cjs/modules/excel/chart/chart-ex-types.js +12 -0
  248. package/dist/cjs/modules/excel/chart/chart-images.js +366 -0
  249. package/dist/cjs/modules/excel/chart/chart-presets.js +184 -0
  250. package/dist/cjs/modules/excel/chart/chart-renderer.js +6450 -0
  251. package/dist/cjs/modules/excel/chart/chart-sidecar.js +433 -0
  252. package/dist/cjs/modules/excel/chart/chart-utils.js +845 -0
  253. package/dist/cjs/modules/excel/chart/chart.js +1324 -0
  254. package/dist/cjs/modules/excel/chart/glyph-rasterizer.js +664 -0
  255. package/dist/cjs/modules/excel/chart/index.js +101 -0
  256. package/dist/cjs/modules/excel/chart/install.js +95 -0
  257. package/dist/cjs/modules/excel/chart/shape-properties.js +1577 -0
  258. package/dist/cjs/modules/excel/chart/stroke-font.js +1559 -0
  259. package/dist/cjs/modules/excel/chart/topojson.js +239 -0
  260. package/dist/cjs/modules/excel/chart/types.js +9 -0
  261. package/dist/cjs/modules/excel/chart-host-registry.js +96 -0
  262. package/dist/cjs/modules/excel/chartsheet.js +199 -0
  263. package/dist/cjs/modules/excel/defined-names.js +44 -4
  264. package/dist/cjs/modules/excel/errors.js +11 -1
  265. package/dist/cjs/modules/excel/form-control.js +17 -0
  266. package/dist/cjs/modules/excel/image.js +12 -2
  267. package/dist/cjs/modules/excel/pivot-chart.js +56 -0
  268. package/dist/cjs/modules/excel/pivot-table.js +35 -0
  269. package/dist/cjs/modules/excel/range.js +5 -1
  270. package/dist/cjs/modules/excel/sparkline/index.js +23 -0
  271. package/dist/cjs/modules/excel/sparkline/sparkline.js +756 -0
  272. package/dist/cjs/modules/excel/stream/worksheet-writer.js +3 -2
  273. package/dist/cjs/modules/excel/table.js +42 -6
  274. package/dist/cjs/modules/excel/utils/address.js +29 -0
  275. package/dist/cjs/modules/excel/utils/drawing-utils.js +11 -6
  276. package/dist/cjs/modules/excel/utils/guid.js +38 -0
  277. package/dist/cjs/modules/excel/utils/ooxml-paths.js +246 -9
  278. package/dist/cjs/modules/excel/utils/ooxml-validator/check-chart-sidecar.js +103 -0
  279. package/dist/cjs/modules/excel/utils/ooxml-validator/check-chart.js +2128 -0
  280. package/dist/cjs/modules/excel/utils/ooxml-validator/check-chartsheet.js +29 -0
  281. package/dist/cjs/modules/excel/utils/ooxml-validator/check-content-types.js +184 -0
  282. package/dist/cjs/modules/excel/utils/ooxml-validator/check-drawing.js +270 -0
  283. package/dist/cjs/modules/excel/utils/ooxml-validator/check-pivot.js +107 -0
  284. package/dist/cjs/modules/excel/utils/ooxml-validator/check-relationships.js +188 -0
  285. package/dist/cjs/modules/excel/utils/ooxml-validator/check-structure.js +60 -0
  286. package/dist/cjs/modules/excel/utils/ooxml-validator/check-styles.js +92 -0
  287. package/dist/cjs/modules/excel/utils/ooxml-validator/check-table.js +180 -0
  288. package/dist/cjs/modules/excel/utils/ooxml-validator/check-workbook.js +166 -0
  289. package/dist/cjs/modules/excel/utils/ooxml-validator/check-worksheet.js +572 -0
  290. package/dist/cjs/modules/excel/utils/ooxml-validator/context.js +196 -0
  291. package/dist/cjs/modules/excel/utils/ooxml-validator/index.js +105 -0
  292. package/dist/cjs/modules/excel/utils/ooxml-validator/path-utils.js +168 -0
  293. package/dist/cjs/modules/excel/utils/ooxml-validator/reporter.js +66 -0
  294. package/dist/cjs/modules/excel/utils/ooxml-validator/types.js +13 -0
  295. package/dist/cjs/modules/excel/utils/ooxml-validator/xml-utils.js +110 -0
  296. package/dist/cjs/modules/excel/workbook.browser.js +973 -38
  297. package/dist/cjs/modules/excel/workbook.js +48 -0
  298. package/dist/cjs/modules/excel/worksheet.js +393 -34
  299. package/dist/cjs/modules/excel/xlsx/rel-type.js +41 -1
  300. package/dist/cjs/modules/excel/xlsx/xform/book/defined-name-xform.js +11 -2
  301. package/dist/cjs/modules/excel/xlsx/xform/book/external-link-xform.js +12 -10
  302. package/dist/cjs/modules/excel/xlsx/xform/book/workbook-xform.js +96 -22
  303. package/dist/cjs/modules/excel/xlsx/xform/chart/chart-space-xform.js +6003 -0
  304. package/dist/cjs/modules/excel/xlsx/xform/comment/threaded-comments-xform.js +219 -0
  305. package/dist/cjs/modules/excel/xlsx/xform/core/content-types-xform.js +149 -10
  306. package/dist/cjs/modules/excel/xlsx/xform/drawing/absolute-anchor-xform.js +20 -1
  307. package/dist/cjs/modules/excel/xlsx/xform/drawing/base-cell-anchor-xform.js +1 -1
  308. package/dist/cjs/modules/excel/xlsx/xform/drawing/drawing-xform.js +109 -5
  309. package/dist/cjs/modules/excel/xlsx/xform/drawing/graphic-frame-xform.js +228 -0
  310. package/dist/cjs/modules/excel/xlsx/xform/drawing/one-cell-anchor-xform.js +18 -3
  311. package/dist/cjs/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.js +294 -12
  312. package/dist/cjs/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.js +32 -6
  313. package/dist/cjs/modules/excel/xlsx/xform/sheet/chartsheet-xform.js +444 -0
  314. package/dist/cjs/modules/excel/xlsx/xform/sheet/ext-lst-xform.js +51 -2
  315. package/dist/cjs/modules/excel/xlsx/xform/sheet/worksheet-xform.js +195 -19
  316. package/dist/cjs/modules/excel/xlsx/xform/table/auto-filter-xform.js +16 -1
  317. package/dist/cjs/modules/excel/xlsx/xform/table/table-column-xform.js +17 -2
  318. package/dist/cjs/modules/excel/xlsx/xform/xsd-values.js +106 -0
  319. package/dist/cjs/modules/excel/xlsx/xlsx.browser.js +4420 -76
  320. package/dist/cjs/modules/pdf/builder/document-builder.js +506 -1
  321. package/dist/cjs/modules/pdf/builder/pdf-editor.js +48 -3
  322. package/dist/cjs/modules/pdf/excel-bridge.js +684 -12
  323. package/dist/cjs/modules/pdf/font/font-manager.js +39 -0
  324. package/dist/cjs/modules/pdf/index.js +5 -1
  325. package/dist/cjs/modules/pdf/render/chart-surface.js +203 -0
  326. package/dist/cjs/modules/pdf/render/layout-engine.js +437 -56
  327. package/dist/cjs/modules/pdf/render/page-renderer.js +169 -28
  328. package/dist/cjs/modules/pdf/render/pdf-exporter.js +115 -5
  329. package/dist/cjs/modules/pdf/types.js +5 -0
  330. package/dist/cjs/modules/pdf/word-bridge.js +307 -0
  331. package/dist/cjs/modules/word/constants.js +234 -0
  332. package/dist/cjs/modules/word/content-types.js +57 -0
  333. package/dist/cjs/modules/word/digital-signatures.js +140 -0
  334. package/dist/cjs/modules/word/document.js +1909 -0
  335. package/dist/cjs/modules/word/docx-packager.js +825 -0
  336. package/dist/cjs/modules/word/docx-reader.js +4932 -0
  337. package/dist/cjs/modules/word/encryption.js +282 -0
  338. package/dist/cjs/modules/word/errors.js +88 -0
  339. package/dist/cjs/modules/word/font-obfuscation.js +88 -0
  340. package/dist/cjs/modules/word/html-renderer.js +785 -0
  341. package/dist/cjs/modules/word/index.base.js +199 -0
  342. package/dist/cjs/modules/word/index.browser.js +20 -0
  343. package/dist/cjs/modules/word/index.js +20 -0
  344. package/dist/cjs/modules/word/internal-utils.js +59 -0
  345. package/dist/cjs/modules/word/relationships.js +60 -0
  346. package/dist/cjs/modules/word/types.js +11 -0
  347. package/dist/cjs/modules/word/units.js +135 -0
  348. package/dist/cjs/modules/word/writers/chart-writer.js +388 -0
  349. package/dist/cjs/modules/word/writers/checkbox-writer.js +45 -0
  350. package/dist/cjs/modules/word/writers/comment-writer.js +74 -0
  351. package/dist/cjs/modules/word/writers/document-writer.js +465 -0
  352. package/dist/cjs/modules/word/writers/footnote-writer.js +76 -0
  353. package/dist/cjs/modules/word/writers/header-footer-writer.js +134 -0
  354. package/dist/cjs/modules/word/writers/image-writer.js +188 -0
  355. package/dist/cjs/modules/word/writers/math-writer.js +431 -0
  356. package/dist/cjs/modules/word/writers/numbering-writer.js +128 -0
  357. package/dist/cjs/modules/word/writers/paragraph-writer.js +521 -0
  358. package/dist/cjs/modules/word/writers/parts-writer.js +671 -0
  359. package/dist/cjs/modules/word/writers/run-writer.js +655 -0
  360. package/dist/cjs/modules/word/writers/section-writer.js +241 -0
  361. package/dist/cjs/modules/word/writers/styles-writer.js +245 -0
  362. package/dist/cjs/modules/word/writers/table-writer.js +506 -0
  363. package/dist/cjs/modules/word/writers/textbox-writer.js +56 -0
  364. package/dist/cjs/modules/word/writers/toc-writer.js +82 -0
  365. package/dist/cjs/modules/xml/encode.js +158 -11
  366. package/dist/esm/index.browser.js +20 -2
  367. package/dist/esm/index.js +9 -1
  368. package/dist/esm/modules/excel/chart/cache-populator.js +1171 -0
  369. package/dist/esm/modules/excel/chart/chart-api.js +364 -0
  370. package/dist/esm/modules/excel/chart/chart-builder.js +2432 -0
  371. package/dist/esm/modules/excel/chart/chart-ex-builder.js +903 -0
  372. package/dist/esm/modules/excel/chart/chart-ex-parser.js +1205 -0
  373. package/dist/esm/modules/excel/chart/chart-ex-renderer.js +5352 -0
  374. package/dist/esm/modules/excel/chart/chart-ex-types.js +11 -0
  375. package/dist/esm/modules/excel/chart/chart-images.js +363 -0
  376. package/dist/esm/modules/excel/chart/chart-presets.js +179 -0
  377. package/dist/esm/modules/excel/chart/chart-renderer.js +6440 -0
  378. package/dist/esm/modules/excel/chart/chart-sidecar.js +427 -0
  379. package/dist/esm/modules/excel/chart/chart-utils.js +821 -0
  380. package/dist/esm/modules/excel/chart/chart.js +1320 -0
  381. package/dist/esm/modules/excel/chart/glyph-rasterizer.js +658 -0
  382. package/dist/esm/modules/excel/chart/index.js +46 -0
  383. package/dist/esm/modules/excel/chart/install.js +91 -0
  384. package/dist/esm/modules/excel/chart/shape-properties.js +1557 -0
  385. package/dist/esm/modules/excel/chart/stroke-font.js +1556 -0
  386. package/dist/esm/modules/excel/chart/topojson.js +236 -0
  387. package/dist/esm/modules/excel/chart/types.js +8 -0
  388. package/dist/esm/modules/excel/chart-host-registry.js +90 -0
  389. package/dist/esm/modules/excel/chartsheet.js +196 -0
  390. package/dist/esm/modules/excel/defined-names.js +44 -4
  391. package/dist/esm/modules/excel/errors.js +9 -0
  392. package/dist/esm/modules/excel/form-control.js +17 -0
  393. package/dist/esm/modules/excel/image.js +12 -2
  394. package/dist/esm/modules/excel/pivot-chart.js +53 -0
  395. package/dist/esm/modules/excel/pivot-table.js +35 -0
  396. package/dist/esm/modules/excel/range.js +5 -1
  397. package/dist/esm/modules/excel/sparkline/index.js +7 -0
  398. package/dist/esm/modules/excel/sparkline/sparkline.js +750 -0
  399. package/dist/esm/modules/excel/stream/worksheet-writer.js +3 -2
  400. package/dist/esm/modules/excel/table.js +42 -6
  401. package/dist/esm/modules/excel/utils/address.js +28 -0
  402. package/dist/esm/modules/excel/utils/drawing-utils.js +11 -6
  403. package/dist/esm/modules/excel/utils/guid.js +35 -0
  404. package/dist/esm/modules/excel/utils/ooxml-paths.js +206 -9
  405. package/dist/esm/modules/excel/utils/ooxml-validator/check-chart-sidecar.js +101 -0
  406. package/dist/esm/modules/excel/utils/ooxml-validator/check-chart.js +2125 -0
  407. package/dist/esm/modules/excel/utils/ooxml-validator/check-chartsheet.js +26 -0
  408. package/dist/esm/modules/excel/utils/ooxml-validator/check-content-types.js +181 -0
  409. package/dist/esm/modules/excel/utils/ooxml-validator/check-drawing.js +267 -0
  410. package/dist/esm/modules/excel/utils/ooxml-validator/check-pivot.js +104 -0
  411. package/dist/esm/modules/excel/utils/ooxml-validator/check-relationships.js +184 -0
  412. package/dist/esm/modules/excel/utils/ooxml-validator/check-structure.js +56 -0
  413. package/dist/esm/modules/excel/utils/ooxml-validator/check-styles.js +89 -0
  414. package/dist/esm/modules/excel/utils/ooxml-validator/check-table.js +177 -0
  415. package/dist/esm/modules/excel/utils/ooxml-validator/check-workbook.js +163 -0
  416. package/dist/esm/modules/excel/utils/ooxml-validator/check-worksheet.js +569 -0
  417. package/dist/esm/modules/excel/utils/ooxml-validator/context.js +191 -0
  418. package/dist/esm/modules/excel/utils/ooxml-validator/index.js +102 -0
  419. package/dist/esm/modules/excel/utils/ooxml-validator/path-utils.js +156 -0
  420. package/dist/esm/modules/excel/utils/ooxml-validator/reporter.js +61 -0
  421. package/dist/esm/modules/excel/utils/ooxml-validator/types.js +12 -0
  422. package/dist/esm/modules/excel/utils/ooxml-validator/xml-utils.js +100 -0
  423. package/dist/esm/modules/excel/workbook.browser.js +969 -34
  424. package/dist/esm/modules/excel/workbook.js +48 -0
  425. package/dist/esm/modules/excel/worksheet.js +394 -35
  426. package/dist/esm/modules/excel/xlsx/rel-type.js +41 -1
  427. package/dist/esm/modules/excel/xlsx/xform/book/defined-name-xform.js +11 -2
  428. package/dist/esm/modules/excel/xlsx/xform/book/external-link-xform.js +12 -10
  429. package/dist/esm/modules/excel/xlsx/xform/book/workbook-xform.js +96 -22
  430. package/dist/esm/modules/excel/xlsx/xform/chart/chart-space-xform.js +6000 -0
  431. package/dist/esm/modules/excel/xlsx/xform/comment/threaded-comments-xform.js +213 -0
  432. package/dist/esm/modules/excel/xlsx/xform/core/content-types-xform.js +150 -11
  433. package/dist/esm/modules/excel/xlsx/xform/drawing/absolute-anchor-xform.js +20 -1
  434. package/dist/esm/modules/excel/xlsx/xform/drawing/base-cell-anchor-xform.js +1 -1
  435. package/dist/esm/modules/excel/xlsx/xform/drawing/drawing-xform.js +109 -5
  436. package/dist/esm/modules/excel/xlsx/xform/drawing/graphic-frame-xform.js +225 -0
  437. package/dist/esm/modules/excel/xlsx/xform/drawing/one-cell-anchor-xform.js +18 -3
  438. package/dist/esm/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.js +294 -12
  439. package/dist/esm/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.js +32 -6
  440. package/dist/esm/modules/excel/xlsx/xform/sheet/chartsheet-xform.js +441 -0
  441. package/dist/esm/modules/excel/xlsx/xform/sheet/ext-lst-xform.js +51 -2
  442. package/dist/esm/modules/excel/xlsx/xform/sheet/worksheet-xform.js +196 -20
  443. package/dist/esm/modules/excel/xlsx/xform/table/auto-filter-xform.js +16 -1
  444. package/dist/esm/modules/excel/xlsx/xform/table/table-column-xform.js +17 -2
  445. package/dist/esm/modules/excel/xlsx/xform/xsd-values.js +101 -0
  446. package/dist/esm/modules/excel/xlsx/xlsx.browser.js +4422 -78
  447. package/dist/esm/modules/pdf/builder/document-builder.js +507 -2
  448. package/dist/esm/modules/pdf/builder/pdf-editor.js +48 -3
  449. package/dist/esm/modules/pdf/excel-bridge.js +683 -12
  450. package/dist/esm/modules/pdf/font/font-manager.js +39 -0
  451. package/dist/esm/modules/pdf/index.js +3 -1
  452. package/dist/esm/modules/pdf/render/chart-surface.js +200 -0
  453. package/dist/esm/modules/pdf/render/layout-engine.js +436 -56
  454. package/dist/esm/modules/pdf/render/page-renderer.js +169 -28
  455. package/dist/esm/modules/pdf/render/pdf-exporter.js +117 -7
  456. package/dist/esm/modules/pdf/types.js +4 -0
  457. package/dist/esm/modules/pdf/word-bridge.js +304 -0
  458. package/dist/esm/modules/word/constants.js +231 -0
  459. package/dist/esm/modules/word/content-types.js +53 -0
  460. package/dist/esm/modules/word/digital-signatures.js +134 -0
  461. package/dist/esm/modules/word/document.js +1795 -0
  462. package/dist/esm/modules/word/docx-packager.js +822 -0
  463. package/dist/esm/modules/word/docx-reader.js +4929 -0
  464. package/dist/esm/modules/word/encryption.js +274 -0
  465. package/dist/esm/modules/word/errors.js +68 -0
  466. package/dist/esm/modules/word/font-obfuscation.js +83 -0
  467. package/dist/esm/modules/word/html-renderer.js +782 -0
  468. package/dist/esm/modules/word/index.base.js +51 -0
  469. package/dist/esm/modules/word/index.browser.js +4 -0
  470. package/dist/esm/modules/word/index.js +4 -0
  471. package/dist/esm/modules/word/internal-utils.js +54 -0
  472. package/dist/esm/modules/word/relationships.js +56 -0
  473. package/dist/esm/modules/word/types.js +10 -0
  474. package/dist/esm/modules/word/units.js +111 -0
  475. package/dist/esm/modules/word/writers/chart-writer.js +385 -0
  476. package/dist/esm/modules/word/writers/checkbox-writer.js +42 -0
  477. package/dist/esm/modules/word/writers/comment-writer.js +70 -0
  478. package/dist/esm/modules/word/writers/document-writer.js +461 -0
  479. package/dist/esm/modules/word/writers/footnote-writer.js +72 -0
  480. package/dist/esm/modules/word/writers/header-footer-writer.js +129 -0
  481. package/dist/esm/modules/word/writers/image-writer.js +185 -0
  482. package/dist/esm/modules/word/writers/math-writer.js +428 -0
  483. package/dist/esm/modules/word/writers/numbering-writer.js +125 -0
  484. package/dist/esm/modules/word/writers/paragraph-writer.js +516 -0
  485. package/dist/esm/modules/word/writers/parts-writer.js +660 -0
  486. package/dist/esm/modules/word/writers/run-writer.js +649 -0
  487. package/dist/esm/modules/word/writers/section-writer.js +238 -0
  488. package/dist/esm/modules/word/writers/styles-writer.js +242 -0
  489. package/dist/esm/modules/word/writers/table-writer.js +503 -0
  490. package/dist/esm/modules/word/writers/textbox-writer.js +53 -0
  491. package/dist/esm/modules/word/writers/toc-writer.js +79 -0
  492. package/dist/esm/modules/xml/encode.js +157 -11
  493. package/dist/iife/excelts.iife.js +11789 -687
  494. package/dist/iife/excelts.iife.js.map +1 -1
  495. package/dist/iife/excelts.iife.min.js +52 -44
  496. package/dist/types/index.browser.d.ts +8 -5
  497. package/dist/types/index.d.ts +4 -2
  498. package/dist/types/modules/excel/chart/cache-populator.d.ts +49 -0
  499. package/dist/types/modules/excel/chart/chart-api.d.ts +92 -0
  500. package/dist/types/modules/excel/chart/chart-builder.d.ts +48 -0
  501. package/dist/types/modules/excel/chart/chart-ex-builder.d.ts +36 -0
  502. package/dist/types/modules/excel/chart/chart-ex-parser.d.ts +8 -0
  503. package/dist/types/modules/excel/chart/chart-ex-renderer.d.ts +187 -0
  504. package/dist/types/modules/excel/chart/chart-ex-types.d.ts +531 -0
  505. package/dist/types/modules/excel/chart/chart-images.d.ts +78 -0
  506. package/dist/types/modules/excel/chart/chart-presets.d.ts +392 -0
  507. package/dist/types/modules/excel/chart/chart-renderer.d.ts +550 -0
  508. package/dist/types/modules/excel/chart/chart-sidecar.d.ts +21 -0
  509. package/dist/types/modules/excel/chart/chart-utils.d.ts +306 -0
  510. package/dist/types/modules/excel/chart/chart.d.ts +504 -0
  511. package/dist/types/modules/excel/chart/glyph-rasterizer.d.ts +62 -0
  512. package/dist/types/modules/excel/chart/index.d.ts +54 -0
  513. package/dist/types/modules/excel/chart/install.d.ts +44 -0
  514. package/dist/types/modules/excel/chart/shape-properties.d.ts +156 -0
  515. package/dist/types/modules/excel/chart/stroke-font.d.ts +36 -0
  516. package/dist/types/modules/excel/chart/topojson.d.ts +98 -0
  517. package/dist/types/modules/excel/chart/types.d.ts +2559 -0
  518. package/dist/types/modules/excel/chart-host-registry.d.ts +157 -0
  519. package/dist/types/modules/excel/chartsheet.d.ts +102 -0
  520. package/dist/types/modules/excel/defined-names.d.ts +35 -0
  521. package/dist/types/modules/excel/errors.d.ts +6 -0
  522. package/dist/types/modules/excel/form-control.d.ts +6 -0
  523. package/dist/types/modules/excel/pivot-chart.d.ts +7 -0
  524. package/dist/types/modules/excel/pivot-table.d.ts +55 -0
  525. package/dist/types/modules/excel/sparkline/index.d.ts +7 -0
  526. package/dist/types/modules/excel/sparkline/sparkline.d.ts +206 -0
  527. package/dist/types/modules/excel/types.d.ts +72 -0
  528. package/dist/types/modules/excel/utils/address.d.ts +18 -0
  529. package/dist/types/modules/excel/utils/guid.d.ts +15 -0
  530. package/dist/types/modules/excel/utils/ooxml-paths.d.ts +74 -0
  531. package/dist/types/modules/excel/utils/ooxml-validator/check-chart-sidecar.d.ts +35 -0
  532. package/dist/types/modules/excel/utils/ooxml-validator/check-chart.d.ts +32 -0
  533. package/dist/types/modules/excel/utils/ooxml-validator/check-chartsheet.d.ts +9 -0
  534. package/dist/types/modules/excel/utils/ooxml-validator/check-content-types.d.ts +16 -0
  535. package/dist/types/modules/excel/utils/ooxml-validator/check-drawing.d.ts +34 -0
  536. package/dist/types/modules/excel/utils/ooxml-validator/check-pivot.d.ts +14 -0
  537. package/dist/types/modules/excel/utils/ooxml-validator/check-relationships.d.ts +18 -0
  538. package/dist/types/modules/excel/utils/ooxml-validator/check-structure.d.ts +21 -0
  539. package/dist/types/modules/excel/utils/ooxml-validator/check-styles.d.ts +15 -0
  540. package/dist/types/modules/excel/utils/ooxml-validator/check-table.d.ts +31 -0
  541. package/dist/types/modules/excel/utils/ooxml-validator/check-workbook.d.ts +19 -0
  542. package/dist/types/modules/excel/utils/ooxml-validator/check-worksheet.d.ts +25 -0
  543. package/dist/types/modules/excel/utils/ooxml-validator/context.d.ts +85 -0
  544. package/dist/types/modules/excel/utils/ooxml-validator/index.d.ts +31 -0
  545. package/dist/types/modules/excel/utils/ooxml-validator/path-utils.d.ts +67 -0
  546. package/dist/types/modules/excel/utils/ooxml-validator/reporter.d.ts +41 -0
  547. package/dist/types/modules/excel/utils/ooxml-validator/types.d.ts +109 -0
  548. package/dist/types/modules/excel/utils/ooxml-validator/xml-utils.d.ts +38 -0
  549. package/dist/types/modules/excel/workbook.browser.d.ts +248 -30
  550. package/dist/types/modules/excel/workbook.d.ts +43 -0
  551. package/dist/types/modules/excel/worksheet.d.ts +157 -3
  552. package/dist/types/modules/excel/xlsx/rel-type.d.ts +40 -0
  553. package/dist/types/modules/excel/xlsx/xform/book/defined-name-xform.d.ts +1 -0
  554. package/dist/types/modules/excel/xlsx/xform/chart/chart-space-xform.d.ts +353 -0
  555. package/dist/types/modules/excel/xlsx/xform/comment/threaded-comments-xform.d.ts +60 -0
  556. package/dist/types/modules/excel/xlsx/xform/drawing/drawing-xform.d.ts +30 -0
  557. package/dist/types/modules/excel/xlsx/xform/drawing/graphic-frame-xform.d.ts +54 -0
  558. package/dist/types/modules/excel/xlsx/xform/drawing/one-cell-anchor-xform.d.ts +3 -1
  559. package/dist/types/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.d.ts +46 -0
  560. package/dist/types/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.d.ts +13 -2
  561. package/dist/types/modules/excel/xlsx/xform/sheet/chartsheet-xform.d.ts +185 -0
  562. package/dist/types/modules/excel/xlsx/xform/sheet/ext-lst-xform.d.ts +1 -0
  563. package/dist/types/modules/excel/xlsx/xform/xsd-values.d.ts +63 -0
  564. package/dist/types/modules/excel/xlsx/xlsx.browser.d.ts +115 -21
  565. package/dist/types/modules/pdf/builder/document-builder.d.ts +74 -0
  566. package/dist/types/modules/pdf/excel-bridge.d.ts +69 -0
  567. package/dist/types/modules/pdf/font/font-manager.d.ts +25 -0
  568. package/dist/types/modules/pdf/index.d.ts +5 -2
  569. package/dist/types/modules/pdf/render/chart-surface.d.ts +33 -0
  570. package/dist/types/modules/pdf/render/layout-engine.d.ts +22 -1
  571. package/dist/types/modules/pdf/types.d.ts +227 -23
  572. package/dist/types/modules/pdf/word-bridge.d.ts +47 -0
  573. package/dist/types/modules/word/constants.d.ts +179 -0
  574. package/dist/types/modules/word/content-types.d.ts +27 -0
  575. package/dist/types/modules/word/digital-signatures.d.ts +87 -0
  576. package/dist/types/modules/word/document.d.ts +728 -0
  577. package/dist/types/modules/word/docx-packager.d.ts +14 -0
  578. package/dist/types/modules/word/docx-reader.d.ts +11 -0
  579. package/dist/types/modules/word/encryption.d.ts +102 -0
  580. package/dist/types/modules/word/errors.d.ts +49 -0
  581. package/dist/types/modules/word/font-obfuscation.d.ts +31 -0
  582. package/dist/types/modules/word/html-renderer.d.ts +38 -0
  583. package/dist/types/modules/word/index.base.d.ts +19 -0
  584. package/dist/types/modules/word/index.browser.d.ts +4 -0
  585. package/dist/types/modules/word/index.d.ts +4 -0
  586. package/dist/types/modules/word/internal-utils.d.ts +23 -0
  587. package/dist/types/modules/word/relationships.d.ts +31 -0
  588. package/dist/types/modules/word/types.d.ts +2325 -0
  589. package/dist/types/modules/word/units.d.ts +49 -0
  590. package/dist/types/modules/word/writers/chart-writer.d.ts +10 -0
  591. package/dist/types/modules/word/writers/checkbox-writer.d.ts +9 -0
  592. package/dist/types/modules/word/writers/comment-writer.d.ts +15 -0
  593. package/dist/types/modules/word/writers/document-writer.d.ts +16 -0
  594. package/dist/types/modules/word/writers/footnote-writer.d.ts +11 -0
  595. package/dist/types/modules/word/writers/header-footer-writer.d.ts +13 -0
  596. package/dist/types/modules/word/writers/image-writer.d.ts +10 -0
  597. package/dist/types/modules/word/writers/math-writer.d.ts +9 -0
  598. package/dist/types/modules/word/writers/numbering-writer.d.ts +10 -0
  599. package/dist/types/modules/word/writers/paragraph-writer.d.ts +13 -0
  600. package/dist/types/modules/word/writers/parts-writer.d.ts +26 -0
  601. package/dist/types/modules/word/writers/run-writer.d.ts +15 -0
  602. package/dist/types/modules/word/writers/section-writer.d.ts +10 -0
  603. package/dist/types/modules/word/writers/styles-writer.d.ts +10 -0
  604. package/dist/types/modules/word/writers/table-writer.d.ts +10 -0
  605. package/dist/types/modules/word/writers/textbox-writer.d.ts +9 -0
  606. package/dist/types/modules/word/writers/toc-writer.d.ts +9 -0
  607. package/dist/types/modules/xml/encode.d.ts +56 -7
  608. package/package.json +29 -11
  609. package/dist/browser/modules/excel/utils/ooxml-validator.d.ts +0 -48
  610. package/dist/browser/modules/excel/utils/ooxml-validator.js +0 -493
  611. package/dist/browser/modules/excel/utils/passthrough-manager.d.ts +0 -77
  612. package/dist/browser/modules/excel/utils/passthrough-manager.js +0 -129
  613. package/dist/cjs/modules/excel/utils/ooxml-validator.js +0 -499
  614. package/dist/cjs/modules/excel/utils/passthrough-manager.js +0 -133
  615. package/dist/esm/modules/excel/utils/ooxml-validator.js +0 -493
  616. package/dist/esm/modules/excel/utils/passthrough-manager.js +0 -129
  617. package/dist/types/modules/excel/utils/ooxml-validator.d.ts +0 -48
  618. package/dist/types/modules/excel/utils/passthrough-manager.d.ts +0 -77
@@ -17,10 +17,19 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.excelToPdf = excelToPdf;
20
+ exports.chartToPdf = chartToPdf;
21
+ // Chart runtime is accessed through the chart-host-registry slot so
22
+ // `@pkg/pdf` can do excel-to-PDF conversion without statically pulling
23
+ // ~1.2 MB of chart rendering code into every consumer's bundle.
24
+ // Consumers that convert workbooks with charts must call
25
+ // `installChartSupport()` from `@cj-tech-master/excelts/chart` before
26
+ // invoking `excelToPdf()`.
27
+ const chart_host_registry_1 = require("../excel/chart-host-registry.js");
20
28
  const enums_1 = require("../excel/enums.js");
21
29
  const cell_format_1 = require("../excel/utils/cell-format.js");
22
30
  const host_registry_1 = require("../formula/host-registry.js");
23
31
  const utils_base_1 = require("../../utils/utils.base.js");
32
+ const document_builder_1 = require("./builder/document-builder");
24
33
  const pdf_exporter_1 = require("./render/pdf-exporter");
25
34
  const types_1 = require("./types");
26
35
  // =============================================================================
@@ -46,24 +55,132 @@ async function excelToPdf(workbook, options) {
46
55
  // who don't import it fall back to whatever cached results the XLSX
47
56
  // shipped with (safe for workbooks last saved by Excel itself).
48
57
  (0, host_registry_1.tryInvokeFormulaEngine)(workbook);
49
- const pdfWorkbook = excelWorkbookToPdf(workbook);
58
+ const pdfWorkbook = await excelWorkbookToPdf(workbook);
50
59
  return (0, pdf_exporter_1.exportPdf)(pdfWorkbook, options);
51
60
  }
61
+ /**
62
+ * Render a single {@link Chart} to a standalone one-page PDF.
63
+ *
64
+ * The output is a **zero-dependency deterministic preview**, not an
65
+ * Excel-pixel-perfect rendering. Use this for server-side reports,
66
+ * thumbnails, and CI artefacts where the goal is a recognisable chart
67
+ * without a headless Office dependency. When pixel-identical output
68
+ * matters (publication-grade reports, Excel/LibreOffice-compatible
69
+ * formatting), round-trip the `.xlsx` through
70
+ * `soffice --convert-to pdf` — the byte-preserving round-trip in this
71
+ * library makes that a safe handoff. See `src/modules/excel/README.md`
72
+ * → "Rendering scope" for the complete boundary list.
73
+ *
74
+ * Classic charts take the **vector** path: the chart is drawn directly
75
+ * onto the page via `drawChartPdf`, so text stays selectable and shapes
76
+ * remain resolution-independent. ChartEx charts whose layout IDs are in
77
+ * `VECTOR_PDF_CHART_EX_LAYOUT_IDS` also take the vector path via
78
+ * `drawChartExPdf`; unsupported layouts (if any) and charts where
79
+ * `forceRaster: true` is set fall through to the SVG → PNG → image-XObject
80
+ * raster pipeline.
81
+ *
82
+ * Lives in `excel-bridge.ts` because invoking the PDF builder from the
83
+ * chart module would cross the Layer 4 → Layer 5 import boundary
84
+ * documented in `AGENTS.md`. Consumers import it from
85
+ * `@cj-tech-master/excelts/pdf` alongside `excelToPdf`.
86
+ */
87
+ async function chartToPdf(chart, options = {}) {
88
+ const width = options.width ?? 520;
89
+ const height = options.height ?? 360;
90
+ const margin = options.margin ?? 36;
91
+ const pageWidth = options.pageWidth ?? Math.max(width + margin * 2, 400);
92
+ const pageHeight = options.pageHeight ?? Math.max(height + margin * 2, 300);
93
+ const doc = new document_builder_1.PdfDocumentBuilder();
94
+ if (options.title || options.author) {
95
+ doc.setMetadata({
96
+ title: options.title,
97
+ author: options.author
98
+ });
99
+ }
100
+ const page = doc.addPage({ width: pageWidth, height: pageHeight });
101
+ const isChartEx = chart.chartExModel !== undefined;
102
+ // ChartEx charts whose every series has a layoutId in
103
+ // VECTOR_PDF_CHART_EX_LAYOUT_IDS take the vector route alongside
104
+ // classic charts. As of the regionMap port this covers every ChartEx
105
+ // layout the builder currently emits. Anything else — or any chart
106
+ // the caller explicitly asks to rasterise via `forceRaster` — falls
107
+ // through to the SVG → PNG → image-XObject pipeline.
108
+ const chartExModel = chart.chartExModel;
109
+ const chartExVectorable = isChartEx &&
110
+ chartExModel !== undefined &&
111
+ (0, chart_host_registry_1.getChartSupport)().canRenderChartExAsVectorPdf(chartExModel);
112
+ const useRaster = options.forceRaster === true || (isChartEx && !chartExVectorable);
113
+ if (!useRaster) {
114
+ if (isChartEx && chartExModel !== undefined) {
115
+ (0, chart_host_registry_1.getChartSupport)().drawChartExPdf(page, chartExModel, {
116
+ x: margin,
117
+ y: pageHeight - margin - height,
118
+ width,
119
+ height
120
+ }, { title: options.title, regionMap: options.regionMap });
121
+ return doc.build();
122
+ }
123
+ // Vector path for classic charts.
124
+ const model = chart.chartModel;
125
+ if (!model) {
126
+ throw new Error("chartToPdf: Chart has neither a classic model nor a ChartEx model to render");
127
+ }
128
+ (0, chart_host_registry_1.getChartSupport)().drawChartPdf(page, model, {
129
+ x: margin,
130
+ y: pageHeight - margin - height,
131
+ width,
132
+ height
133
+ });
134
+ return doc.build();
135
+ }
136
+ // Raster path: produce a PNG, then embed it on the page. Uses scale
137
+ // 2× by default so the PDF viewer shows crisp text even when zoomed
138
+ // into a 150 % magnification. Callers who need larger prints can
139
+ // bump `rasterScale`; anything above 4 rapidly grows the PDF size.
140
+ const scale = options.rasterScale ?? 2;
141
+ const pngBytes = isChartEx
142
+ ? await (0, chart_host_registry_1.getChartSupport)().renderChartExPng(chart.chartExModel, { width, height, scale })
143
+ : await (0, chart_host_registry_1.getChartSupport)().renderChartPng(chart.chartModel, { width, height, scale });
144
+ page.drawImage({
145
+ data: pngBytes,
146
+ format: "png",
147
+ x: margin,
148
+ y: pageHeight - margin - height,
149
+ width,
150
+ height
151
+ });
152
+ return doc.build();
153
+ }
52
154
  /**
53
155
  * Convert an Excel Workbook to the internal PdfWorkbook data structure.
156
+ *
157
+ * Async because two conversion paths hand off work that may be off-thread:
158
+ * - Non-whitelisted ChartEx layouts are rasterised to PNG at collection
159
+ * time via `renderChartExPng` (so the exporter never blocks on chart
160
+ * rendering).
161
+ * - Chartsheets follow the same per-chart rasterisation rule.
162
+ *
163
+ * Worksheets and chartsheets are merged into a single `sheets` array in
164
+ * tab order (`orderNo`), matching what Excel / LibreOffice would print.
165
+ * Chartsheets without an orderNo fall to the end, mirroring how Excel
166
+ * treats sheets with missing tab positions.
54
167
  */
55
- function excelWorkbookToPdf(workbook) {
168
+ async function excelWorkbookToPdf(workbook) {
169
+ const worksheetResults = await Promise.all(workbook.worksheets.map(ws => convertSheet(ws, workbook)));
170
+ const chartsheetResults = await Promise.all(workbook.chartsheets.map(cs => convertChartsheet(cs)));
171
+ const combined = [...worksheetResults, ...chartsheetResults];
172
+ combined.sort((a, b) => (a.orderNo ?? Number.POSITIVE_INFINITY) - (b.orderNo ?? Number.POSITIVE_INFINITY));
56
173
  return {
57
174
  title: workbook.title || undefined,
58
175
  creator: workbook.creator || undefined,
59
176
  subject: workbook.subject || undefined,
60
- sheets: workbook.worksheets.map(ws => convertSheet(ws, workbook))
177
+ sheets: combined
61
178
  };
62
179
  }
63
180
  // =============================================================================
64
181
  // Sheet Conversion
65
182
  // =============================================================================
66
- function convertSheet(ws, workbook) {
183
+ async function convertSheet(ws, workbook) {
67
184
  const dimensions = ws.dimensions;
68
185
  const hasData = dimensions && dimensions.model.top > 0 && dimensions.model.left > 0;
69
186
  const bounds = hasData
@@ -141,12 +258,32 @@ function convertSheet(ws, workbook) {
141
258
  // Convert row/col breaks
142
259
  const rowBreaks = ws.rowBreaks?.map((b) => b.id);
143
260
  const colBreaks = ws.colBreaks?.map((b) => b.id);
144
- // Convert images
261
+ // Convert images and charts. Both are floating objects anchored to
262
+ // cells, and both need to participate in bounds expansion so the
263
+ // layout engine allocates pages that cover their anchor rows/cols.
145
264
  const images = collectImages(ws, workbook);
146
- // Extend bounds to cover image anchors (so layout engine includes them)
265
+ const charts = await collectCharts(ws);
266
+ const sparklineCharts = collectSparklineCharts(ws);
267
+ // Merge sparkline micro-charts with regular charts
268
+ const allCharts = charts
269
+ ? sparklineCharts
270
+ ? [...charts, ...sparklineCharts]
271
+ : charts
272
+ : sparklineCharts || undefined;
273
+ const anchoredRanges = [];
147
274
  if (images) {
148
275
  for (const img of images) {
149
- const tl = img.range.tl;
276
+ anchoredRanges.push(img.range);
277
+ }
278
+ }
279
+ if (allCharts) {
280
+ for (const ch of allCharts) {
281
+ anchoredRanges.push(ch.range);
282
+ }
283
+ }
284
+ if (anchoredRanges.length > 0) {
285
+ for (const range of anchoredRanges) {
286
+ const tl = range.tl;
150
287
  const tlCol = (tl.nativeCol ?? tl.col ?? 0) + 1; // 0-indexed → 1-indexed
151
288
  const tlRow = (tl.nativeRow ?? tl.row ?? 0) + 1;
152
289
  if (bounds.top === 0 && bounds.left === 0) {
@@ -160,8 +297,8 @@ function convertSheet(ws, workbook) {
160
297
  bounds.bottom = tlRow;
161
298
  }
162
299
  // Also extend to bottom-right anchor if present
163
- if (img.range.br) {
164
- const br = img.range.br;
300
+ if (range.br) {
301
+ const br = range.br;
165
302
  const brCol = (br.nativeCol ?? br.col ?? 0) + 1;
166
303
  const brRow = (br.nativeRow ?? br.row ?? 0) + 1;
167
304
  if (brCol > bounds.right) {
@@ -189,8 +326,10 @@ function convertSheet(ws, workbook) {
189
326
  }
190
327
  }
191
328
  return {
329
+ kind: "worksheet",
192
330
  name: ws.name,
193
331
  state: ws.state ?? "visible",
332
+ orderNo: ws.orderNo,
194
333
  bounds,
195
334
  columns,
196
335
  rows,
@@ -198,7 +337,8 @@ function convertSheet(ws, workbook) {
198
337
  pageSetup,
199
338
  rowBreaks,
200
339
  colBreaks,
201
- images
340
+ images,
341
+ charts: allCharts
202
342
  };
203
343
  }
204
344
  // =============================================================================
@@ -439,10 +579,542 @@ function collectImages(ws, workbook) {
439
579
  }
440
580
  : undefined,
441
581
  ext: wsImage.range.ext
442
- ? { width: wsImage.range.ext.width, height: wsImage.range.ext.height }
443
- : undefined
582
+ ? {
583
+ width: wsImage.range.ext.width,
584
+ height: wsImage.range.ext.height
585
+ }
586
+ : undefined,
587
+ // Images historically store ext as pixels — the layout engine
588
+ // converts px→pt at assignment time (px × 0.75 = pt).
589
+ extUnit: wsImage.range.ext ? "px" : undefined
444
590
  }
445
591
  });
446
592
  }
447
593
  return images.length > 0 ? images : undefined;
448
594
  }
595
+ // =============================================================================
596
+ // Chart Collection
597
+ // =============================================================================
598
+ /**
599
+ * Gather every embedded chart on a worksheet and wrap it in a
600
+ * {@link PdfSheetChart} the layout engine can place.
601
+ *
602
+ * - **Classic charts** and **whitelisted ChartEx layouts** get a
603
+ * `drawVector` closure pinned over the chart model. The closure is
604
+ * invoked later by the PDF exporter against a drawing surface adapted
605
+ * over the page's content stream (see `render/chart-surface.ts`), so
606
+ * the chart ends up as real PDF geometry — selectable text, crisp
607
+ * shapes at any zoom.
608
+ * - **ChartEx layouts outside the whitelist** are rasterised up-front
609
+ * via `renderChartExPng` and attached as a raster payload. The
610
+ * exporter then treats the PNG as an image XObject. The raster size
611
+ * is derived from the anchor extent (with a sensible fallback), and
612
+ * the PDF viewer stretches the bitmap to the final rect.
613
+ *
614
+ * Pivot charts inherit the classic path — they are regular `Chart`
615
+ * objects with a `pivotSource` tag, and their model renders like any
616
+ * other classic chart.
617
+ */
618
+ async function collectCharts(ws) {
619
+ const wsCharts = ws.getCharts?.();
620
+ if (!wsCharts || !Array.isArray(wsCharts) || wsCharts.length === 0) {
621
+ return undefined;
622
+ }
623
+ const charts = [];
624
+ for (const chart of wsCharts) {
625
+ const range = chartAnchorRange(chart);
626
+ if (!range) {
627
+ continue;
628
+ }
629
+ const classicModel = chart.chartModel;
630
+ const chartExModel = chart.chartExModel;
631
+ if (classicModel) {
632
+ // Classic chart → vector path.
633
+ const drawVector = (surface, rect) => {
634
+ (0, chart_host_registry_1.getChartSupport)().drawChartPdf(surface, classicModel, {
635
+ x: rect.x,
636
+ y: rect.y,
637
+ width: rect.width,
638
+ height: rect.height
639
+ });
640
+ };
641
+ charts.push({ range, drawVector });
642
+ continue;
643
+ }
644
+ if (chartExModel) {
645
+ // Hierarchical ChartEx (treemap/sunburst) marks its dims with
646
+ // `_skipCache` to prevent the XLSX writer from emitting flat
647
+ // cache levels (which confuses Excel). For PDF rendering we need
648
+ // the data in-memory, so temporarily lift the flag, fill caches
649
+ // from the worksheet, then restore it.
650
+ ensureChartExCachesFilled(chartExModel, ws);
651
+ if ((0, chart_host_registry_1.getChartSupport)().canRenderChartExAsVectorPdf(chartExModel)) {
652
+ // Whitelisted ChartEx layout → vector path.
653
+ const drawVector = (surface, rect) => {
654
+ (0, chart_host_registry_1.getChartSupport)().drawChartExPdf(surface, chartExModel, { x: rect.x, y: rect.y, width: rect.width, height: rect.height });
655
+ };
656
+ charts.push({ range, drawVector });
657
+ }
658
+ else {
659
+ // Non-whitelisted ChartEx layout → raster path.
660
+ const { widthPx, heightPx } = estimateChartPixelSize(range);
661
+ const png = await (0, chart_host_registry_1.getChartSupport)().renderChartExPng(chartExModel, {
662
+ width: widthPx,
663
+ height: heightPx,
664
+ scale: 2
665
+ });
666
+ charts.push({
667
+ range,
668
+ raster: { data: png, format: "png" }
669
+ });
670
+ }
671
+ continue;
672
+ }
673
+ // Chart has neither model — likely a placeholder or unparsed
674
+ // `rawXml` shape. Rasterise nothing, skip silently; the cells
675
+ // underneath remain visible.
676
+ }
677
+ return charts.length > 0 ? charts : undefined;
678
+ }
679
+ /**
680
+ * Convert worksheet sparkline groups into micro-chart entries that flow
681
+ * through the same chart rendering pipeline. Each sparkline becomes a
682
+ * `PdfSheetChart` anchored to its `cellRef` cell (one cell wide, one
683
+ * row tall) with a `drawVector` callback that paints the sparkline's
684
+ * geometry (line polyline or column bars) directly into the PDF page.
685
+ */
686
+ function collectSparklineCharts(ws) {
687
+ const groups = ws.getSparklineGroups?.();
688
+ if (!groups || groups.length === 0) {
689
+ return undefined;
690
+ }
691
+ const charts = [];
692
+ for (const group of groups) {
693
+ for (const sparkline of group.sparklines) {
694
+ const { dataRef, cellRef } = sparkline;
695
+ if (!cellRef) {
696
+ continue;
697
+ }
698
+ // Parse cellRef (e.g. "N3") to get row/col
699
+ const cellMatch = cellRef.match(/^([A-Z]+)(\d+)$/i);
700
+ if (!cellMatch) {
701
+ continue;
702
+ }
703
+ const col = colLetterToNumber(cellMatch[1]);
704
+ const row = parseInt(cellMatch[2], 10);
705
+ // Resolve data values from the worksheet
706
+ const values = resolveSparklineData(ws, dataRef);
707
+ if (values.length === 0) {
708
+ continue;
709
+ }
710
+ // Build anchor: the sparkline occupies exactly one cell
711
+ const range = {
712
+ tl: { col: col - 1, row: row - 1, nativeCol: col - 1, nativeRow: row - 1 },
713
+ br: { col, row, nativeCol: col, nativeRow: row }
714
+ };
715
+ const drawVector = (surface, rect) => {
716
+ drawSparklinePdf(surface, group, values, rect);
717
+ };
718
+ charts.push({ range, drawVector });
719
+ }
720
+ }
721
+ return charts.length > 0 ? charts : undefined;
722
+ }
723
+ /** Convert column letter(s) to 1-based number. */
724
+ function colLetterToNumber(letters) {
725
+ let n = 0;
726
+ for (let i = 0; i < letters.length; i++) {
727
+ n = n * 26 + (letters.charCodeAt(i) & 0x1f);
728
+ }
729
+ return n;
730
+ }
731
+ /** Resolve sparkline data reference to numeric values. */
732
+ function resolveSparklineData(ws, dataRef) {
733
+ if (!dataRef) {
734
+ return [];
735
+ }
736
+ // dataRef is like "Sheet1!B3:M3" or "'Regional KPIs'!B3:M3"
737
+ // Strip sheet prefix — sparklines always reference the same workbook
738
+ const bangIdx = dataRef.lastIndexOf("!");
739
+ const rangeStr = bangIdx >= 0 ? dataRef.slice(bangIdx + 1) : dataRef;
740
+ // Determine the source worksheet
741
+ let sourceWs = ws;
742
+ if (bangIdx >= 0) {
743
+ let sheetName = dataRef.slice(0, bangIdx);
744
+ // Remove surrounding quotes
745
+ if (sheetName.startsWith("'") && sheetName.endsWith("'")) {
746
+ sheetName = sheetName.slice(1, -1).replace(/''/g, "'");
747
+ }
748
+ const found = ws.workbook?.getWorksheet?.(sheetName);
749
+ if (found) {
750
+ sourceWs = found;
751
+ }
752
+ }
753
+ // Parse range (e.g. "$B$3:$M$3" or "A1:K1")
754
+ const clean = rangeStr.replace(/\$/g, "");
755
+ const parts = clean.split(":");
756
+ if (parts.length !== 2) {
757
+ return [];
758
+ }
759
+ const startMatch = parts[0].match(/^([A-Z]+)(\d+)$/i);
760
+ const endMatch = parts[1].match(/^([A-Z]+)(\d+)$/i);
761
+ if (!startMatch || !endMatch) {
762
+ return [];
763
+ }
764
+ const startCol = colLetterToNumber(startMatch[1]);
765
+ const startRow = parseInt(startMatch[2], 10);
766
+ const endCol = colLetterToNumber(endMatch[1]);
767
+ const endRow = parseInt(endMatch[2], 10);
768
+ const values = [];
769
+ if (startRow === endRow) {
770
+ // Horizontal range
771
+ for (let c = startCol; c <= endCol; c++) {
772
+ const cell = sourceWs.getCell(startRow, c);
773
+ const v = typeof cell.value === "number" ? cell.value : (cell.result ?? NaN);
774
+ values.push(typeof v === "number" ? v : NaN);
775
+ }
776
+ }
777
+ else {
778
+ // Vertical range
779
+ for (let r = startRow; r <= endRow; r++) {
780
+ const cell = sourceWs.getCell(r, startCol);
781
+ const v = typeof cell.value === "number" ? cell.value : (cell.result ?? NaN);
782
+ values.push(typeof v === "number" ? v : NaN);
783
+ }
784
+ }
785
+ return values;
786
+ }
787
+ /**
788
+ * Draw a single sparkline into a PDF rect. Mirrors the logic of
789
+ * `renderSparklineSvg` but emits PDF drawing primitives via the
790
+ * chart surface.
791
+ */
792
+ function drawSparklinePdf(surface, group, values, rect) {
793
+ const { x, y, width, height } = rect;
794
+ if (width <= 0 || height <= 0 || values.length === 0) {
795
+ return;
796
+ }
797
+ const padding = 2;
798
+ const innerX = x + padding;
799
+ const innerY = y + padding;
800
+ const innerW = width - padding * 2;
801
+ const innerH = height - padding * 2;
802
+ if (innerW <= 0 || innerH <= 0) {
803
+ return;
804
+ }
805
+ // Compute axis range
806
+ const finiteValues = values.filter(v => Number.isFinite(v));
807
+ if (finiteValues.length === 0) {
808
+ return;
809
+ }
810
+ let min = Math.min(...finiteValues);
811
+ let max = Math.max(...finiteValues);
812
+ if (group.minAxisType === "custom" && group.manualMin !== undefined) {
813
+ min = group.manualMin;
814
+ }
815
+ if (group.maxAxisType === "custom" && group.manualMax !== undefined) {
816
+ max = group.manualMax;
817
+ }
818
+ if (min === max) {
819
+ min -= 1;
820
+ max += 1;
821
+ }
822
+ const span = max - min;
823
+ const rtl = group.rightToLeft === true;
824
+ const n = values.length;
825
+ const xAt = (i) => {
826
+ const t = n <= 1 ? 0.5 : i / (n - 1);
827
+ const shifted = rtl ? 1 - t : t;
828
+ return innerX + shifted * innerW;
829
+ };
830
+ // PDF y-up: higher values → higher y
831
+ const yAt = (v) => {
832
+ if (!Number.isFinite(v)) {
833
+ return innerY;
834
+ }
835
+ const t = (v - min) / span;
836
+ return innerY + t * innerH;
837
+ };
838
+ const lineColor = resolveSpkColor(group.colorSeries) ?? { r: 0.22, g: 0.38, b: 0.57 };
839
+ const negColor = resolveSpkColor(group.colorNegative) ?? { r: 0.82, g: 0, b: 0 };
840
+ if (group.type === "column" || group.type === "stacked") {
841
+ const barW = Math.max(1, (innerW / Math.max(n, 1)) * 0.8);
842
+ for (let i = 0; i < n; i++) {
843
+ const v = values[i];
844
+ if (!Number.isFinite(v) || v === 0) {
845
+ continue;
846
+ }
847
+ const cx = xAt(i);
848
+ const bx = cx - barW / 2;
849
+ const color = v < 0 && group.negative === true ? negColor : lineColor;
850
+ let barY;
851
+ let barH;
852
+ if (group.type === "stacked") {
853
+ const half = innerH / 2;
854
+ if (v >= 0) {
855
+ barY = innerY + half;
856
+ barH = half;
857
+ }
858
+ else {
859
+ barY = innerY;
860
+ barH = half;
861
+ }
862
+ }
863
+ else {
864
+ const base = min <= 0 && max >= 0 ? yAt(0) : innerY;
865
+ const top = yAt(v);
866
+ barY = Math.min(base, top);
867
+ barH = Math.abs(top - base);
868
+ }
869
+ surface.drawRect({ x: bx, y: barY, width: barW, height: Math.max(barH, 0.5), fill: color });
870
+ }
871
+ }
872
+ else {
873
+ // Line sparkline
874
+ const points = [];
875
+ for (let i = 0; i < n; i++) {
876
+ if (Number.isFinite(values[i])) {
877
+ points.push({ px: xAt(i), py: yAt(values[i]) });
878
+ }
879
+ }
880
+ if (points.length >= 2) {
881
+ for (let i = 1; i < points.length; i++) {
882
+ surface.drawLine({
883
+ x1: points[i - 1].px,
884
+ y1: points[i - 1].py,
885
+ x2: points[i].px,
886
+ y2: points[i].py,
887
+ color: lineColor,
888
+ lineWidth: group.lineWeight ? group.lineWeight * 0.75 : 0.75
889
+ });
890
+ }
891
+ }
892
+ // Markers
893
+ if (group.markers && surface.drawCircle) {
894
+ const mkColor = resolveSpkColor(group.colorMarkers) ?? lineColor;
895
+ for (const p of points) {
896
+ surface.drawCircle({ cx: p.px, cy: p.py, r: 1.2, fill: mkColor });
897
+ }
898
+ }
899
+ }
900
+ }
901
+ /** Resolve a SparklineColor to a PdfColor-like {r,g,b}. */
902
+ function resolveSpkColor(c) {
903
+ if (!c) {
904
+ return undefined;
905
+ }
906
+ if (c.rgb) {
907
+ const hex = c.rgb.replace(/^#/, "").replace(/^FF/i, "");
908
+ const r = parseInt(hex.slice(0, 2), 16) / 255;
909
+ const g = parseInt(hex.slice(2, 4), 16) / 255;
910
+ const b = parseInt(hex.slice(4, 6), 16) / 255;
911
+ if (Number.isFinite(r) && Number.isFinite(g) && Number.isFinite(b)) {
912
+ return { r, g, b };
913
+ }
914
+ }
915
+ return undefined;
916
+ }
917
+ /**
918
+ * Translate a `Chart.range` into the PDF layer's anchor shape. Returns
919
+ * `undefined` for charts that ExcelTS could not anchor to any cell
920
+ * (extremely rare — usually indicates a corrupt drawing relationship).
921
+ */
922
+ function chartAnchorRange(chart) {
923
+ const r = chart.range;
924
+ if (!r?.tl) {
925
+ return undefined;
926
+ }
927
+ const tl = r.tl;
928
+ const br = r.br;
929
+ return {
930
+ tl: {
931
+ col: tl.col ?? 0,
932
+ row: tl.row ?? 0,
933
+ nativeCol: tl.nativeCol,
934
+ nativeRow: tl.nativeRow,
935
+ nativeColOff: tl.nativeColOff,
936
+ nativeRowOff: tl.nativeRowOff
937
+ },
938
+ br: br
939
+ ? {
940
+ col: br.col ?? 0,
941
+ row: br.row ?? 0,
942
+ nativeCol: br.nativeCol,
943
+ nativeRow: br.nativeRow,
944
+ nativeColOff: br.nativeColOff,
945
+ nativeRowOff: br.nativeRowOff
946
+ }
947
+ : undefined,
948
+ // Chart anchors store ext as EMU (`cx`, `cy`). Pass the values
949
+ // through unchanged; the layout engine converts EMU→pt for charts
950
+ // (×1/9525) and px→pt for images (×0.75) based on `extUnit`.
951
+ ext: r.ext ? { width: r.ext.cx, height: r.ext.cy } : undefined,
952
+ extUnit: r.ext ? "emu" : undefined
953
+ };
954
+ }
955
+ /**
956
+ * Ensure a ChartEx model's data caches are populated for rendering.
957
+ *
958
+ * Hierarchical charts (treemap/sunburst) set `_skipCache` on their
959
+ * string/numeric dimensions so the XLSX writer doesn't emit flat cache
960
+ * levels (Excel rejects them). For PDF/image rendering the data must be
961
+ * in-memory. This helper temporarily lifts the flag, calls
962
+ * `fillChartExCaches`, then restores it so subsequent XLSX writes are
963
+ * unaffected.
964
+ */
965
+ function ensureChartExCachesFilled(model, ws) {
966
+ const data = model.chartSpace?.chartData?.data;
967
+ if (!data) {
968
+ return;
969
+ }
970
+ // Check if any dimension is missing cache data
971
+ const needsFill = data.some(entry => {
972
+ const strNeedsData = entry.strDim && (!entry.strDim.levels || entry.strDim.levels.length === 0);
973
+ const numNeedsData = entry.numDim && (!entry.numDim.levels || entry.numDim.levels.length === 0);
974
+ return strNeedsData || numNeedsData;
975
+ });
976
+ if (!needsFill) {
977
+ return;
978
+ }
979
+ // Temporarily lift _skipCache flags
980
+ const skipped = [];
981
+ for (const entry of data) {
982
+ const str = entry.strDim;
983
+ if (str?.["_skipCache"]) {
984
+ skipped.push(str);
985
+ delete str["_skipCache"];
986
+ }
987
+ const num = entry.numDim;
988
+ if (num?.["_skipCache"]) {
989
+ skipped.push(num);
990
+ delete num["_skipCache"];
991
+ }
992
+ }
993
+ try {
994
+ (0, chart_host_registry_1.getChartSupport)().fillChartExCaches(model, ws.workbook, ws);
995
+ }
996
+ catch {
997
+ // Best-effort — rendering will proceed with whatever data is available.
998
+ }
999
+ // Restore _skipCache
1000
+ for (const dim of skipped) {
1001
+ dim["_skipCache"] = true;
1002
+ }
1003
+ }
1004
+ /**
1005
+ * Pick a PNG rasterisation size for a non-vectorable ChartEx layout.
1006
+ *
1007
+ * Strategy: use the anchor extent (EMU → pt → px at 96 dpi) when
1008
+ * available; otherwise fall back to a reasonable default that survives
1009
+ * half-page stretching without obvious artefacts. The exporter's
1010
+ * `rasterScale` is applied separately in `collectCharts`.
1011
+ */
1012
+ function estimateChartPixelSize(range) {
1013
+ if (range.ext && range.extUnit === "emu") {
1014
+ const widthPt = range.ext.width / 9525;
1015
+ const heightPt = range.ext.height / 9525;
1016
+ // 1 pt = 1/72 in ≈ 96/72 px at 96 dpi
1017
+ return {
1018
+ widthPx: Math.max(120, Math.round(widthPt * (96 / 72))),
1019
+ heightPx: Math.max(80, Math.round(heightPt * (96 / 72)))
1020
+ };
1021
+ }
1022
+ return { widthPx: 640, heightPx: 420 };
1023
+ }
1024
+ // =============================================================================
1025
+ // Chartsheet Conversion
1026
+ // =============================================================================
1027
+ /**
1028
+ * Pixel dimensions used when rasterising a non-whitelisted ChartEx on a
1029
+ * chartsheet. Derived from Excel's own chartsheet canvas defaults
1030
+ * (A4 landscape minus default margins — see `CHARTSHEET_EMU_CX / CY`
1031
+ * in `xlsx.browser.ts`). 2× is applied by `renderChartExPng` via the
1032
+ * `scale` option so the PNG looks crisp at 150% zoom.
1033
+ */
1034
+ const CHARTSHEET_RASTER_PX = { width: 1280, height: 720 };
1035
+ /**
1036
+ * Convert a {@link Chartsheet} into a {@link PdfChartsheetData}.
1037
+ *
1038
+ * A chartsheet is a "single chart fills the whole page" sheet type. Unlike
1039
+ * a cell-grid worksheet there is no row/column layout to reason about —
1040
+ * the chart just takes whatever content area the page margins leave.
1041
+ *
1042
+ * - **Classic chart** → vector `drawChartPdf` path (selectable text,
1043
+ * crisp at any zoom).
1044
+ * - **ChartEx whitelisted layout** → vector `drawChartExPdf` path.
1045
+ * - **ChartEx outside the whitelist** → rasterised to PNG up-front via
1046
+ * `renderChartExPng`; the PDF viewer stretches the bitmap to the final
1047
+ * page rect.
1048
+ * - **No chart attached** → the chartsheet still produces a blank page
1049
+ * (matches what Excel prints for a chartsheet whose chart was deleted
1050
+ * but the sheet kept).
1051
+ */
1052
+ async function convertChartsheet(cs) {
1053
+ const classicModel = cs.chartModel;
1054
+ const chartExModel = cs.chartExModel;
1055
+ let chart = {};
1056
+ if (classicModel) {
1057
+ const model = classicModel;
1058
+ chart = {
1059
+ drawVector: (surface, rect) => {
1060
+ (0, chart_host_registry_1.getChartSupport)().drawChartPdf(surface, model, {
1061
+ x: rect.x,
1062
+ y: rect.y,
1063
+ width: rect.width,
1064
+ height: rect.height
1065
+ });
1066
+ }
1067
+ };
1068
+ }
1069
+ else if (chartExModel) {
1070
+ if ((0, chart_host_registry_1.getChartSupport)().canRenderChartExAsVectorPdf(chartExModel)) {
1071
+ const model = chartExModel;
1072
+ chart = {
1073
+ drawVector: (surface, rect) => {
1074
+ (0, chart_host_registry_1.getChartSupport)().drawChartExPdf(surface, model, {
1075
+ x: rect.x,
1076
+ y: rect.y,
1077
+ width: rect.width,
1078
+ height: rect.height
1079
+ });
1080
+ }
1081
+ };
1082
+ }
1083
+ else {
1084
+ const png = await (0, chart_host_registry_1.getChartSupport)().renderChartExPng(chartExModel, {
1085
+ width: CHARTSHEET_RASTER_PX.width,
1086
+ height: CHARTSHEET_RASTER_PX.height,
1087
+ scale: 2
1088
+ });
1089
+ chart = { raster: { data: png, format: "png" } };
1090
+ }
1091
+ }
1092
+ // Chartsheet orientation: explicit pageSetup wins. Excel's chartsheet
1093
+ // convention is landscape when unset (the CHARTSHEET_EMU_CX/CY pair in
1094
+ // xlsx.browser.ts is wider than tall), so we inherit that default.
1095
+ const explicitOrientation = cs.pageSetup?.orientation;
1096
+ const orientation = explicitOrientation === "portrait" || explicitOrientation === "landscape"
1097
+ ? explicitOrientation
1098
+ : "landscape";
1099
+ // Capture the native pageSetup for callers / exporter heuristics.
1100
+ // Chartsheet's `CT_CsPageSetup` is a subset of worksheet's `CT_PageSetup`;
1101
+ // the fields we surface here are the ones the PDF renderer knows how
1102
+ // to interpret. Unknown fields are silently dropped.
1103
+ const ps = cs.pageSetup;
1104
+ const pageSetup = ps
1105
+ ? {
1106
+ orientation: ps.orientation,
1107
+ paperSize: ps.paperSize,
1108
+ showGridLines: false
1109
+ }
1110
+ : undefined;
1111
+ return {
1112
+ kind: "chartsheet",
1113
+ name: cs.name,
1114
+ state: cs.state,
1115
+ orderNo: cs.model.orderNo,
1116
+ orientation,
1117
+ chart,
1118
+ pageSetup
1119
+ };
1120
+ }