office-viewer 0.1.0 → 0.1.3

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 (436) hide show
  1. package/README.md +7 -2
  2. package/esm/OpenXML.d.ts +19 -0
  3. package/esm/OpenXML.js +43 -2
  4. package/esm/Word.d.ts +132 -15
  5. package/esm/Word.js +233 -54
  6. package/esm/openxml/ContentType.js +20 -6
  7. package/esm/openxml/Settings.d.ts +10 -0
  8. package/esm/openxml/Settings.js +93 -0
  9. package/esm/openxml/Style.d.ts +1 -1
  10. package/esm/openxml/Style.js +12 -12
  11. package/esm/openxml/Theme.js +30 -6
  12. package/esm/openxml/Types.d.ts +179 -2472
  13. package/esm/openxml/drawing/Blip.d.ts +7 -0
  14. package/esm/openxml/{word/drawing → drawing}/Blip.js +2 -1
  15. package/{lib/openxml/word → esm/openxml}/drawing/BlipFill.d.ts +1 -1
  16. package/esm/openxml/{word/drawing → drawing}/BlipFill.js +1 -1
  17. package/esm/openxml/drawing/CustomGeom.d.ts +9 -0
  18. package/esm/openxml/drawing/CustomGeom.js +17 -0
  19. package/esm/openxml/drawing/Drawing.d.ts +35 -0
  20. package/esm/openxml/drawing/Drawing.js +169 -0
  21. package/esm/openxml/drawing/Geom.d.ts +11 -0
  22. package/esm/openxml/drawing/Geom.js +34 -0
  23. package/esm/openxml/drawing/Path.d.ts +37 -0
  24. package/esm/openxml/drawing/Pic.d.ts +16 -0
  25. package/esm/openxml/drawing/Pic.js +26 -0
  26. package/esm/openxml/drawing/Shape.d.ts +20 -0
  27. package/esm/openxml/drawing/ShapeProperties.d.ts +22 -0
  28. package/esm/openxml/drawing/ShapeProperties.js +119 -0
  29. package/{lib/openxml/word → esm/openxml}/drawing/Transform.d.ts +2 -1
  30. package/esm/openxml/{word/drawing → drawing}/Transform.js +7 -3
  31. package/esm/openxml/drawing/diagram/Diagram.d.ts +7 -0
  32. package/esm/openxml/drawing/diagram/Diagram.js +24 -0
  33. package/esm/openxml/drawing/diagram/Sp.d.ts +2 -0
  34. package/esm/openxml/drawing/diagram/SpTree.d.ts +5 -0
  35. package/esm/openxml/drawing/presetShape.d.ts +3 -0
  36. package/esm/openxml/drawing/presetShape.js +38785 -0
  37. package/esm/openxml/drawing/svg/arcToA.d.ts +13 -0
  38. package/esm/openxml/drawing/svg/arcToA.js +88 -0
  39. package/esm/openxml/drawing/svg/formulas.d.ts +29 -0
  40. package/esm/openxml/drawing/svg/formulas.js +103 -0
  41. package/esm/openxml/drawing/svg/generateDefines.d.ts +12 -0
  42. package/esm/openxml/drawing/svg/generateDefines.js +144 -0
  43. package/esm/openxml/drawing/svg/presetVal.d.ts +43 -0
  44. package/esm/openxml/drawing/svg/presetVal.js +53 -0
  45. package/esm/openxml/drawing/svg/shapeToSVG.d.ts +9 -0
  46. package/esm/openxml/drawing/svg/shapeToSVG.js +151 -0
  47. package/esm/openxml/math/OMath.d.ts +5 -0
  48. package/esm/openxml/math/OMath.js +12 -0
  49. package/esm/openxml/math/convertOOML.d.ts +4 -0
  50. package/esm/openxml/math/convertOOML.js +13 -0
  51. package/esm/openxml/math/xsl.d.ts +4 -0
  52. package/esm/openxml/math/xsl.js +8 -0
  53. package/esm/openxml/word/Body.js +11 -7
  54. package/esm/openxml/word/Break.js +1 -3
  55. package/esm/openxml/word/Font.d.ts +16 -0
  56. package/esm/openxml/word/Font.js +78 -0
  57. package/esm/openxml/word/FontTable.d.ts +9 -0
  58. package/esm/openxml/word/FontTable.js +34 -0
  59. package/esm/openxml/word/Header.d.ts +11 -0
  60. package/esm/openxml/word/Header.js +54 -0
  61. package/esm/openxml/word/Hyperlink.d.ts +1 -0
  62. package/esm/openxml/word/Hyperlink.js +7 -3
  63. package/esm/openxml/word/InlineText.js +1 -1
  64. package/esm/openxml/word/NoBreakHyphen.d.ts +2 -0
  65. package/esm/openxml/word/NoBreakHyphen.js +7 -0
  66. package/esm/openxml/word/Note.d.ts +12 -0
  67. package/esm/openxml/word/Note.js +48 -0
  68. package/esm/openxml/word/Paragraph.d.ts +2 -2
  69. package/esm/openxml/word/Paragraph.js +10 -9
  70. package/esm/openxml/word/Pict.d.ts +1 -2
  71. package/esm/openxml/word/Pict.js +5 -3
  72. package/esm/openxml/word/Ruby.js +1 -1
  73. package/esm/openxml/word/Run.d.ts +7 -3
  74. package/esm/openxml/word/Run.js +28 -4
  75. package/esm/openxml/word/Section.d.ts +18 -5
  76. package/esm/openxml/word/Section.js +46 -2
  77. package/esm/openxml/word/Separator.d.ts +5 -0
  78. package/esm/openxml/word/Separator.js +10 -0
  79. package/esm/openxml/word/SoftHyphen.d.ts +5 -0
  80. package/esm/openxml/word/SoftHyphen.js +10 -0
  81. package/esm/openxml/word/Table.d.ts +4 -9
  82. package/esm/openxml/word/Table.js +0 -235
  83. package/esm/openxml/word/WDocument.d.ts +1 -2
  84. package/esm/openxml/word/WDocument.js +53 -7
  85. package/esm/openxml/word/numbering/AbstractNum.js +4 -2
  86. package/esm/openxml/word/numbering/Lvl.js +10 -4
  87. package/esm/openxml/word/numbering/Num.js +12 -4
  88. package/esm/openxml/word/numbering/NumberProperties.js +2 -2
  89. package/esm/openxml/word/numbering/Numbering.js +1 -1
  90. package/esm/openxml/word/table/Tc.d.ts +1 -22
  91. package/esm/openxml/word/table/Tc.js +1 -221
  92. package/esm/openxml/word/table/Tr.d.ts +0 -5
  93. package/esm/openxml/word/table/Tr.js +0 -97
  94. package/esm/openxml/word/wps/WPG.d.ts +5 -0
  95. package/esm/openxml/word/wps/WPS.d.ts +18 -0
  96. package/esm/openxml/word/wps/WPS.js +147 -0
  97. package/esm/openxml/word/wps/WPSStyle.d.ts +10 -0
  98. package/esm/openxml/word/wps/WPSStyle.js +42 -0
  99. package/esm/package/PackageParser.d.ts +1 -1
  100. package/esm/package/XMLPackageParser.d.ts +3 -3
  101. package/esm/package/ZipPackageParser.d.ts +1 -1
  102. package/esm/package/ZipPackageParser.js +7 -8
  103. package/esm/parse/Footnotes.d.ts +3 -0
  104. package/esm/parse/Footnotes.js +25 -0
  105. package/esm/parse/colorNameMap.d.ts +6 -0
  106. package/esm/parse/colorNameMap.js +201 -0
  107. package/esm/parse/jcToTextAlign.js +1 -0
  108. package/esm/parse/mergeSdt.d.ts +4 -0
  109. package/esm/parse/mergeSdt.js +57 -0
  110. package/esm/parse/modifyColor.d.ts +1 -0
  111. package/esm/parse/modifyColor.js +106 -0
  112. package/esm/parse/parseBorder.js +2 -21
  113. package/esm/parse/parseCellMargin.d.ts +2 -0
  114. package/esm/parse/parseCellMargin.js +38 -0
  115. package/esm/parse/parseChildColor.d.ts +5 -0
  116. package/esm/parse/parseChildColor.js +66 -0
  117. package/esm/parse/parseColor.d.ts +4 -0
  118. package/esm/parse/parseColor.js +41 -46
  119. package/esm/parse/parseEndnotes.d.ts +3 -0
  120. package/esm/parse/parseEndnotes.js +25 -0
  121. package/esm/parse/parseFont.js +1 -1
  122. package/esm/parse/parseInsideBorders.d.ts +9 -0
  123. package/esm/parse/parseInsideBorders.js +24 -0
  124. package/esm/parse/parsePr.d.ts +3 -0
  125. package/esm/parse/parsePr.js +108 -11
  126. package/esm/parse/parseRelationship.js +1 -1
  127. package/esm/parse/parseSdt.d.ts +5 -0
  128. package/esm/parse/parseShape.d.ts +10 -0
  129. package/esm/parse/parseShape.js +239 -0
  130. package/esm/parse/parseSize.d.ts +2 -1
  131. package/esm/parse/parseSize.js +7 -1
  132. package/esm/parse/parseSpacing.js +1 -1
  133. package/esm/parse/parseTable.d.ts +3 -0
  134. package/esm/parse/parseTable.js +62 -0
  135. package/esm/parse/parseTablePr.d.ts +3 -0
  136. package/esm/parse/parseTablePr.js +185 -0
  137. package/esm/parse/parseTblWidth.d.ts +4 -0
  138. package/esm/parse/parseTblWidth.js +23 -0
  139. package/esm/parse/parseTc.d.ts +10 -0
  140. package/esm/parse/parseTc.js +64 -0
  141. package/esm/parse/parseTcPr.d.ts +5 -0
  142. package/esm/parse/parseTcPr.js +99 -0
  143. package/esm/parse/parseTextDirection.js +4 -6
  144. package/esm/parse/parseTr.d.ts +6 -0
  145. package/esm/parse/parseTr.js +49 -0
  146. package/esm/parse/parseTrPr.d.ts +3 -0
  147. package/esm/parse/parseTrPr.js +59 -0
  148. package/esm/render/fixAbsolutePosition.d.ts +8 -0
  149. package/esm/render/renderBody.d.ts +6 -2
  150. package/esm/render/renderBody.js +184 -30
  151. package/esm/render/renderBr.d.ts +2 -1
  152. package/esm/render/renderBr.js +4 -1
  153. package/esm/render/renderCustGeom.d.ts +4 -0
  154. package/esm/render/renderCustGeom.js +10 -0
  155. package/esm/render/renderDocument.d.ts +2 -2
  156. package/esm/render/renderDocument.js +2 -2
  157. package/esm/render/renderDrawing.d.ts +3 -2
  158. package/esm/render/renderDrawing.js +129 -24
  159. package/esm/render/renderFont.d.ts +5 -0
  160. package/esm/render/renderFont.js +39 -0
  161. package/esm/render/renderGeom.d.ts +4 -0
  162. package/esm/render/renderGeom.js +14 -0
  163. package/esm/render/renderHeader.d.ts +6 -0
  164. package/esm/render/renderHeader.js +40 -0
  165. package/esm/render/renderHyperLink.js +4 -1
  166. package/esm/render/renderInlineText.js +1 -1
  167. package/esm/render/renderInstrText.js +1 -1
  168. package/esm/render/renderMath.d.ts +3 -0
  169. package/esm/render/renderMath.js +7 -0
  170. package/esm/render/renderNoBreakHyphen.d.ts +1 -0
  171. package/esm/render/renderNoBreakHyphen.js +9 -0
  172. package/esm/render/renderNotes.d.ts +5 -0
  173. package/esm/render/renderNotes.js +77 -0
  174. package/esm/render/renderNumbering.js +8 -10
  175. package/esm/render/renderParagraph.d.ts +1 -1
  176. package/esm/render/renderParagraph.js +26 -29
  177. package/esm/render/renderPict.js +5 -10
  178. package/esm/render/renderRuby.js +1 -1
  179. package/esm/render/renderRun.d.ts +4 -2
  180. package/esm/render/renderRun.js +35 -10
  181. package/esm/render/renderSection.d.ts +3 -2
  182. package/esm/render/renderSection.js +79 -5
  183. package/esm/render/renderSeparator.d.ts +1 -0
  184. package/esm/render/renderSeparator.js +9 -0
  185. package/esm/render/renderSoftHyphen.d.ts +1 -0
  186. package/esm/render/renderSoftHyphen.js +9 -0
  187. package/esm/render/renderStyle.js +36 -35
  188. package/esm/render/renderTab.d.ts +1 -0
  189. package/esm/render/renderTab.js +4 -6
  190. package/esm/render/renderTable.js +23 -20
  191. package/esm/render/setElementStyle.js +7 -2
  192. package/esm/render/zindex.d.ts +1 -0
  193. package/esm/util/blob.js +1 -10
  194. package/esm/util/color.d.ts +48 -0
  195. package/esm/util/color.js +211 -0
  196. package/esm/util/createObject.d.ts +10 -0
  197. package/esm/util/createObject.js +48 -0
  198. package/esm/util/dom.d.ts +8 -4
  199. package/esm/util/dom.js +21 -4
  200. package/esm/util/mergeRun.js +1 -1
  201. package/esm/util/parseSides.d.ts +11 -0
  202. package/esm/util/print.d.ts +5 -0
  203. package/esm/util/print.js +54 -0
  204. package/esm/util/replaceVar.d.ts +10 -0
  205. package/esm/util/replaceVar.js +214 -0
  206. package/esm/util/xml.js +4 -1
  207. package/lib/OpenXML.d.ts +19 -0
  208. package/lib/OpenXML.js +44 -1
  209. package/lib/Word.d.ts +132 -15
  210. package/lib/Word.js +238 -59
  211. package/lib/openxml/ContentType.js +20 -6
  212. package/lib/openxml/Settings.d.ts +10 -0
  213. package/lib/openxml/Settings.js +97 -0
  214. package/lib/openxml/Style.d.ts +1 -1
  215. package/lib/openxml/Style.js +15 -15
  216. package/lib/openxml/Theme.js +31 -7
  217. package/lib/openxml/Types.d.ts +179 -2472
  218. package/lib/openxml/drawing/Blip.d.ts +7 -0
  219. package/lib/openxml/{word/drawing → drawing}/Blip.js +2 -1
  220. package/{esm/openxml/word → lib/openxml}/drawing/BlipFill.d.ts +1 -1
  221. package/lib/openxml/{word/drawing → drawing}/BlipFill.js +1 -1
  222. package/lib/openxml/drawing/CustomGeom.d.ts +9 -0
  223. package/lib/openxml/drawing/CustomGeom.js +21 -0
  224. package/lib/openxml/drawing/Drawing.d.ts +35 -0
  225. package/lib/openxml/drawing/Drawing.js +173 -0
  226. package/lib/openxml/drawing/Geom.d.ts +11 -0
  227. package/lib/openxml/drawing/Geom.js +38 -0
  228. package/lib/openxml/drawing/Path.d.ts +37 -0
  229. package/lib/openxml/drawing/Pic.d.ts +16 -0
  230. package/lib/openxml/drawing/Pic.js +30 -0
  231. package/lib/openxml/drawing/Shape.d.ts +20 -0
  232. package/lib/openxml/drawing/ShapeProperties.d.ts +22 -0
  233. package/lib/openxml/drawing/ShapeProperties.js +123 -0
  234. package/{esm/openxml/word → lib/openxml}/drawing/Transform.d.ts +2 -1
  235. package/lib/openxml/{word/drawing → drawing}/Transform.js +7 -3
  236. package/lib/openxml/drawing/diagram/Diagram.d.ts +7 -0
  237. package/lib/openxml/drawing/diagram/Diagram.js +28 -0
  238. package/lib/openxml/drawing/diagram/Sp.d.ts +2 -0
  239. package/lib/openxml/drawing/diagram/SpTree.d.ts +5 -0
  240. package/lib/openxml/drawing/presetShape.d.ts +3 -0
  241. package/lib/openxml/drawing/presetShape.js +38789 -0
  242. package/lib/openxml/drawing/svg/arcToA.d.ts +13 -0
  243. package/lib/openxml/drawing/svg/arcToA.js +92 -0
  244. package/lib/openxml/drawing/svg/formulas.d.ts +29 -0
  245. package/lib/openxml/drawing/svg/formulas.js +108 -0
  246. package/lib/openxml/drawing/svg/generateDefines.d.ts +12 -0
  247. package/lib/openxml/drawing/svg/generateDefines.js +148 -0
  248. package/lib/openxml/drawing/svg/presetVal.d.ts +43 -0
  249. package/lib/openxml/drawing/svg/presetVal.js +57 -0
  250. package/lib/openxml/drawing/svg/shapeToSVG.d.ts +9 -0
  251. package/lib/openxml/drawing/svg/shapeToSVG.js +155 -0
  252. package/lib/openxml/math/OMath.d.ts +5 -0
  253. package/lib/openxml/math/OMath.js +16 -0
  254. package/lib/openxml/math/convertOOML.d.ts +4 -0
  255. package/lib/openxml/math/convertOOML.js +17 -0
  256. package/lib/openxml/math/xsl.d.ts +4 -0
  257. package/lib/openxml/math/xsl.js +12 -0
  258. package/lib/openxml/word/Body.js +11 -7
  259. package/lib/openxml/word/Break.js +1 -3
  260. package/lib/openxml/word/Font.d.ts +16 -0
  261. package/lib/openxml/word/Font.js +83 -0
  262. package/lib/openxml/word/FontTable.d.ts +9 -0
  263. package/lib/openxml/word/FontTable.js +38 -0
  264. package/lib/openxml/word/Header.d.ts +11 -0
  265. package/lib/openxml/word/Header.js +58 -0
  266. package/lib/openxml/word/Hyperlink.d.ts +1 -0
  267. package/lib/openxml/word/Hyperlink.js +8 -4
  268. package/lib/openxml/word/InlineText.js +2 -2
  269. package/lib/openxml/word/NoBreakHyphen.d.ts +2 -0
  270. package/lib/openxml/word/NoBreakHyphen.js +11 -0
  271. package/lib/openxml/word/Note.d.ts +12 -0
  272. package/lib/openxml/word/Note.js +52 -0
  273. package/lib/openxml/word/Paragraph.d.ts +2 -2
  274. package/lib/openxml/word/Paragraph.js +11 -10
  275. package/lib/openxml/word/Pict.d.ts +1 -2
  276. package/lib/openxml/word/Pict.js +5 -3
  277. package/lib/openxml/word/Ruby.js +4 -4
  278. package/lib/openxml/word/Run.d.ts +7 -3
  279. package/lib/openxml/word/Run.js +29 -5
  280. package/lib/openxml/word/Section.d.ts +18 -5
  281. package/lib/openxml/word/Section.js +47 -3
  282. package/lib/openxml/word/Separator.d.ts +5 -0
  283. package/lib/openxml/word/Separator.js +14 -0
  284. package/lib/openxml/word/SoftHyphen.d.ts +5 -0
  285. package/lib/openxml/word/SoftHyphen.js +14 -0
  286. package/lib/openxml/word/Table.d.ts +4 -9
  287. package/lib/openxml/word/Table.js +0 -235
  288. package/lib/openxml/word/WDocument.d.ts +1 -2
  289. package/lib/openxml/word/WDocument.js +53 -7
  290. package/lib/openxml/word/numbering/AbstractNum.js +5 -3
  291. package/lib/openxml/word/numbering/Lvl.js +11 -5
  292. package/lib/openxml/word/numbering/Num.js +12 -4
  293. package/lib/openxml/word/numbering/NumberProperties.js +2 -2
  294. package/lib/openxml/word/numbering/Numbering.js +3 -3
  295. package/lib/openxml/word/table/Tc.d.ts +1 -22
  296. package/lib/openxml/word/table/Tc.js +0 -224
  297. package/lib/openxml/word/table/Tr.d.ts +0 -5
  298. package/lib/openxml/word/table/Tr.js +0 -97
  299. package/lib/openxml/word/wps/WPG.d.ts +5 -0
  300. package/lib/openxml/word/wps/WPS.d.ts +18 -0
  301. package/lib/openxml/word/wps/WPS.js +151 -0
  302. package/lib/openxml/word/wps/WPSStyle.d.ts +10 -0
  303. package/lib/openxml/word/wps/WPSStyle.js +46 -0
  304. package/lib/package/PackageParser.d.ts +1 -1
  305. package/lib/package/XMLPackageParser.d.ts +3 -3
  306. package/lib/package/ZipPackageParser.d.ts +1 -1
  307. package/lib/package/ZipPackageParser.js +7 -8
  308. package/lib/parse/Footnotes.d.ts +3 -0
  309. package/lib/parse/Footnotes.js +29 -0
  310. package/lib/parse/colorNameMap.d.ts +6 -0
  311. package/lib/parse/colorNameMap.js +205 -0
  312. package/lib/parse/jcToTextAlign.js +1 -0
  313. package/lib/parse/mergeSdt.d.ts +4 -0
  314. package/lib/parse/mergeSdt.js +61 -0
  315. package/lib/parse/modifyColor.d.ts +1 -0
  316. package/lib/parse/modifyColor.js +110 -0
  317. package/lib/parse/parseBorder.js +3 -22
  318. package/lib/parse/parseCellMargin.d.ts +2 -0
  319. package/lib/parse/parseCellMargin.js +42 -0
  320. package/lib/parse/parseChildColor.d.ts +5 -0
  321. package/lib/parse/parseChildColor.js +70 -0
  322. package/lib/parse/parseColor.d.ts +4 -0
  323. package/lib/parse/parseColor.js +41 -45
  324. package/lib/parse/parseEndnotes.d.ts +3 -0
  325. package/lib/parse/parseEndnotes.js +29 -0
  326. package/lib/parse/parseFont.js +2 -2
  327. package/lib/parse/parseInsideBorders.d.ts +9 -0
  328. package/lib/parse/parseInsideBorders.js +28 -0
  329. package/lib/parse/parsePr.d.ts +3 -0
  330. package/lib/parse/parsePr.js +109 -12
  331. package/lib/parse/parseRelationship.js +2 -2
  332. package/lib/parse/parseSdt.d.ts +5 -0
  333. package/lib/parse/parseShape.d.ts +10 -0
  334. package/lib/parse/parseShape.js +247 -0
  335. package/lib/parse/parseSize.d.ts +2 -1
  336. package/lib/parse/parseSize.js +7 -0
  337. package/lib/parse/parseSpacing.js +1 -1
  338. package/lib/parse/parseTable.d.ts +3 -0
  339. package/lib/parse/parseTable.js +66 -0
  340. package/lib/parse/parseTablePr.d.ts +3 -0
  341. package/lib/parse/parseTablePr.js +189 -0
  342. package/lib/parse/parseTblWidth.d.ts +4 -0
  343. package/lib/parse/parseTblWidth.js +27 -0
  344. package/lib/parse/parseTc.d.ts +10 -0
  345. package/lib/parse/parseTc.js +68 -0
  346. package/lib/parse/parseTcPr.d.ts +5 -0
  347. package/lib/parse/parseTcPr.js +104 -0
  348. package/lib/parse/parseTextDirection.js +4 -6
  349. package/lib/parse/parseTr.d.ts +6 -0
  350. package/lib/parse/parseTr.js +53 -0
  351. package/lib/parse/parseTrPr.d.ts +3 -0
  352. package/lib/parse/parseTrPr.js +63 -0
  353. package/lib/render/fixAbsolutePosition.d.ts +8 -0
  354. package/lib/render/renderBody.d.ts +6 -2
  355. package/lib/render/renderBody.js +183 -29
  356. package/lib/render/renderBr.d.ts +2 -1
  357. package/lib/render/renderBr.js +4 -1
  358. package/lib/render/renderCustGeom.d.ts +4 -0
  359. package/lib/render/renderCustGeom.js +14 -0
  360. package/lib/render/renderDocument.d.ts +2 -2
  361. package/lib/render/renderDocument.js +2 -2
  362. package/lib/render/renderDrawing.d.ts +3 -2
  363. package/lib/render/renderDrawing.js +129 -24
  364. package/lib/render/renderFont.d.ts +5 -0
  365. package/lib/render/renderFont.js +43 -0
  366. package/lib/render/renderGeom.d.ts +4 -0
  367. package/lib/render/renderGeom.js +18 -0
  368. package/lib/render/renderHeader.d.ts +6 -0
  369. package/lib/render/renderHeader.js +44 -0
  370. package/lib/render/renderHyperLink.js +5 -2
  371. package/lib/render/renderInlineText.js +2 -2
  372. package/lib/render/renderInstrText.js +2 -2
  373. package/lib/render/renderMath.d.ts +3 -0
  374. package/lib/render/renderMath.js +11 -0
  375. package/lib/render/renderNoBreakHyphen.d.ts +1 -0
  376. package/lib/render/renderNoBreakHyphen.js +13 -0
  377. package/lib/render/renderNotes.d.ts +5 -0
  378. package/lib/render/renderNotes.js +81 -0
  379. package/lib/render/renderNumbering.js +9 -11
  380. package/lib/render/renderParagraph.d.ts +1 -1
  381. package/lib/render/renderParagraph.js +26 -29
  382. package/lib/render/renderPict.js +5 -10
  383. package/lib/render/renderRuby.js +3 -3
  384. package/lib/render/renderRun.d.ts +4 -2
  385. package/lib/render/renderRun.js +34 -9
  386. package/lib/render/renderSection.d.ts +3 -2
  387. package/lib/render/renderSection.js +79 -5
  388. package/lib/render/renderSeparator.d.ts +1 -0
  389. package/lib/render/renderSeparator.js +13 -0
  390. package/lib/render/renderSoftHyphen.d.ts +1 -0
  391. package/lib/render/renderSoftHyphen.js +13 -0
  392. package/lib/render/renderStyle.js +37 -36
  393. package/lib/render/renderTab.d.ts +1 -0
  394. package/lib/render/renderTab.js +4 -6
  395. package/lib/render/renderTable.js +25 -22
  396. package/lib/render/setElementStyle.js +6 -1
  397. package/lib/render/zindex.d.ts +1 -0
  398. package/lib/util/blob.js +0 -10
  399. package/lib/util/color.d.ts +48 -0
  400. package/lib/util/color.js +215 -0
  401. package/lib/util/createObject.d.ts +10 -0
  402. package/lib/util/createObject.js +54 -0
  403. package/lib/util/dom.d.ts +8 -4
  404. package/lib/util/dom.js +24 -5
  405. package/lib/util/mergeRun.js +5 -5
  406. package/lib/util/parseSides.d.ts +11 -0
  407. package/lib/util/print.d.ts +5 -0
  408. package/lib/util/print.js +58 -0
  409. package/lib/util/replaceVar.d.ts +10 -0
  410. package/lib/util/replaceVar.js +219 -0
  411. package/lib/util/xml.js +4 -0
  412. package/package.json +17 -6
  413. package/esm/node_modules/tslib/tslib.es6.js +0 -120
  414. package/esm/openxml/Types.js +0 -1003
  415. package/esm/openxml/word/CustomXml.d.ts +0 -8
  416. package/esm/openxml/word/SmartTag.d.ts +0 -8
  417. package/esm/openxml/word/SmartTag.js +0 -18
  418. package/esm/openxml/word/drawing/Blip.d.ts +0 -6
  419. package/esm/openxml/word/drawing/Drawing.d.ts +0 -6
  420. package/esm/openxml/word/drawing/Drawing.js +0 -15
  421. package/esm/openxml/word/drawing/Pic.d.ts +0 -8
  422. package/esm/openxml/word/drawing/Pic.js +0 -16
  423. package/esm/openxml/word/drawing/ShapeProperties.d.ts +0 -9
  424. package/esm/openxml/word/drawing/ShapeProperties.js +0 -20
  425. package/lib/node_modules/tslib/tslib.es6.js +0 -129
  426. package/lib/openxml/Types.js +0 -1005
  427. package/lib/openxml/word/CustomXml.d.ts +0 -8
  428. package/lib/openxml/word/SmartTag.d.ts +0 -8
  429. package/lib/openxml/word/SmartTag.js +0 -22
  430. package/lib/openxml/word/drawing/Blip.d.ts +0 -6
  431. package/lib/openxml/word/drawing/Drawing.d.ts +0 -6
  432. package/lib/openxml/word/drawing/Drawing.js +0 -19
  433. package/lib/openxml/word/drawing/Pic.d.ts +0 -8
  434. package/lib/openxml/word/drawing/Pic.js +0 -20
  435. package/lib/openxml/word/drawing/ShapeProperties.d.ts +0 -9
  436. package/lib/openxml/word/drawing/ShapeProperties.js +0 -24
