@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
@@ -14,10 +14,18 @@
14
14
  * const pdf = await excelToPdf(workbook);
15
15
  * ```
16
16
  */
17
+ // Chart runtime is accessed through the chart-host-registry slot so
18
+ // `@pkg/pdf` can do excel-to-PDF conversion without statically pulling
19
+ // ~1.2 MB of chart rendering code into every consumer's bundle.
20
+ // Consumers that convert workbooks with charts must call
21
+ // `installChartSupport()` from `@cj-tech-master/excelts/chart` before
22
+ // invoking `excelToPdf()`.
23
+ import { getChartSupport } from "../excel/chart-host-registry.js";
17
24
  import { ValueType } from "../excel/enums.js";
18
25
  import { formatCellValue } from "../excel/utils/cell-format.js";
19
26
  import { tryInvokeFormulaEngine } from "../formula/host-registry.js";
20
27
  import { base64ToUint8Array } from "../../utils/utils.base.js";
28
+ import { PdfDocumentBuilder } from "./builder/document-builder.js";
21
29
  import { exportPdf } from "./render/pdf-exporter.js";
22
30
  import { PdfCellType } from "./types.js";
23
31
  // =============================================================================
@@ -43,24 +51,132 @@ export async function excelToPdf(workbook, options) {
43
51
  // who don't import it fall back to whatever cached results the XLSX
44
52
  // shipped with (safe for workbooks last saved by Excel itself).
45
53
  tryInvokeFormulaEngine(workbook);
46
- const pdfWorkbook = excelWorkbookToPdf(workbook);
54
+ const pdfWorkbook = await excelWorkbookToPdf(workbook);
47
55
  return exportPdf(pdfWorkbook, options);
48
56
  }
57
+ /**
58
+ * Render a single {@link Chart} to a standalone one-page PDF.
59
+ *
60
+ * The output is a **zero-dependency deterministic preview**, not an
61
+ * Excel-pixel-perfect rendering. Use this for server-side reports,
62
+ * thumbnails, and CI artefacts where the goal is a recognisable chart
63
+ * without a headless Office dependency. When pixel-identical output
64
+ * matters (publication-grade reports, Excel/LibreOffice-compatible
65
+ * formatting), round-trip the `.xlsx` through
66
+ * `soffice --convert-to pdf` — the byte-preserving round-trip in this
67
+ * library makes that a safe handoff. See `src/modules/excel/README.md`
68
+ * → "Rendering scope" for the complete boundary list.
69
+ *
70
+ * Classic charts take the **vector** path: the chart is drawn directly
71
+ * onto the page via `drawChartPdf`, so text stays selectable and shapes
72
+ * remain resolution-independent. ChartEx charts whose layout IDs are in
73
+ * `VECTOR_PDF_CHART_EX_LAYOUT_IDS` also take the vector path via
74
+ * `drawChartExPdf`; unsupported layouts (if any) and charts where
75
+ * `forceRaster: true` is set fall through to the SVG → PNG → image-XObject
76
+ * raster pipeline.
77
+ *
78
+ * Lives in `excel-bridge.ts` because invoking the PDF builder from the
79
+ * chart module would cross the Layer 4 → Layer 5 import boundary
80
+ * documented in `AGENTS.md`. Consumers import it from
81
+ * `@cj-tech-master/excelts/pdf` alongside `excelToPdf`.
82
+ */
83
+ export async function chartToPdf(chart, options = {}) {
84
+ const width = options.width ?? 520;
85
+ const height = options.height ?? 360;
86
+ const margin = options.margin ?? 36;
87
+ const pageWidth = options.pageWidth ?? Math.max(width + margin * 2, 400);
88
+ const pageHeight = options.pageHeight ?? Math.max(height + margin * 2, 300);
89
+ const doc = new PdfDocumentBuilder();
90
+ if (options.title || options.author) {
91
+ doc.setMetadata({
92
+ title: options.title,
93
+ author: options.author
94
+ });
95
+ }
96
+ const page = doc.addPage({ width: pageWidth, height: pageHeight });
97
+ const isChartEx = chart.chartExModel !== undefined;
98
+ // ChartEx charts whose every series has a layoutId in
99
+ // VECTOR_PDF_CHART_EX_LAYOUT_IDS take the vector route alongside
100
+ // classic charts. As of the regionMap port this covers every ChartEx
101
+ // layout the builder currently emits. Anything else — or any chart
102
+ // the caller explicitly asks to rasterise via `forceRaster` — falls
103
+ // through to the SVG → PNG → image-XObject pipeline.
104
+ const chartExModel = chart.chartExModel;
105
+ const chartExVectorable = isChartEx &&
106
+ chartExModel !== undefined &&
107
+ getChartSupport().canRenderChartExAsVectorPdf(chartExModel);
108
+ const useRaster = options.forceRaster === true || (isChartEx && !chartExVectorable);
109
+ if (!useRaster) {
110
+ if (isChartEx && chartExModel !== undefined) {
111
+ getChartSupport().drawChartExPdf(page, chartExModel, {
112
+ x: margin,
113
+ y: pageHeight - margin - height,
114
+ width,
115
+ height
116
+ }, { title: options.title, regionMap: options.regionMap });
117
+ return doc.build();
118
+ }
119
+ // Vector path for classic charts.
120
+ const model = chart.chartModel;
121
+ if (!model) {
122
+ throw new Error("chartToPdf: Chart has neither a classic model nor a ChartEx model to render");
123
+ }
124
+ getChartSupport().drawChartPdf(page, model, {
125
+ x: margin,
126
+ y: pageHeight - margin - height,
127
+ width,
128
+ height
129
+ });
130
+ return doc.build();
131
+ }
132
+ // Raster path: produce a PNG, then embed it on the page. Uses scale
133
+ // 2× by default so the PDF viewer shows crisp text even when zoomed
134
+ // into a 150 % magnification. Callers who need larger prints can
135
+ // bump `rasterScale`; anything above 4 rapidly grows the PDF size.
136
+ const scale = options.rasterScale ?? 2;
137
+ const pngBytes = isChartEx
138
+ ? await getChartSupport().renderChartExPng(chart.chartExModel, { width, height, scale })
139
+ : await getChartSupport().renderChartPng(chart.chartModel, { width, height, scale });
140
+ page.drawImage({
141
+ data: pngBytes,
142
+ format: "png",
143
+ x: margin,
144
+ y: pageHeight - margin - height,
145
+ width,
146
+ height
147
+ });
148
+ return doc.build();
149
+ }
49
150
  /**
50
151
  * Convert an Excel Workbook to the internal PdfWorkbook data structure.
152
+ *
153
+ * Async because two conversion paths hand off work that may be off-thread:
154
+ * - Non-whitelisted ChartEx layouts are rasterised to PNG at collection
155
+ * time via `renderChartExPng` (so the exporter never blocks on chart
156
+ * rendering).
157
+ * - Chartsheets follow the same per-chart rasterisation rule.
158
+ *
159
+ * Worksheets and chartsheets are merged into a single `sheets` array in
160
+ * tab order (`orderNo`), matching what Excel / LibreOffice would print.
161
+ * Chartsheets without an orderNo fall to the end, mirroring how Excel
162
+ * treats sheets with missing tab positions.
51
163
  */
52
- function excelWorkbookToPdf(workbook) {
164
+ async function excelWorkbookToPdf(workbook) {
165
+ const worksheetResults = await Promise.all(workbook.worksheets.map(ws => convertSheet(ws, workbook)));
166
+ const chartsheetResults = await Promise.all(workbook.chartsheets.map(cs => convertChartsheet(cs)));
167
+ const combined = [...worksheetResults, ...chartsheetResults];
168
+ combined.sort((a, b) => (a.orderNo ?? Number.POSITIVE_INFINITY) - (b.orderNo ?? Number.POSITIVE_INFINITY));
53
169
  return {
54
170
  title: workbook.title || undefined,
55
171
  creator: workbook.creator || undefined,
56
172
  subject: workbook.subject || undefined,
57
- sheets: workbook.worksheets.map(ws => convertSheet(ws, workbook))
173
+ sheets: combined
58
174
  };
59
175
  }
60
176
  // =============================================================================
61
177
  // Sheet Conversion
62
178
  // =============================================================================
63
- function convertSheet(ws, workbook) {
179
+ async function convertSheet(ws, workbook) {
64
180
  const dimensions = ws.dimensions;
65
181
  const hasData = dimensions && dimensions.model.top > 0 && dimensions.model.left > 0;
66
182
  const bounds = hasData
@@ -138,12 +254,32 @@ function convertSheet(ws, workbook) {
138
254
  // Convert row/col breaks
139
255
  const rowBreaks = ws.rowBreaks?.map((b) => b.id);
140
256
  const colBreaks = ws.colBreaks?.map((b) => b.id);
141
- // Convert images
257
+ // Convert images and charts. Both are floating objects anchored to
258
+ // cells, and both need to participate in bounds expansion so the
259
+ // layout engine allocates pages that cover their anchor rows/cols.
142
260
  const images = collectImages(ws, workbook);
143
- // Extend bounds to cover image anchors (so layout engine includes them)
261
+ const charts = await collectCharts(ws);
262
+ const sparklineCharts = collectSparklineCharts(ws);
263
+ // Merge sparkline micro-charts with regular charts
264
+ const allCharts = charts
265
+ ? sparklineCharts
266
+ ? [...charts, ...sparklineCharts]
267
+ : charts
268
+ : sparklineCharts || undefined;
269
+ const anchoredRanges = [];
144
270
  if (images) {
145
271
  for (const img of images) {
146
- const tl = img.range.tl;
272
+ anchoredRanges.push(img.range);
273
+ }
274
+ }
275
+ if (allCharts) {
276
+ for (const ch of allCharts) {
277
+ anchoredRanges.push(ch.range);
278
+ }
279
+ }
280
+ if (anchoredRanges.length > 0) {
281
+ for (const range of anchoredRanges) {
282
+ const tl = range.tl;
147
283
  const tlCol = (tl.nativeCol ?? tl.col ?? 0) + 1; // 0-indexed → 1-indexed
148
284
  const tlRow = (tl.nativeRow ?? tl.row ?? 0) + 1;
149
285
  if (bounds.top === 0 && bounds.left === 0) {
@@ -157,8 +293,8 @@ function convertSheet(ws, workbook) {
157
293
  bounds.bottom = tlRow;
158
294
  }
159
295
  // Also extend to bottom-right anchor if present
160
- if (img.range.br) {
161
- const br = img.range.br;
296
+ if (range.br) {
297
+ const br = range.br;
162
298
  const brCol = (br.nativeCol ?? br.col ?? 0) + 1;
163
299
  const brRow = (br.nativeRow ?? br.row ?? 0) + 1;
164
300
  if (brCol > bounds.right) {
@@ -186,8 +322,10 @@ function convertSheet(ws, workbook) {
186
322
  }
187
323
  }
188
324
  return {
325
+ kind: "worksheet",
189
326
  name: ws.name,
190
327
  state: ws.state ?? "visible",
328
+ orderNo: ws.orderNo,
191
329
  bounds,
192
330
  columns,
193
331
  rows,
@@ -195,7 +333,8 @@ function convertSheet(ws, workbook) {
195
333
  pageSetup,
196
334
  rowBreaks,
197
335
  colBreaks,
198
- images
336
+ images,
337
+ charts: allCharts
199
338
  };
200
339
  }
201
340
  // =============================================================================
@@ -436,10 +575,542 @@ function collectImages(ws, workbook) {
436
575
  }
437
576
  : undefined,
438
577
  ext: wsImage.range.ext
439
- ? { width: wsImage.range.ext.width, height: wsImage.range.ext.height }
440
- : undefined
578
+ ? {
579
+ width: wsImage.range.ext.width,
580
+ height: wsImage.range.ext.height
581
+ }
582
+ : undefined,
583
+ // Images historically store ext as pixels — the layout engine
584
+ // converts px→pt at assignment time (px × 0.75 = pt).
585
+ extUnit: wsImage.range.ext ? "px" : undefined
441
586
  }
442
587
  });
443
588
  }
444
589
  return images.length > 0 ? images : undefined;
445
590
  }
591
+ // =============================================================================
592
+ // Chart Collection
593
+ // =============================================================================
594
+ /**
595
+ * Gather every embedded chart on a worksheet and wrap it in a
596
+ * {@link PdfSheetChart} the layout engine can place.
597
+ *
598
+ * - **Classic charts** and **whitelisted ChartEx layouts** get a
599
+ * `drawVector` closure pinned over the chart model. The closure is
600
+ * invoked later by the PDF exporter against a drawing surface adapted
601
+ * over the page's content stream (see `render/chart-surface.ts`), so
602
+ * the chart ends up as real PDF geometry — selectable text, crisp
603
+ * shapes at any zoom.
604
+ * - **ChartEx layouts outside the whitelist** are rasterised up-front
605
+ * via `renderChartExPng` and attached as a raster payload. The
606
+ * exporter then treats the PNG as an image XObject. The raster size
607
+ * is derived from the anchor extent (with a sensible fallback), and
608
+ * the PDF viewer stretches the bitmap to the final rect.
609
+ *
610
+ * Pivot charts inherit the classic path — they are regular `Chart`
611
+ * objects with a `pivotSource` tag, and their model renders like any
612
+ * other classic chart.
613
+ */
614
+ async function collectCharts(ws) {
615
+ const wsCharts = ws.getCharts?.();
616
+ if (!wsCharts || !Array.isArray(wsCharts) || wsCharts.length === 0) {
617
+ return undefined;
618
+ }
619
+ const charts = [];
620
+ for (const chart of wsCharts) {
621
+ const range = chartAnchorRange(chart);
622
+ if (!range) {
623
+ continue;
624
+ }
625
+ const classicModel = chart.chartModel;
626
+ const chartExModel = chart.chartExModel;
627
+ if (classicModel) {
628
+ // Classic chart → vector path.
629
+ const drawVector = (surface, rect) => {
630
+ getChartSupport().drawChartPdf(surface, classicModel, {
631
+ x: rect.x,
632
+ y: rect.y,
633
+ width: rect.width,
634
+ height: rect.height
635
+ });
636
+ };
637
+ charts.push({ range, drawVector });
638
+ continue;
639
+ }
640
+ if (chartExModel) {
641
+ // Hierarchical ChartEx (treemap/sunburst) marks its dims with
642
+ // `_skipCache` to prevent the XLSX writer from emitting flat
643
+ // cache levels (which confuses Excel). For PDF rendering we need
644
+ // the data in-memory, so temporarily lift the flag, fill caches
645
+ // from the worksheet, then restore it.
646
+ ensureChartExCachesFilled(chartExModel, ws);
647
+ if (getChartSupport().canRenderChartExAsVectorPdf(chartExModel)) {
648
+ // Whitelisted ChartEx layout → vector path.
649
+ const drawVector = (surface, rect) => {
650
+ getChartSupport().drawChartExPdf(surface, chartExModel, { x: rect.x, y: rect.y, width: rect.width, height: rect.height });
651
+ };
652
+ charts.push({ range, drawVector });
653
+ }
654
+ else {
655
+ // Non-whitelisted ChartEx layout → raster path.
656
+ const { widthPx, heightPx } = estimateChartPixelSize(range);
657
+ const png = await getChartSupport().renderChartExPng(chartExModel, {
658
+ width: widthPx,
659
+ height: heightPx,
660
+ scale: 2
661
+ });
662
+ charts.push({
663
+ range,
664
+ raster: { data: png, format: "png" }
665
+ });
666
+ }
667
+ continue;
668
+ }
669
+ // Chart has neither model — likely a placeholder or unparsed
670
+ // `rawXml` shape. Rasterise nothing, skip silently; the cells
671
+ // underneath remain visible.
672
+ }
673
+ return charts.length > 0 ? charts : undefined;
674
+ }
675
+ /**
676
+ * Convert worksheet sparkline groups into micro-chart entries that flow
677
+ * through the same chart rendering pipeline. Each sparkline becomes a
678
+ * `PdfSheetChart` anchored to its `cellRef` cell (one cell wide, one
679
+ * row tall) with a `drawVector` callback that paints the sparkline's
680
+ * geometry (line polyline or column bars) directly into the PDF page.
681
+ */
682
+ function collectSparklineCharts(ws) {
683
+ const groups = ws.getSparklineGroups?.();
684
+ if (!groups || groups.length === 0) {
685
+ return undefined;
686
+ }
687
+ const charts = [];
688
+ for (const group of groups) {
689
+ for (const sparkline of group.sparklines) {
690
+ const { dataRef, cellRef } = sparkline;
691
+ if (!cellRef) {
692
+ continue;
693
+ }
694
+ // Parse cellRef (e.g. "N3") to get row/col
695
+ const cellMatch = cellRef.match(/^([A-Z]+)(\d+)$/i);
696
+ if (!cellMatch) {
697
+ continue;
698
+ }
699
+ const col = colLetterToNumber(cellMatch[1]);
700
+ const row = parseInt(cellMatch[2], 10);
701
+ // Resolve data values from the worksheet
702
+ const values = resolveSparklineData(ws, dataRef);
703
+ if (values.length === 0) {
704
+ continue;
705
+ }
706
+ // Build anchor: the sparkline occupies exactly one cell
707
+ const range = {
708
+ tl: { col: col - 1, row: row - 1, nativeCol: col - 1, nativeRow: row - 1 },
709
+ br: { col, row, nativeCol: col, nativeRow: row }
710
+ };
711
+ const drawVector = (surface, rect) => {
712
+ drawSparklinePdf(surface, group, values, rect);
713
+ };
714
+ charts.push({ range, drawVector });
715
+ }
716
+ }
717
+ return charts.length > 0 ? charts : undefined;
718
+ }
719
+ /** Convert column letter(s) to 1-based number. */
720
+ function colLetterToNumber(letters) {
721
+ let n = 0;
722
+ for (let i = 0; i < letters.length; i++) {
723
+ n = n * 26 + (letters.charCodeAt(i) & 0x1f);
724
+ }
725
+ return n;
726
+ }
727
+ /** Resolve sparkline data reference to numeric values. */
728
+ function resolveSparklineData(ws, dataRef) {
729
+ if (!dataRef) {
730
+ return [];
731
+ }
732
+ // dataRef is like "Sheet1!B3:M3" or "'Regional KPIs'!B3:M3"
733
+ // Strip sheet prefix — sparklines always reference the same workbook
734
+ const bangIdx = dataRef.lastIndexOf("!");
735
+ const rangeStr = bangIdx >= 0 ? dataRef.slice(bangIdx + 1) : dataRef;
736
+ // Determine the source worksheet
737
+ let sourceWs = ws;
738
+ if (bangIdx >= 0) {
739
+ let sheetName = dataRef.slice(0, bangIdx);
740
+ // Remove surrounding quotes
741
+ if (sheetName.startsWith("'") && sheetName.endsWith("'")) {
742
+ sheetName = sheetName.slice(1, -1).replace(/''/g, "'");
743
+ }
744
+ const found = ws.workbook?.getWorksheet?.(sheetName);
745
+ if (found) {
746
+ sourceWs = found;
747
+ }
748
+ }
749
+ // Parse range (e.g. "$B$3:$M$3" or "A1:K1")
750
+ const clean = rangeStr.replace(/\$/g, "");
751
+ const parts = clean.split(":");
752
+ if (parts.length !== 2) {
753
+ return [];
754
+ }
755
+ const startMatch = parts[0].match(/^([A-Z]+)(\d+)$/i);
756
+ const endMatch = parts[1].match(/^([A-Z]+)(\d+)$/i);
757
+ if (!startMatch || !endMatch) {
758
+ return [];
759
+ }
760
+ const startCol = colLetterToNumber(startMatch[1]);
761
+ const startRow = parseInt(startMatch[2], 10);
762
+ const endCol = colLetterToNumber(endMatch[1]);
763
+ const endRow = parseInt(endMatch[2], 10);
764
+ const values = [];
765
+ if (startRow === endRow) {
766
+ // Horizontal range
767
+ for (let c = startCol; c <= endCol; c++) {
768
+ const cell = sourceWs.getCell(startRow, c);
769
+ const v = typeof cell.value === "number" ? cell.value : (cell.result ?? NaN);
770
+ values.push(typeof v === "number" ? v : NaN);
771
+ }
772
+ }
773
+ else {
774
+ // Vertical range
775
+ for (let r = startRow; r <= endRow; r++) {
776
+ const cell = sourceWs.getCell(r, startCol);
777
+ const v = typeof cell.value === "number" ? cell.value : (cell.result ?? NaN);
778
+ values.push(typeof v === "number" ? v : NaN);
779
+ }
780
+ }
781
+ return values;
782
+ }
783
+ /**
784
+ * Draw a single sparkline into a PDF rect. Mirrors the logic of
785
+ * `renderSparklineSvg` but emits PDF drawing primitives via the
786
+ * chart surface.
787
+ */
788
+ function drawSparklinePdf(surface, group, values, rect) {
789
+ const { x, y, width, height } = rect;
790
+ if (width <= 0 || height <= 0 || values.length === 0) {
791
+ return;
792
+ }
793
+ const padding = 2;
794
+ const innerX = x + padding;
795
+ const innerY = y + padding;
796
+ const innerW = width - padding * 2;
797
+ const innerH = height - padding * 2;
798
+ if (innerW <= 0 || innerH <= 0) {
799
+ return;
800
+ }
801
+ // Compute axis range
802
+ const finiteValues = values.filter(v => Number.isFinite(v));
803
+ if (finiteValues.length === 0) {
804
+ return;
805
+ }
806
+ let min = Math.min(...finiteValues);
807
+ let max = Math.max(...finiteValues);
808
+ if (group.minAxisType === "custom" && group.manualMin !== undefined) {
809
+ min = group.manualMin;
810
+ }
811
+ if (group.maxAxisType === "custom" && group.manualMax !== undefined) {
812
+ max = group.manualMax;
813
+ }
814
+ if (min === max) {
815
+ min -= 1;
816
+ max += 1;
817
+ }
818
+ const span = max - min;
819
+ const rtl = group.rightToLeft === true;
820
+ const n = values.length;
821
+ const xAt = (i) => {
822
+ const t = n <= 1 ? 0.5 : i / (n - 1);
823
+ const shifted = rtl ? 1 - t : t;
824
+ return innerX + shifted * innerW;
825
+ };
826
+ // PDF y-up: higher values → higher y
827
+ const yAt = (v) => {
828
+ if (!Number.isFinite(v)) {
829
+ return innerY;
830
+ }
831
+ const t = (v - min) / span;
832
+ return innerY + t * innerH;
833
+ };
834
+ const lineColor = resolveSpkColor(group.colorSeries) ?? { r: 0.22, g: 0.38, b: 0.57 };
835
+ const negColor = resolveSpkColor(group.colorNegative) ?? { r: 0.82, g: 0, b: 0 };
836
+ if (group.type === "column" || group.type === "stacked") {
837
+ const barW = Math.max(1, (innerW / Math.max(n, 1)) * 0.8);
838
+ for (let i = 0; i < n; i++) {
839
+ const v = values[i];
840
+ if (!Number.isFinite(v) || v === 0) {
841
+ continue;
842
+ }
843
+ const cx = xAt(i);
844
+ const bx = cx - barW / 2;
845
+ const color = v < 0 && group.negative === true ? negColor : lineColor;
846
+ let barY;
847
+ let barH;
848
+ if (group.type === "stacked") {
849
+ const half = innerH / 2;
850
+ if (v >= 0) {
851
+ barY = innerY + half;
852
+ barH = half;
853
+ }
854
+ else {
855
+ barY = innerY;
856
+ barH = half;
857
+ }
858
+ }
859
+ else {
860
+ const base = min <= 0 && max >= 0 ? yAt(0) : innerY;
861
+ const top = yAt(v);
862
+ barY = Math.min(base, top);
863
+ barH = Math.abs(top - base);
864
+ }
865
+ surface.drawRect({ x: bx, y: barY, width: barW, height: Math.max(barH, 0.5), fill: color });
866
+ }
867
+ }
868
+ else {
869
+ // Line sparkline
870
+ const points = [];
871
+ for (let i = 0; i < n; i++) {
872
+ if (Number.isFinite(values[i])) {
873
+ points.push({ px: xAt(i), py: yAt(values[i]) });
874
+ }
875
+ }
876
+ if (points.length >= 2) {
877
+ for (let i = 1; i < points.length; i++) {
878
+ surface.drawLine({
879
+ x1: points[i - 1].px,
880
+ y1: points[i - 1].py,
881
+ x2: points[i].px,
882
+ y2: points[i].py,
883
+ color: lineColor,
884
+ lineWidth: group.lineWeight ? group.lineWeight * 0.75 : 0.75
885
+ });
886
+ }
887
+ }
888
+ // Markers
889
+ if (group.markers && surface.drawCircle) {
890
+ const mkColor = resolveSpkColor(group.colorMarkers) ?? lineColor;
891
+ for (const p of points) {
892
+ surface.drawCircle({ cx: p.px, cy: p.py, r: 1.2, fill: mkColor });
893
+ }
894
+ }
895
+ }
896
+ }
897
+ /** Resolve a SparklineColor to a PdfColor-like {r,g,b}. */
898
+ function resolveSpkColor(c) {
899
+ if (!c) {
900
+ return undefined;
901
+ }
902
+ if (c.rgb) {
903
+ const hex = c.rgb.replace(/^#/, "").replace(/^FF/i, "");
904
+ const r = parseInt(hex.slice(0, 2), 16) / 255;
905
+ const g = parseInt(hex.slice(2, 4), 16) / 255;
906
+ const b = parseInt(hex.slice(4, 6), 16) / 255;
907
+ if (Number.isFinite(r) && Number.isFinite(g) && Number.isFinite(b)) {
908
+ return { r, g, b };
909
+ }
910
+ }
911
+ return undefined;
912
+ }
913
+ /**
914
+ * Translate a `Chart.range` into the PDF layer's anchor shape. Returns
915
+ * `undefined` for charts that ExcelTS could not anchor to any cell
916
+ * (extremely rare — usually indicates a corrupt drawing relationship).
917
+ */
918
+ function chartAnchorRange(chart) {
919
+ const r = chart.range;
920
+ if (!r?.tl) {
921
+ return undefined;
922
+ }
923
+ const tl = r.tl;
924
+ const br = r.br;
925
+ return {
926
+ tl: {
927
+ col: tl.col ?? 0,
928
+ row: tl.row ?? 0,
929
+ nativeCol: tl.nativeCol,
930
+ nativeRow: tl.nativeRow,
931
+ nativeColOff: tl.nativeColOff,
932
+ nativeRowOff: tl.nativeRowOff
933
+ },
934
+ br: br
935
+ ? {
936
+ col: br.col ?? 0,
937
+ row: br.row ?? 0,
938
+ nativeCol: br.nativeCol,
939
+ nativeRow: br.nativeRow,
940
+ nativeColOff: br.nativeColOff,
941
+ nativeRowOff: br.nativeRowOff
942
+ }
943
+ : undefined,
944
+ // Chart anchors store ext as EMU (`cx`, `cy`). Pass the values
945
+ // through unchanged; the layout engine converts EMU→pt for charts
946
+ // (×1/9525) and px→pt for images (×0.75) based on `extUnit`.
947
+ ext: r.ext ? { width: r.ext.cx, height: r.ext.cy } : undefined,
948
+ extUnit: r.ext ? "emu" : undefined
949
+ };
950
+ }
951
+ /**
952
+ * Ensure a ChartEx model's data caches are populated for rendering.
953
+ *
954
+ * Hierarchical charts (treemap/sunburst) set `_skipCache` on their
955
+ * string/numeric dimensions so the XLSX writer doesn't emit flat cache
956
+ * levels (Excel rejects them). For PDF/image rendering the data must be
957
+ * in-memory. This helper temporarily lifts the flag, calls
958
+ * `fillChartExCaches`, then restores it so subsequent XLSX writes are
959
+ * unaffected.
960
+ */
961
+ function ensureChartExCachesFilled(model, ws) {
962
+ const data = model.chartSpace?.chartData?.data;
963
+ if (!data) {
964
+ return;
965
+ }
966
+ // Check if any dimension is missing cache data
967
+ const needsFill = data.some(entry => {
968
+ const strNeedsData = entry.strDim && (!entry.strDim.levels || entry.strDim.levels.length === 0);
969
+ const numNeedsData = entry.numDim && (!entry.numDim.levels || entry.numDim.levels.length === 0);
970
+ return strNeedsData || numNeedsData;
971
+ });
972
+ if (!needsFill) {
973
+ return;
974
+ }
975
+ // Temporarily lift _skipCache flags
976
+ const skipped = [];
977
+ for (const entry of data) {
978
+ const str = entry.strDim;
979
+ if (str?.["_skipCache"]) {
980
+ skipped.push(str);
981
+ delete str["_skipCache"];
982
+ }
983
+ const num = entry.numDim;
984
+ if (num?.["_skipCache"]) {
985
+ skipped.push(num);
986
+ delete num["_skipCache"];
987
+ }
988
+ }
989
+ try {
990
+ getChartSupport().fillChartExCaches(model, ws.workbook, ws);
991
+ }
992
+ catch {
993
+ // Best-effort — rendering will proceed with whatever data is available.
994
+ }
995
+ // Restore _skipCache
996
+ for (const dim of skipped) {
997
+ dim["_skipCache"] = true;
998
+ }
999
+ }
1000
+ /**
1001
+ * Pick a PNG rasterisation size for a non-vectorable ChartEx layout.
1002
+ *
1003
+ * Strategy: use the anchor extent (EMU → pt → px at 96 dpi) when
1004
+ * available; otherwise fall back to a reasonable default that survives
1005
+ * half-page stretching without obvious artefacts. The exporter's
1006
+ * `rasterScale` is applied separately in `collectCharts`.
1007
+ */
1008
+ function estimateChartPixelSize(range) {
1009
+ if (range.ext && range.extUnit === "emu") {
1010
+ const widthPt = range.ext.width / 9525;
1011
+ const heightPt = range.ext.height / 9525;
1012
+ // 1 pt = 1/72 in ≈ 96/72 px at 96 dpi
1013
+ return {
1014
+ widthPx: Math.max(120, Math.round(widthPt * (96 / 72))),
1015
+ heightPx: Math.max(80, Math.round(heightPt * (96 / 72)))
1016
+ };
1017
+ }
1018
+ return { widthPx: 640, heightPx: 420 };
1019
+ }
1020
+ // =============================================================================
1021
+ // Chartsheet Conversion
1022
+ // =============================================================================
1023
+ /**
1024
+ * Pixel dimensions used when rasterising a non-whitelisted ChartEx on a
1025
+ * chartsheet. Derived from Excel's own chartsheet canvas defaults
1026
+ * (A4 landscape minus default margins — see `CHARTSHEET_EMU_CX / CY`
1027
+ * in `xlsx.browser.ts`). 2× is applied by `renderChartExPng` via the
1028
+ * `scale` option so the PNG looks crisp at 150% zoom.
1029
+ */
1030
+ const CHARTSHEET_RASTER_PX = { width: 1280, height: 720 };
1031
+ /**
1032
+ * Convert a {@link Chartsheet} into a {@link PdfChartsheetData}.
1033
+ *
1034
+ * A chartsheet is a "single chart fills the whole page" sheet type. Unlike
1035
+ * a cell-grid worksheet there is no row/column layout to reason about —
1036
+ * the chart just takes whatever content area the page margins leave.
1037
+ *
1038
+ * - **Classic chart** → vector `drawChartPdf` path (selectable text,
1039
+ * crisp at any zoom).
1040
+ * - **ChartEx whitelisted layout** → vector `drawChartExPdf` path.
1041
+ * - **ChartEx outside the whitelist** → rasterised to PNG up-front via
1042
+ * `renderChartExPng`; the PDF viewer stretches the bitmap to the final
1043
+ * page rect.
1044
+ * - **No chart attached** → the chartsheet still produces a blank page
1045
+ * (matches what Excel prints for a chartsheet whose chart was deleted
1046
+ * but the sheet kept).
1047
+ */
1048
+ async function convertChartsheet(cs) {
1049
+ const classicModel = cs.chartModel;
1050
+ const chartExModel = cs.chartExModel;
1051
+ let chart = {};
1052
+ if (classicModel) {
1053
+ const model = classicModel;
1054
+ chart = {
1055
+ drawVector: (surface, rect) => {
1056
+ getChartSupport().drawChartPdf(surface, model, {
1057
+ x: rect.x,
1058
+ y: rect.y,
1059
+ width: rect.width,
1060
+ height: rect.height
1061
+ });
1062
+ }
1063
+ };
1064
+ }
1065
+ else if (chartExModel) {
1066
+ if (getChartSupport().canRenderChartExAsVectorPdf(chartExModel)) {
1067
+ const model = chartExModel;
1068
+ chart = {
1069
+ drawVector: (surface, rect) => {
1070
+ getChartSupport().drawChartExPdf(surface, model, {
1071
+ x: rect.x,
1072
+ y: rect.y,
1073
+ width: rect.width,
1074
+ height: rect.height
1075
+ });
1076
+ }
1077
+ };
1078
+ }
1079
+ else {
1080
+ const png = await getChartSupport().renderChartExPng(chartExModel, {
1081
+ width: CHARTSHEET_RASTER_PX.width,
1082
+ height: CHARTSHEET_RASTER_PX.height,
1083
+ scale: 2
1084
+ });
1085
+ chart = { raster: { data: png, format: "png" } };
1086
+ }
1087
+ }
1088
+ // Chartsheet orientation: explicit pageSetup wins. Excel's chartsheet
1089
+ // convention is landscape when unset (the CHARTSHEET_EMU_CX/CY pair in
1090
+ // xlsx.browser.ts is wider than tall), so we inherit that default.
1091
+ const explicitOrientation = cs.pageSetup?.orientation;
1092
+ const orientation = explicitOrientation === "portrait" || explicitOrientation === "landscape"
1093
+ ? explicitOrientation
1094
+ : "landscape";
1095
+ // Capture the native pageSetup for callers / exporter heuristics.
1096
+ // Chartsheet's `CT_CsPageSetup` is a subset of worksheet's `CT_PageSetup`;
1097
+ // the fields we surface here are the ones the PDF renderer knows how
1098
+ // to interpret. Unknown fields are silently dropped.
1099
+ const ps = cs.pageSetup;
1100
+ const pageSetup = ps
1101
+ ? {
1102
+ orientation: ps.orientation,
1103
+ paperSize: ps.paperSize,
1104
+ showGridLines: false
1105
+ }
1106
+ : undefined;
1107
+ return {
1108
+ kind: "chartsheet",
1109
+ name: cs.name,
1110
+ state: cs.state,
1111
+ orderNo: cs.model.orderNo,
1112
+ orientation,
1113
+ chart,
1114
+ pageSetup
1115
+ };
1116
+ }