@@ -0,0 +1,7 @@
1
+ import { Relationship } from '../../parse/parseRelationship';
2
+ import Word from '../../Word';
3
+ export declare class Blip {
4
+ embled?: Relationship;
5
+ src?: string | null;
6
+ static fromXML(word: Word, element: Element): Blip;
7
+ }
@@ -9,9 +9,10 @@ var Blip = /** @class */ (function () {
9
9
  var blip = new Blip();
10
10
  // 目前值支持 embed 这一种
11
11
  var embedId = element.getAttribute('r:embed') || '';
12
- var rel = word.getRelationship(embedId);
12
+ var rel = word.getDocumentRels(embedId);
13
13
  if (rel) {
14
14
  blip.embled = rel;
15
+ blip.src = word.loadImage(blip.embled);
15
16
  }
16
17
  return blip;
17
18
  };
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * http://webapp.docx4java.org/OnlineDemo/ecma376/DrawingML/blipFill_2.html
3
3
  */
4
- import Word from '../../../Word';
4
+ import Word from '../../Word';
5
5
  import { Blip } from './Blip';
6
6
  export declare class BlipFill {
7
7
  blip?: Blip;
@@ -12,7 +12,7 @@ var BlipFill = /** @class */ (function () {
12
12
  }
13
13
  BlipFill.fromXML = function (word, element) {
14
14
  var blipFill = new BlipFill();
15
- var blip = element === null || element === void 0 ? void 0 : element.querySelector('blip');
15
+ var blip = element === null || element === void 0 ? void 0 : element.getElementsByTagName('a:blip').item(0);
16
16
  if (blip) {
17
17
  blipFill.blip = Blip.Blip.fromXML(word, blip);
18
18
  }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * 自定义形状
3
+ */
4
+ import Word from '../../Word';
5
+ import { Shape } from './Shape';
6
+ export declare class CustomGeom {
7
+ shape: Shape;
8
+ static fromXML(word: Word, element: Element): CustomGeom;
9
+ }
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var parseShape = require('../../parse/parseShape.js');
6
+
7
+ /**
8
+ * 自定义形状
9
+ */
10
+ var CustomGeom = /** @class */ (function () {
11
+ function CustomGeom() {
12
+ }
13
+ CustomGeom.fromXML = function (word, element) {
14
+ var geom = new CustomGeom();
15
+ geom.shape = parseShape.parseShape(element);
16
+ return geom;
17
+ };
18
+ return CustomGeom;
19
+ }());
20
+
21
+ exports.CustomGeom = CustomGeom;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * 目前图片和 textbox 都会依赖这个
3
+ */
4
+ import { CSSStyle } from './../Style';
5
+ import Word from '../../Word';
6
+ import { Pic } from './Pic';
7
+ import { WPS } from '../word/wps/WPS';
8
+ /**
9
+ * drawing 在文档中的位置,目前有两种情况,child 和 anchor
10
+ */
11
+ export declare enum Position {
12
+ inline = "inline",
13
+ anchor = "anchor"
14
+ }
15
+ /**
16
+ * 有大量属性不好通过 css 来实现
17
+ * http://webapp.docx4java.org/OnlineDemo/ecma376/DrawingML/anchor_2.html
18
+ */
19
+ export interface Anchor {
20
+ simplePos: boolean;
21
+ hidden?: boolean;
22
+ behindDoc?: boolean;
23
+ }
24
+ export declare class Drawing {
25
+ pic?: Pic;
26
+ wps?: WPS;
27
+ diagram?: ConstrainDOMStringParameters;
28
+ position: Position;
29
+ anchor?: Anchor;
30
+ containerStyle?: CSSStyle;
31
+ relativeFromV: 'paragraph' | 'page';
32
+ id?: string;
33
+ name?: string;
34
+ static fromXML(word: Word, element: Element): Drawing | null;
35
+ }
@@ -0,0 +1,173 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var tslib = require('tslib');
6
+ var parseSize = require('../../parse/parseSize.js');
7
+ var OpenXML = require('../../OpenXML.js');
8
+ var Pic = require('./Pic.js');
9
+ var WPS = require('../word/wps/WPS.js');
10
+ var Diagram = require('./diagram/Diagram.js');
11
+
12
+ /**
13
+ * 目前图片和 textbox 都会依赖这个
14
+ */
15
+ /**
16
+ * drawing 在文档中的位置,目前有两种情况,child 和 anchor
17
+ */
18
+ exports.Position = void 0;
19
+ (function (Position) {
20
+ Position["inline"] = "inline";
21
+ Position["anchor"] = "anchor";
22
+ })(exports.Position || (exports.Position = {}));
23
+ function parseAnchor(element) {
24
+ var simplePos = OpenXML.getAttrBoolean(element, 'simplePos', false);
25
+ var hidden = OpenXML.getAttrBoolean(element, 'hidden', false);
26
+ var behindDoc = OpenXML.getAttrBoolean(element, 'behindDoc', false);
27
+ return {
28
+ simplePos: simplePos,
29
+ hidden: hidden,
30
+ behindDoc: behindDoc
31
+ };
32
+ }
33
+ var Drawing = /** @class */ (function () {
34
+ function Drawing() {
35
+ // drawing 的位置配置
36
+ this.position = exports.Position.inline;
37
+ }
38
+ Drawing.fromXML = function (word, element) {
39
+ var e_1, _a;
40
+ var _b;
41
+ var drawing = new Drawing();
42
+ var containerStyle = {};
43
+ drawing.containerStyle = containerStyle;
44
+ var position = element.firstElementChild;
45
+ if (position) {
46
+ if (position.tagName === 'wp:anchor') {
47
+ drawing.position = exports.Position.anchor;
48
+ drawing.anchor = parseAnchor(position);
49
+ var relativeHeight = OpenXML.getAttrNumber(position, 'relativeHeight', 1);
50
+ containerStyle['z-index'] = relativeHeight;
51
+ }
52
+ try {
53
+ for (var _c = tslib.__values(position.children), _d = _c.next(); !_d.done; _d = _c.next()) {
54
+ var child = _d.value;
55
+ var tagName = child.tagName;
56
+ switch (tagName) {
57
+ case 'wp:simplePos':
58
+ // 只有设置了 simplePos 才会生效
59
+ // 据说 word 其实不支持这个属性,所以目前实现估计没啥用
60
+ if ((_b = drawing.anchor) === null || _b === void 0 ? void 0 : _b.simplePos) {
61
+ containerStyle['position'] = 'absolute';
62
+ containerStyle['x'] = parseSize.parseSize(child, 'x', parseSize.LengthUsage.Emu);
63
+ containerStyle['y'] = parseSize.parseSize(child, 'y', parseSize.LengthUsage.Emu);
64
+ }
65
+ break;
66
+ case 'wp:positionH':
67
+ var relativeFromH = child.getAttribute('relativeFrom');
68
+ if (relativeFromH === 'column' ||
69
+ relativeFromH === 'page' ||
70
+ relativeFromH === 'margin') {
71
+ var positionType = child.firstElementChild;
72
+ if (positionType) {
73
+ var positionTypeTagName = positionType.tagName;
74
+ containerStyle['position'] = 'absolute';
75
+ if (positionTypeTagName === 'wp:posOffset') {
76
+ containerStyle['left'] = parseSize.convertLength(positionType.innerHTML, parseSize.LengthUsage.Emu);
77
+ }
78
+ else {
79
+ containerStyle['left'] = '0';
80
+ console.warn('unsupport positionType', positionTypeTagName);
81
+ }
82
+ }
83
+ }
84
+ else {
85
+ console.warn('unsupport positionH relativeFrom', relativeFromH);
86
+ }
87
+ break;
88
+ case 'wp:positionV':
89
+ var relativeFromV = child.getAttribute('relativeFrom');
90
+ if (relativeFromV === 'paragraph' || relativeFromV === 'page') {
91
+ drawing.relativeFromV = relativeFromV;
92
+ var positionType = child.firstElementChild;
93
+ if (positionType) {
94
+ var positionTypeTagName = positionType.tagName;
95
+ containerStyle['position'] = 'absolute';
96
+ if (positionTypeTagName === 'wp:posOffset') {
97
+ containerStyle['top'] = parseSize.convertLength(positionType.innerHTML, parseSize.LengthUsage.Emu);
98
+ }
99
+ else {
100
+ containerStyle['top'] = '0';
101
+ console.warn('unsupport positionType', positionTypeTagName);
102
+ }
103
+ }
104
+ }
105
+ else {
106
+ console.warn('unsupport positionV relativeFrom', relativeFromV);
107
+ }
108
+ break;
109
+ case 'wp:docPr':
110
+ drawing.id = child.getAttribute('id') || undefined;
111
+ drawing.name = child.getAttribute('name') || undefined;
112
+ break;
113
+ case 'wp:cNvGraphicFramePr':
114
+ // 和展现无关
115
+ // http://webapp.docx4java.org/OnlineDemo/ecma376/DrawingML/docPr.html
116
+ // http://webapp.docx4java.org/OnlineDemo/ecma376/DrawingML/cNvGraphicFramePr_1.html
117
+ break;
118
+ case 'a:graphic':
119
+ var graphicData = child.firstElementChild;
120
+ var graphicDataChild = graphicData === null || graphicData === void 0 ? void 0 : graphicData.firstElementChild;
121
+ if (graphicDataChild) {
122
+ var graphicDataChildTagName = graphicDataChild.tagName;
123
+ switch (graphicDataChildTagName) {
124
+ case 'pic:pic':
125
+ drawing.pic = Pic.Pic.fromXML(word, graphicDataChild);
126
+ break;
127
+ case 'wps:wsp':
128
+ drawing.wps = WPS.WPS.fromXML(word, graphicDataChild);
129
+ break;
130
+ case 'dgm:relIds':
131
+ // 这个是 diagram 的关系
132
+ // http://webapp.docx4java.org/OnlineDemo/ecma376/DrawingML/relIds.html
133
+ drawing.diagram = Diagram.Diagram.fromXML(word, graphicDataChild);
134
+ break;
135
+ default:
136
+ console.warn('unknown graphicData child tag', graphicDataChild);
137
+ }
138
+ }
139
+ break;
140
+ case 'wp:extent':
141
+ containerStyle['width'] = parseSize.parseSize(child, 'cx', parseSize.LengthUsage.Emu);
142
+ containerStyle['height'] = parseSize.parseSize(child, 'cy', parseSize.LengthUsage.Emu);
143
+ break;
144
+ case 'wp:effectExtent':
145
+ // 目前也不支持特效
146
+ break;
147
+ case 'wp:wrapNone':
148
+ // TODO: 还不知道如何处理
149
+ // http://webapp.docx4java.org/OnlineDemo/ecma376/DrawingML/wrapNone.html
150
+ break;
151
+ case 'wp14:sizeRelH':
152
+ case 'wp14:sizeRelV':
153
+ // 还不知道是啥,文档都没
154
+ break;
155
+ default:
156
+ console.warn('drawing unknown tag', tagName);
157
+ }
158
+ }
159
+ }
160
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
161
+ finally {
162
+ try {
163
+ if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
164
+ }
165
+ finally { if (e_1) throw e_1.error; }
166
+ }
167
+ }
168
+ return drawing;
169
+ };
170
+ return Drawing;
171
+ }());
172
+
173
+ exports.Drawing = Drawing;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * 形状
3
+ */
4
+ import { ST_ShapeType } from '../Types';
5
+ import Word from '../../Word';
6
+ import { ShapeGuide } from './Shape';
7
+ export declare class Geom {
8
+ prst: ST_ShapeType;
9
+ avLst?: ShapeGuide[];
10
+ static fromXML(word: Word, element: Element): Geom;
11
+ }
@@ -0,0 +1,38 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var tslib = require('tslib');
6
+ var parseShape = require('../../parse/parseShape.js');
7
+
8
+ var Geom = /** @class */ (function () {
9
+ function Geom() {
10
+ }
11
+ Geom.fromXML = function (word, element) {
12
+ var e_1, _a;
13
+ var geom = new Geom();
14
+ geom.prst = element.getAttribute('prst');
15
+ try {
16
+ for (var _b = tslib.__values(element.children), _c = _b.next(); !_c.done; _c = _b.next()) {
17
+ var child = _c.value;
18
+ var tagName = child.tagName;
19
+ switch (tagName) {
20
+ case 'a:avLst': {
21
+ geom.avLst = parseShape.parseShapeGuide(child);
22
+ }
23
+ }
24
+ }
25
+ }
26
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
27
+ finally {
28
+ try {
29
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
30
+ }
31
+ finally { if (e_1) throw e_1.error; }
32
+ }
33
+ return geom;
34
+ };
35
+ return Geom;
36
+ }());
37
+
38
+ exports.Geom = Geom;
@@ -0,0 +1,37 @@
1
+ import { ST_PathFillMode } from '../Types';
2
+ export interface IPath {
3
+ type: 'moveTo' | 'lnTo' | 'arcTo' | 'cubicBezTo' | 'quadBezTo' | 'close';
4
+ }
5
+ export interface PathPoint {
6
+ x: string;
7
+ y: string;
8
+ }
9
+ export interface LnTo extends IPath {
10
+ pt: PathPoint;
11
+ }
12
+ export interface MoveTo extends IPath {
13
+ pt: PathPoint;
14
+ }
15
+ export interface ArcTo extends IPath {
16
+ wR: string;
17
+ hR: string;
18
+ stAng: string;
19
+ swAng: string;
20
+ }
21
+ export interface QuadBezTo extends IPath {
22
+ pts: PathPoint[];
23
+ }
24
+ export interface CubicBezTo extends IPath {
25
+ pts: PathPoint[];
26
+ }
27
+ export interface Close extends IPath {
28
+ }
29
+ export type ShapeDefine = MoveTo | LnTo | ArcTo | QuadBezTo | CubicBezTo | Close;
30
+ export interface Path {
31
+ h?: number;
32
+ w?: number;
33
+ fill?: ST_PathFillMode;
34
+ extrusionOk?: boolean;
35
+ stroke?: boolean;
36
+ defines: ShapeDefine[];
37
+ }
@@ -0,0 +1,16 @@
1
+ import Word from '../../Word';
2
+ import { BlipFill } from './BlipFill';
3
+ import { ShapePr } from './ShapeProperties';
4
+ export declare class Pic {
5
+ blipFill: BlipFill;
6
+ spPr: ShapePr;
7
+ /**
8
+ * 替换图片的地址
9
+ */
10
+ alt?: string;
11
+ /**
12
+ * 这个是前面变量替换后,系统自动生成的 alt 地址,用于循环里的变量
13
+ */
14
+ altVar?: string;
15
+ static fromXML(word: Word, element?: Element | null): Pic;
16
+ }
@@ -0,0 +1,30 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var OpenXML = require('../../OpenXML.js');
6
+ var BlipFill = require('./BlipFill.js');
7
+ var ShapeProperties = require('./ShapeProperties.js');
8
+
9
+ var Pic = /** @class */ (function () {
10
+ function Pic() {
11
+ }
12
+ Pic.fromXML = function (word, element) {
13
+ var pic = new Pic();
14
+ var cNvPr = element === null || element === void 0 ? void 0 : element.getElementsByTagName('pic:cNvPr').item(0);
15
+ if (cNvPr) {
16
+ pic.alt = cNvPr.getAttribute('descr') || '';
17
+ pic.altVar = cNvPr.getAttribute('descrVar') || '';
18
+ var hidden = OpenXML.getAttrBoolean(cNvPr, 'hidden', false);
19
+ if (hidden) {
20
+ return pic;
21
+ }
22
+ }
23
+ pic.blipFill = BlipFill.BlipFill.fromXML(word, element === null || element === void 0 ? void 0 : element.getElementsByTagName('pic:blipFill').item(0));
24
+ pic.spPr = ShapeProperties.ShapePr.fromXML(word, element === null || element === void 0 ? void 0 : element.getElementsByTagName('pic:spPr').item(0));
25
+ return pic;
26
+ };
27
+ return Pic;
28
+ }());
29
+
30
+ exports.Pic = Pic;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Shape 相关的定义
3
+ */
4
+ import { Path } from './Path';
5
+ export interface ShapeGuide {
6
+ n: string;
7
+ f: string;
8
+ }
9
+ export interface Rect {
10
+ b: string;
11
+ l: string;
12
+ r: string;
13
+ t: string;
14
+ }
15
+ export interface Shape {
16
+ avLst?: ShapeGuide[];
17
+ gdLst?: ShapeGuide[];
18
+ rect?: Rect;
19
+ pathLst?: Path[];
20
+ }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * http://webapp.docx4java.org/OnlineDemo/ecma376/DrawingML/spPr_2.html
3
+ */
4
+ import Word from '../../Word';
5
+ import { Transform } from './Transform';
6
+ import { Geom } from './Geom';
7
+ import { CustomGeom } from './CustomGeom';
8
+ export type OutLine = {
9
+ style?: 'solid' | 'dashed' | 'dotted' | string;
10
+ width?: string;
11
+ color?: string;
12
+ radius?: string;
13
+ };
14
+ export declare class ShapePr {
15
+ xfrm?: Transform;
16
+ geom?: Geom;
17
+ custGeom?: CustomGeom;
18
+ outline?: OutLine;
19
+ fillColor?: string;
20
+ noFill?: boolean;
21
+ static fromXML(word: Word, element?: Element | null): ShapePr;
22
+ }
@@ -0,0 +1,123 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var tslib = require('tslib');
6
+ var Transform = require('./Transform.js');
7
+ var parseSize = require('../../parse/parseSize.js');
8
+ var Geom = require('./Geom.js');
9
+ var parseChildColor = require('../../parse/parseChildColor.js');
10
+ var CustomGeom = require('./CustomGeom.js');
11
+
12
+ /**
13
+ * http://webapp.docx4java.org/OnlineDemo/ecma376/DrawingML/spPr_2.html
14
+ */
15
+ function prstDashToCSSBorderType(prstDash) {
16
+ var borderType = 'solid';
17
+ switch (prstDash) {
18
+ case 'dash':
19
+ case 'dashDot':
20
+ case 'lgDash':
21
+ case 'lgDashDot':
22
+ case 'lgDashDotDot':
23
+ case 'sysDash':
24
+ case 'sysDashDot':
25
+ case 'sysDashDotDot':
26
+ borderType = 'dashed';
27
+ break;
28
+ case 'dot':
29
+ case 'sysDot':
30
+ borderType = 'dotted';
31
+ break;
32
+ }
33
+ return borderType;
34
+ }
35
+ function parseOutline(word, element) {
36
+ var e_1, _a;
37
+ var borderWidth = parseSize.parseSize(element, 'w', parseSize.LengthUsage.Emu);
38
+ var outline = {
39
+ width: borderWidth
40
+ };
41
+ outline.style = 'solid';
42
+ try {
43
+ for (var _b = tslib.__values(element.children), _c = _b.next(); !_c.done; _c = _b.next()) {
44
+ var child = _c.value;
45
+ var tagName = child.tagName;
46
+ switch (tagName) {
47
+ case 'a:solidFill':
48
+ outline.color = parseChildColor.parseChildColor(word, child);
49
+ break;
50
+ case 'a:noFill':
51
+ outline.style = 'none';
52
+ break;
53
+ case 'a:round':
54
+ // 瞎写的,规范里也没写是多少
55
+ outline.radius = '8%';
56
+ break;
57
+ case 'a:prstDash':
58
+ outline.style = prstDashToCSSBorderType(child.getAttribute('val'));
59
+ break;
60
+ default:
61
+ console.warn('parseOutline: Unknown tag ', tagName, child);
62
+ }
63
+ }
64
+ }
65
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
66
+ finally {
67
+ try {
68
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
69
+ }
70
+ finally { if (e_1) throw e_1.error; }
71
+ }
72
+ return outline;
73
+ }
74
+ var ShapePr = /** @class */ (function () {
75
+ function ShapePr() {
76
+ }
77
+ ShapePr.fromXML = function (word, element) {
78
+ var e_2, _a;
79
+ var shapePr = new ShapePr();
80
+ if (element) {
81
+ try {
82
+ for (var _b = tslib.__values(element.children), _c = _b.next(); !_c.done; _c = _b.next()) {
83
+ var child = _c.value;
84
+ var tagName = child.tagName;
85
+ switch (tagName) {
86
+ case 'a:xfrm':
87
+ shapePr.xfrm = Transform.Transform.fromXML(word, child);
88
+ break;
89
+ case 'a:prstGeom':
90
+ shapePr.geom = Geom.Geom.fromXML(word, child);
91
+ break;
92
+ case 'a:custGeom':
93
+ shapePr.custGeom = CustomGeom.CustomGeom.fromXML(word, child);
94
+ break;
95
+ case 'a:ln':
96
+ // http://officeopenxml.com/drwSp-outline.php
97
+ shapePr.outline = parseOutline(word, child);
98
+ break;
99
+ case 'a:noFill':
100
+ shapePr.noFill = true;
101
+ break;
102
+ case 'a:solidFill':
103
+ shapePr.fillColor = parseChildColor.parseChildColor(word, child);
104
+ break;
105
+ default:
106
+ console.warn('ShapePr: Unknown tag ', tagName, child);
107
+ }
108
+ }
109
+ }
110
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
111
+ finally {
112
+ try {
113
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
114
+ }
115
+ finally { if (e_2) throw e_2.error; }
116
+ }
117
+ }
118
+ return shapePr;
119
+ };
120
+ return ShapePr;
121
+ }());
122
+
123
+ exports.ShapePr = ShapePr;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * http://webapp.docx4java.org/OnlineDemo/ecma376/DrawingML/xfrm_2.html
3
3
  */
4
- import Word from '../../../Word';
4
+ import Word from '../../Word';
5
5
  export interface Off {
6
6
  x: string;
7
7
  y: string;
@@ -13,5 +13,6 @@ export interface Ext {
13
13
  export declare class Transform {
14
14
  off?: Off;
15
15
  ext?: Ext;
16
+ rot?: number;
16
17
  static fromXML(word: Word, element: Element): Transform;
17
18
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var parseSize = require('../../../parse/parseSize.js');
5
+ var parseSize = require('../../parse/parseSize.js');
6
6
 
7
7
  /**
8
8
  * http://webapp.docx4java.org/OnlineDemo/ecma376/DrawingML/xfrm_2.html
@@ -12,20 +12,24 @@ var Transform = /** @class */ (function () {
12
12
  }
13
13
  Transform.fromXML = function (word, element) {
14
14
  var transform = new Transform();
15
- var off = element.querySelector('off');
15
+ var off = element.getElementsByTagName('a:off').item(0);
16
16
  if (off) {
17
17
  transform.off = {
18
18
  x: parseSize.parseSize(off, 'x', parseSize.LengthUsage.Emu),
19
19
  y: parseSize.parseSize(off, 'y', parseSize.LengthUsage.Emu)
20
20
  };
21
21
  }
22
- var ext = element.querySelector('ext');
22
+ var ext = element.getElementsByTagName('a:ext').item(0);
23
23
  if (ext) {
24
24
  transform.ext = {
25
25
  cx: parseSize.parseSize(ext, 'cx', parseSize.LengthUsage.Emu),
26
26
  cy: parseSize.parseSize(ext, 'cy', parseSize.LengthUsage.Emu)
27
27
  };
28
28
  }
29
+ var rot = element.getAttribute('rot');
30
+ if (rot) {
31
+ transform.rot = parseSize.convertAngle(rot);
32
+ }
29
33
  return transform;
30
34
  };
31
35
  return Transform;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * 图形,这块没啥文档说明,大部分是靠猜的
3
+ */
4
+ import Word from '../../../Word';
5
+ export declare class Diagram {
6
+ static fromXML(word: Word, relidsElement: Element): Diagram;
7
+ }