office-viewer 0.1.0 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -1
- package/esm/OpenXML.d.ts +19 -0
- package/esm/OpenXML.js +43 -2
- package/esm/Word.d.ts +132 -15
- package/esm/Word.js +239 -54
- package/esm/openxml/ContentType.js +20 -6
- package/esm/openxml/Settings.d.ts +10 -0
- package/esm/openxml/Settings.js +93 -0
- package/esm/openxml/Style.d.ts +1 -1
- package/esm/openxml/Style.js +12 -12
- package/esm/openxml/Theme.js +30 -6
- package/esm/openxml/Types.d.ts +179 -2472
- package/esm/openxml/drawing/Blip.d.ts +7 -0
- package/esm/openxml/{word/drawing → drawing}/Blip.js +2 -1
- package/{lib/openxml/word → esm/openxml}/drawing/BlipFill.d.ts +1 -1
- package/esm/openxml/{word/drawing → drawing}/BlipFill.js +1 -1
- package/esm/openxml/drawing/CustomGeom.d.ts +9 -0
- package/esm/openxml/drawing/CustomGeom.js +17 -0
- package/esm/openxml/drawing/Drawing.d.ts +37 -0
- package/esm/openxml/drawing/Drawing.js +173 -0
- package/esm/openxml/drawing/Geom.d.ts +11 -0
- package/esm/openxml/drawing/Geom.js +34 -0
- package/esm/openxml/drawing/Path.d.ts +37 -0
- package/esm/openxml/drawing/Pic.d.ts +16 -0
- package/esm/openxml/drawing/Pic.js +26 -0
- package/esm/openxml/drawing/Shape.d.ts +20 -0
- package/esm/openxml/drawing/ShapeProperties.d.ts +22 -0
- package/esm/openxml/drawing/ShapeProperties.js +119 -0
- package/{lib/openxml/word → esm/openxml}/drawing/Transform.d.ts +4 -1
- package/esm/openxml/drawing/Transform.js +63 -0
- package/esm/openxml/drawing/diagram/Diagram.d.ts +7 -0
- package/esm/openxml/drawing/diagram/Diagram.js +24 -0
- package/esm/openxml/drawing/diagram/Sp.d.ts +2 -0
- package/esm/openxml/drawing/diagram/SpTree.d.ts +5 -0
- package/esm/openxml/drawing/presetShape.d.ts +3 -0
- package/esm/openxml/drawing/presetShape.js +38785 -0
- package/esm/openxml/drawing/svg/arcToA.d.ts +13 -0
- package/esm/openxml/drawing/svg/arcToA.js +88 -0
- package/esm/openxml/drawing/svg/formulas.d.ts +29 -0
- package/esm/openxml/drawing/svg/formulas.js +103 -0
- package/esm/openxml/drawing/svg/generateDefines.d.ts +12 -0
- package/esm/openxml/drawing/svg/generateDefines.js +144 -0
- package/esm/openxml/drawing/svg/presetVal.d.ts +43 -0
- package/esm/openxml/drawing/svg/presetVal.js +53 -0
- package/esm/openxml/drawing/svg/shapeToSVG.d.ts +9 -0
- package/esm/openxml/drawing/svg/shapeToSVG.js +151 -0
- package/esm/openxml/math/OMath.d.ts +5 -0
- package/esm/openxml/math/OMath.js +12 -0
- package/esm/openxml/math/convertOOML.d.ts +4 -0
- package/esm/openxml/math/convertOOML.js +13 -0
- package/esm/openxml/math/xsl.d.ts +4 -0
- package/esm/openxml/math/xsl.js +8 -0
- package/esm/openxml/word/Body.js +11 -7
- package/esm/openxml/word/Break.js +1 -3
- package/esm/openxml/word/Font.d.ts +16 -0
- package/esm/openxml/word/Font.js +78 -0
- package/esm/openxml/word/FontTable.d.ts +9 -0
- package/esm/openxml/word/FontTable.js +34 -0
- package/esm/openxml/word/Header.d.ts +11 -0
- package/esm/openxml/word/Header.js +54 -0
- package/esm/openxml/word/Hyperlink.d.ts +1 -0
- package/esm/openxml/word/Hyperlink.js +7 -3
- package/esm/openxml/word/InlineText.js +1 -1
- package/esm/openxml/word/NoBreakHyphen.d.ts +2 -0
- package/esm/openxml/word/NoBreakHyphen.js +7 -0
- package/esm/openxml/word/Note.d.ts +12 -0
- package/esm/openxml/word/Note.js +48 -0
- package/esm/openxml/word/Paragraph.d.ts +2 -2
- package/esm/openxml/word/Paragraph.js +10 -9
- package/esm/openxml/word/Pict.d.ts +1 -2
- package/esm/openxml/word/Pict.js +5 -3
- package/esm/openxml/word/Ruby.js +1 -1
- package/esm/openxml/word/Run.d.ts +7 -3
- package/esm/openxml/word/Run.js +28 -4
- package/esm/openxml/word/Section.d.ts +18 -5
- package/esm/openxml/word/Section.js +46 -2
- package/esm/openxml/word/Separator.d.ts +5 -0
- package/esm/openxml/word/Separator.js +10 -0
- package/esm/openxml/word/SoftHyphen.d.ts +5 -0
- package/esm/openxml/word/SoftHyphen.js +10 -0
- package/esm/openxml/word/Tab.d.ts +1 -1
- package/esm/openxml/word/Table.d.ts +4 -9
- package/esm/openxml/word/Table.js +0 -235
- package/esm/openxml/word/WDocument.d.ts +1 -2
- package/esm/openxml/word/WDocument.js +53 -7
- package/esm/openxml/word/numbering/AbstractNum.js +4 -2
- package/esm/openxml/word/numbering/Lvl.js +10 -4
- package/esm/openxml/word/numbering/Num.js +12 -4
- package/esm/openxml/word/numbering/NumberProperties.js +2 -2
- package/esm/openxml/word/numbering/Numbering.js +1 -1
- package/esm/openxml/word/table/Tc.d.ts +1 -22
- package/esm/openxml/word/table/Tc.js +1 -221
- package/esm/openxml/word/table/Tr.d.ts +0 -5
- package/esm/openxml/word/table/Tr.js +0 -97
- package/esm/openxml/word/wps/WPG.d.ts +14 -0
- package/esm/openxml/word/wps/WPG.js +56 -0
- package/esm/openxml/word/wps/WPS.d.ts +18 -0
- package/esm/openxml/word/wps/WPS.js +148 -0
- package/esm/openxml/word/wps/WPSStyle.d.ts +10 -0
- package/esm/openxml/word/wps/WPSStyle.js +42 -0
- package/esm/package/PackageParser.d.ts +1 -1
- package/esm/package/XMLPackageParser.d.ts +3 -3
- package/esm/package/ZipPackageParser.d.ts +1 -1
- package/esm/package/ZipPackageParser.js +7 -8
- package/esm/parse/Footnotes.d.ts +3 -0
- package/esm/parse/Footnotes.js +25 -0
- package/esm/parse/colorNameMap.d.ts +6 -0
- package/esm/parse/colorNameMap.js +201 -0
- package/esm/parse/jcToTextAlign.js +1 -0
- package/esm/parse/mergeSdt.d.ts +4 -0
- package/esm/parse/mergeSdt.js +57 -0
- package/esm/parse/modifyColor.d.ts +1 -0
- package/esm/parse/modifyColor.js +106 -0
- package/esm/parse/parseBorder.js +2 -21
- package/esm/parse/parseCellMargin.d.ts +2 -0
- package/esm/parse/parseCellMargin.js +38 -0
- package/esm/parse/parseChildColor.d.ts +5 -0
- package/esm/parse/parseChildColor.js +66 -0
- package/esm/parse/parseColor.d.ts +4 -0
- package/esm/parse/parseColor.js +41 -46
- package/esm/parse/parseEndnotes.d.ts +3 -0
- package/esm/parse/parseEndnotes.js +25 -0
- package/esm/parse/parseFont.js +1 -1
- package/esm/parse/parseInsideBorders.d.ts +9 -0
- package/esm/parse/parseInsideBorders.js +24 -0
- package/esm/parse/parsePr.d.ts +3 -0
- package/esm/parse/parsePr.js +108 -11
- package/esm/parse/parseRelationship.js +1 -1
- package/esm/parse/parseSdt.d.ts +5 -0
- package/esm/parse/parseShape.d.ts +10 -0
- package/esm/parse/parseShape.js +239 -0
- package/esm/parse/parseSize.d.ts +2 -1
- package/esm/parse/parseSize.js +7 -1
- package/esm/parse/parseSpacing.js +1 -1
- package/esm/parse/parseTable.d.ts +3 -0
- package/esm/parse/parseTable.js +62 -0
- package/esm/parse/parseTablePr.d.ts +3 -0
- package/esm/parse/parseTablePr.js +185 -0
- package/esm/parse/parseTblWidth.d.ts +4 -0
- package/esm/parse/parseTblWidth.js +23 -0
- package/esm/parse/parseTc.d.ts +10 -0
- package/esm/parse/parseTc.js +64 -0
- package/esm/parse/parseTcPr.d.ts +5 -0
- package/esm/parse/parseTcPr.js +99 -0
- package/esm/parse/parseTextDirection.js +4 -6
- package/esm/parse/parseTr.d.ts +6 -0
- package/esm/parse/parseTr.js +49 -0
- package/esm/parse/parseTrPr.d.ts +3 -0
- package/esm/parse/parseTrPr.js +59 -0
- package/esm/render/fixAbsolutePosition.d.ts +8 -0
- package/esm/render/renderBody.d.ts +6 -2
- package/esm/render/renderBody.js +184 -30
- package/esm/render/renderBr.d.ts +2 -1
- package/esm/render/renderBr.js +4 -1
- package/esm/render/renderCustGeom.d.ts +4 -0
- package/esm/render/renderCustGeom.js +10 -0
- package/esm/render/renderDocument.d.ts +2 -2
- package/esm/render/renderDocument.js +2 -2
- package/esm/render/renderDrawing.d.ts +3 -2
- package/esm/render/renderDrawing.js +238 -21
- package/esm/render/renderFont.d.ts +5 -0
- package/esm/render/renderFont.js +39 -0
- package/esm/render/renderGeom.d.ts +4 -0
- package/esm/render/renderGeom.js +14 -0
- package/esm/render/renderHeader.d.ts +6 -0
- package/esm/render/renderHeader.js +40 -0
- package/esm/render/renderHyperLink.js +4 -1
- package/esm/render/renderInlineText.js +1 -1
- package/esm/render/renderInstrText.js +1 -1
- package/esm/render/renderMath.d.ts +3 -0
- package/esm/render/renderMath.js +7 -0
- package/esm/render/renderNoBreakHyphen.d.ts +1 -0
- package/esm/render/renderNoBreakHyphen.js +9 -0
- package/esm/render/renderNotes.d.ts +5 -0
- package/esm/render/renderNotes.js +77 -0
- package/esm/render/renderNumbering.js +8 -10
- package/esm/render/renderParagraph.d.ts +1 -1
- package/esm/render/renderParagraph.js +58 -18
- package/esm/render/renderPict.js +5 -10
- package/esm/render/renderRuby.js +1 -1
- package/esm/render/renderRun.d.ts +4 -2
- package/esm/render/renderRun.js +42 -12
- package/esm/render/renderSection.d.ts +3 -2
- package/esm/render/renderSection.js +79 -5
- package/esm/render/renderSeparator.d.ts +1 -0
- package/esm/render/renderSeparator.js +9 -0
- package/esm/render/renderSoftHyphen.d.ts +1 -0
- package/esm/render/renderSoftHyphen.js +9 -0
- package/esm/render/renderStyle.js +36 -35
- package/esm/render/renderTab.d.ts +2 -1
- package/esm/render/renderTab.js +10 -6
- package/esm/render/renderTable.js +23 -20
- package/esm/render/setElementStyle.js +7 -2
- package/esm/render/zindex.d.ts +1 -0
- package/esm/util/blob.js +1 -10
- package/esm/util/color.d.ts +48 -0
- package/esm/util/color.js +211 -0
- package/esm/util/createObject.d.ts +10 -0
- package/esm/util/createObject.js +48 -0
- package/esm/util/dom.d.ts +8 -4
- package/esm/util/dom.js +21 -4
- package/esm/util/get.d.ts +4 -0
- package/esm/util/get.js +18 -0
- package/esm/util/mergeRun.js +1 -1
- package/esm/util/parseSides.d.ts +11 -0
- package/esm/util/print.d.ts +5 -0
- package/esm/util/print.js +54 -0
- package/esm/util/replaceVar.d.ts +10 -0
- package/esm/util/replaceVar.js +215 -0
- package/esm/util/xml.js +4 -1
- package/lib/OpenXML.d.ts +19 -0
- package/lib/OpenXML.js +44 -1
- package/lib/Word.d.ts +132 -15
- package/lib/Word.js +244 -59
- package/lib/openxml/ContentType.js +20 -6
- package/lib/openxml/Settings.d.ts +10 -0
- package/lib/openxml/Settings.js +97 -0
- package/lib/openxml/Style.d.ts +1 -1
- package/lib/openxml/Style.js +15 -15
- package/lib/openxml/Theme.js +31 -7
- package/lib/openxml/Types.d.ts +179 -2472
- package/lib/openxml/drawing/Blip.d.ts +7 -0
- package/lib/openxml/{word/drawing → drawing}/Blip.js +2 -1
- package/{esm/openxml/word → lib/openxml}/drawing/BlipFill.d.ts +1 -1
- package/lib/openxml/{word/drawing → drawing}/BlipFill.js +1 -1
- package/lib/openxml/drawing/CustomGeom.d.ts +9 -0
- package/lib/openxml/drawing/CustomGeom.js +21 -0
- package/lib/openxml/drawing/Drawing.d.ts +37 -0
- package/lib/openxml/drawing/Drawing.js +177 -0
- package/lib/openxml/drawing/Geom.d.ts +11 -0
- package/lib/openxml/drawing/Geom.js +38 -0
- package/lib/openxml/drawing/Path.d.ts +37 -0
- package/lib/openxml/drawing/Pic.d.ts +16 -0
- package/lib/openxml/drawing/Pic.js +30 -0
- package/lib/openxml/drawing/Shape.d.ts +20 -0
- package/lib/openxml/drawing/ShapeProperties.d.ts +22 -0
- package/lib/openxml/drawing/ShapeProperties.js +123 -0
- package/{esm/openxml/word → lib/openxml}/drawing/Transform.d.ts +4 -1
- package/lib/openxml/drawing/Transform.js +67 -0
- package/lib/openxml/drawing/diagram/Diagram.d.ts +7 -0
- package/lib/openxml/drawing/diagram/Diagram.js +28 -0
- package/lib/openxml/drawing/diagram/Sp.d.ts +2 -0
- package/lib/openxml/drawing/diagram/SpTree.d.ts +5 -0
- package/lib/openxml/drawing/presetShape.d.ts +3 -0
- package/lib/openxml/drawing/presetShape.js +38789 -0
- package/lib/openxml/drawing/svg/arcToA.d.ts +13 -0
- package/lib/openxml/drawing/svg/arcToA.js +92 -0
- package/lib/openxml/drawing/svg/formulas.d.ts +29 -0
- package/lib/openxml/drawing/svg/formulas.js +108 -0
- package/lib/openxml/drawing/svg/generateDefines.d.ts +12 -0
- package/lib/openxml/drawing/svg/generateDefines.js +148 -0
- package/lib/openxml/drawing/svg/presetVal.d.ts +43 -0
- package/lib/openxml/drawing/svg/presetVal.js +57 -0
- package/lib/openxml/drawing/svg/shapeToSVG.d.ts +9 -0
- package/lib/openxml/drawing/svg/shapeToSVG.js +155 -0
- package/lib/openxml/math/OMath.d.ts +5 -0
- package/lib/openxml/math/OMath.js +16 -0
- package/lib/openxml/math/convertOOML.d.ts +4 -0
- package/lib/openxml/math/convertOOML.js +17 -0
- package/lib/openxml/math/xsl.d.ts +4 -0
- package/lib/openxml/math/xsl.js +12 -0
- package/lib/openxml/word/Body.js +11 -7
- package/lib/openxml/word/Break.js +1 -3
- package/lib/openxml/word/Font.d.ts +16 -0
- package/lib/openxml/word/Font.js +83 -0
- package/lib/openxml/word/FontTable.d.ts +9 -0
- package/lib/openxml/word/FontTable.js +38 -0
- package/lib/openxml/word/Header.d.ts +11 -0
- package/lib/openxml/word/Header.js +58 -0
- package/lib/openxml/word/Hyperlink.d.ts +1 -0
- package/lib/openxml/word/Hyperlink.js +8 -4
- package/lib/openxml/word/InlineText.js +2 -2
- package/lib/openxml/word/NoBreakHyphen.d.ts +2 -0
- package/lib/openxml/word/NoBreakHyphen.js +11 -0
- package/lib/openxml/word/Note.d.ts +12 -0
- package/lib/openxml/word/Note.js +52 -0
- package/lib/openxml/word/Paragraph.d.ts +2 -2
- package/lib/openxml/word/Paragraph.js +11 -10
- package/lib/openxml/word/Pict.d.ts +1 -2
- package/lib/openxml/word/Pict.js +5 -3
- package/lib/openxml/word/Ruby.js +4 -4
- package/lib/openxml/word/Run.d.ts +7 -3
- package/lib/openxml/word/Run.js +29 -5
- package/lib/openxml/word/Section.d.ts +18 -5
- package/lib/openxml/word/Section.js +47 -3
- package/lib/openxml/word/Separator.d.ts +5 -0
- package/lib/openxml/word/Separator.js +14 -0
- package/lib/openxml/word/SoftHyphen.d.ts +5 -0
- package/lib/openxml/word/SoftHyphen.js +14 -0
- package/lib/openxml/word/Tab.d.ts +1 -1
- package/lib/openxml/word/Table.d.ts +4 -9
- package/lib/openxml/word/Table.js +0 -235
- package/lib/openxml/word/WDocument.d.ts +1 -2
- package/lib/openxml/word/WDocument.js +53 -7
- package/lib/openxml/word/numbering/AbstractNum.js +5 -3
- package/lib/openxml/word/numbering/Lvl.js +11 -5
- package/lib/openxml/word/numbering/Num.js +12 -4
- package/lib/openxml/word/numbering/NumberProperties.js +2 -2
- package/lib/openxml/word/numbering/Numbering.js +3 -3
- package/lib/openxml/word/table/Tc.d.ts +1 -22
- package/lib/openxml/word/table/Tc.js +0 -224
- package/lib/openxml/word/table/Tr.d.ts +0 -5
- package/lib/openxml/word/table/Tr.js +0 -97
- package/lib/openxml/word/wps/WPG.d.ts +14 -0
- package/lib/openxml/word/wps/WPG.js +60 -0
- package/lib/openxml/word/wps/WPS.d.ts +18 -0
- package/lib/openxml/word/wps/WPS.js +152 -0
- package/lib/openxml/word/wps/WPSStyle.d.ts +10 -0
- package/lib/openxml/word/wps/WPSStyle.js +46 -0
- package/lib/package/PackageParser.d.ts +1 -1
- package/lib/package/XMLPackageParser.d.ts +3 -3
- package/lib/package/ZipPackageParser.d.ts +1 -1
- package/lib/package/ZipPackageParser.js +7 -8
- package/lib/parse/Footnotes.d.ts +3 -0
- package/lib/parse/Footnotes.js +29 -0
- package/lib/parse/colorNameMap.d.ts +6 -0
- package/lib/parse/colorNameMap.js +205 -0
- package/lib/parse/jcToTextAlign.js +1 -0
- package/lib/parse/mergeSdt.d.ts +4 -0
- package/lib/parse/mergeSdt.js +61 -0
- package/lib/parse/modifyColor.d.ts +1 -0
- package/lib/parse/modifyColor.js +110 -0
- package/lib/parse/parseBorder.js +3 -22
- package/lib/parse/parseCellMargin.d.ts +2 -0
- package/lib/parse/parseCellMargin.js +42 -0
- package/lib/parse/parseChildColor.d.ts +5 -0
- package/lib/parse/parseChildColor.js +70 -0
- package/lib/parse/parseColor.d.ts +4 -0
- package/lib/parse/parseColor.js +41 -45
- package/lib/parse/parseEndnotes.d.ts +3 -0
- package/lib/parse/parseEndnotes.js +29 -0
- package/lib/parse/parseFont.js +2 -2
- package/lib/parse/parseInsideBorders.d.ts +9 -0
- package/lib/parse/parseInsideBorders.js +28 -0
- package/lib/parse/parsePr.d.ts +3 -0
- package/lib/parse/parsePr.js +109 -12
- package/lib/parse/parseRelationship.js +2 -2
- package/lib/parse/parseSdt.d.ts +5 -0
- package/lib/parse/parseShape.d.ts +10 -0
- package/lib/parse/parseShape.js +247 -0
- package/lib/parse/parseSize.d.ts +2 -1
- package/lib/parse/parseSize.js +7 -0
- package/lib/parse/parseSpacing.js +1 -1
- package/lib/parse/parseTable.d.ts +3 -0
- package/lib/parse/parseTable.js +66 -0
- package/lib/parse/parseTablePr.d.ts +3 -0
- package/lib/parse/parseTablePr.js +189 -0
- package/lib/parse/parseTblWidth.d.ts +4 -0
- package/lib/parse/parseTblWidth.js +27 -0
- package/lib/parse/parseTc.d.ts +10 -0
- package/lib/parse/parseTc.js +68 -0
- package/lib/parse/parseTcPr.d.ts +5 -0
- package/lib/parse/parseTcPr.js +104 -0
- package/lib/parse/parseTextDirection.js +4 -6
- package/lib/parse/parseTr.d.ts +6 -0
- package/lib/parse/parseTr.js +53 -0
- package/lib/parse/parseTrPr.d.ts +3 -0
- package/lib/parse/parseTrPr.js +63 -0
- package/lib/render/fixAbsolutePosition.d.ts +8 -0
- package/lib/render/renderBody.d.ts +6 -2
- package/lib/render/renderBody.js +183 -29
- package/lib/render/renderBr.d.ts +2 -1
- package/lib/render/renderBr.js +4 -1
- package/lib/render/renderCustGeom.d.ts +4 -0
- package/lib/render/renderCustGeom.js +14 -0
- package/lib/render/renderDocument.d.ts +2 -2
- package/lib/render/renderDocument.js +2 -2
- package/lib/render/renderDrawing.d.ts +3 -2
- package/lib/render/renderDrawing.js +238 -21
- package/lib/render/renderFont.d.ts +5 -0
- package/lib/render/renderFont.js +43 -0
- package/lib/render/renderGeom.d.ts +4 -0
- package/lib/render/renderGeom.js +18 -0
- package/lib/render/renderHeader.d.ts +6 -0
- package/lib/render/renderHeader.js +44 -0
- package/lib/render/renderHyperLink.js +5 -2
- package/lib/render/renderInlineText.js +2 -2
- package/lib/render/renderInstrText.js +2 -2
- package/lib/render/renderMath.d.ts +3 -0
- package/lib/render/renderMath.js +11 -0
- package/lib/render/renderNoBreakHyphen.d.ts +1 -0
- package/lib/render/renderNoBreakHyphen.js +13 -0
- package/lib/render/renderNotes.d.ts +5 -0
- package/lib/render/renderNotes.js +81 -0
- package/lib/render/renderNumbering.js +9 -11
- package/lib/render/renderParagraph.d.ts +1 -1
- package/lib/render/renderParagraph.js +58 -18
- package/lib/render/renderPict.js +5 -10
- package/lib/render/renderRuby.js +3 -3
- package/lib/render/renderRun.d.ts +4 -2
- package/lib/render/renderRun.js +41 -11
- package/lib/render/renderSection.d.ts +3 -2
- package/lib/render/renderSection.js +79 -5
- package/lib/render/renderSeparator.d.ts +1 -0
- package/lib/render/renderSeparator.js +13 -0
- package/lib/render/renderSoftHyphen.d.ts +1 -0
- package/lib/render/renderSoftHyphen.js +13 -0
- package/lib/render/renderStyle.js +37 -36
- package/lib/render/renderTab.d.ts +2 -1
- package/lib/render/renderTab.js +10 -6
- package/lib/render/renderTable.js +25 -22
- package/lib/render/setElementStyle.js +6 -1
- package/lib/render/zindex.d.ts +1 -0
- package/lib/util/blob.js +0 -10
- package/lib/util/color.d.ts +48 -0
- package/lib/util/color.js +215 -0
- package/lib/util/createObject.d.ts +10 -0
- package/lib/util/createObject.js +54 -0
- package/lib/util/dom.d.ts +8 -4
- package/lib/util/dom.js +24 -5
- package/lib/util/get.d.ts +4 -0
- package/lib/util/get.js +22 -0
- package/lib/util/mergeRun.js +5 -5
- package/lib/util/parseSides.d.ts +11 -0
- package/lib/util/print.d.ts +5 -0
- package/lib/util/print.js +58 -0
- package/lib/util/replaceVar.d.ts +10 -0
- package/lib/util/replaceVar.js +220 -0
- package/lib/util/xml.js +4 -0
- package/package.json +17 -7
- package/esm/node_modules/tslib/tslib.es6.js +0 -120
- package/esm/openxml/Types.js +0 -1003
- package/esm/openxml/word/CustomXml.d.ts +0 -8
- package/esm/openxml/word/SmartTag.d.ts +0 -8
- package/esm/openxml/word/SmartTag.js +0 -18
- package/esm/openxml/word/drawing/Blip.d.ts +0 -6
- package/esm/openxml/word/drawing/Drawing.d.ts +0 -6
- package/esm/openxml/word/drawing/Drawing.js +0 -15
- package/esm/openxml/word/drawing/Pic.d.ts +0 -8
- package/esm/openxml/word/drawing/Pic.js +0 -16
- package/esm/openxml/word/drawing/ShapeProperties.d.ts +0 -9
- package/esm/openxml/word/drawing/ShapeProperties.js +0 -20
- package/esm/openxml/word/drawing/Transform.js +0 -30
- package/lib/node_modules/tslib/tslib.es6.js +0 -129
- package/lib/openxml/Types.js +0 -1005
- package/lib/openxml/word/CustomXml.d.ts +0 -8
- package/lib/openxml/word/SmartTag.d.ts +0 -8
- package/lib/openxml/word/SmartTag.js +0 -22
- package/lib/openxml/word/drawing/Blip.d.ts +0 -6
- package/lib/openxml/word/drawing/Drawing.d.ts +0 -6
- package/lib/openxml/word/drawing/Drawing.js +0 -19
- package/lib/openxml/word/drawing/Pic.d.ts +0 -8
- package/lib/openxml/word/drawing/Pic.js +0 -20
- package/lib/openxml/word/drawing/ShapeProperties.d.ts +0 -9
- package/lib/openxml/word/drawing/ShapeProperties.js +0 -24
- package/lib/openxml/word/drawing/Transform.js +0 -34
|
@@ -5,9 +5,10 @@ var Blip = /** @class */ (function () {
|
|
|
5
5
|
var blip = new Blip();
|
|
6
6
|
// 目前值支持 embed 这一种
|
|
7
7
|
var embedId = element.getAttribute('r:embed') || '';
|
|
8
|
-
var rel = word.
|
|
8
|
+
var rel = word.getDocumentRels(embedId);
|
|
9
9
|
if (rel) {
|
|
10
10
|
blip.embled = rel;
|
|
11
|
+
blip.src = word.loadImage(blip.embled);
|
|
11
12
|
}
|
|
12
13
|
return blip;
|
|
13
14
|
};
|
|
@@ -8,7 +8,7 @@ var BlipFill = /** @class */ (function () {
|
|
|
8
8
|
}
|
|
9
9
|
BlipFill.fromXML = function (word, element) {
|
|
10
10
|
var blipFill = new BlipFill();
|
|
11
|
-
var blip = element === null || element === void 0 ? void 0 : element.
|
|
11
|
+
var blip = element === null || element === void 0 ? void 0 : element.getElementsByTagName('a:blip').item(0);
|
|
12
12
|
if (blip) {
|
|
13
13
|
blipFill.blip = Blip.fromXML(word, blip);
|
|
14
14
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { parseShape } from '../../parse/parseShape.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 自定义形状
|
|
5
|
+
*/
|
|
6
|
+
var CustomGeom = /** @class */ (function () {
|
|
7
|
+
function CustomGeom() {
|
|
8
|
+
}
|
|
9
|
+
CustomGeom.fromXML = function (word, element) {
|
|
10
|
+
var geom = new CustomGeom();
|
|
11
|
+
geom.shape = parseShape(element);
|
|
12
|
+
return geom;
|
|
13
|
+
};
|
|
14
|
+
return CustomGeom;
|
|
15
|
+
}());
|
|
16
|
+
|
|
17
|
+
export { CustomGeom };
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
import { WPG } from '../word/wps/WPG';
|
|
9
|
+
/**
|
|
10
|
+
* drawing 在文档中的位置,目前有两种情况,child 和 anchor
|
|
11
|
+
*/
|
|
12
|
+
export declare enum Position {
|
|
13
|
+
inline = "inline",
|
|
14
|
+
anchor = "anchor"
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 有大量属性不好通过 css 来实现
|
|
18
|
+
* http://webapp.docx4java.org/OnlineDemo/ecma376/DrawingML/anchor_2.html
|
|
19
|
+
*/
|
|
20
|
+
export interface Anchor {
|
|
21
|
+
simplePos: boolean;
|
|
22
|
+
hidden?: boolean;
|
|
23
|
+
behindDoc?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export declare class Drawing {
|
|
26
|
+
pic?: Pic;
|
|
27
|
+
wps?: WPS;
|
|
28
|
+
wpg?: WPG;
|
|
29
|
+
diagram?: ConstrainDOMStringParameters;
|
|
30
|
+
position: Position;
|
|
31
|
+
anchor?: Anchor;
|
|
32
|
+
containerStyle?: CSSStyle;
|
|
33
|
+
relativeFromV: 'paragraph' | 'page';
|
|
34
|
+
id?: string;
|
|
35
|
+
name?: string;
|
|
36
|
+
static fromXML(word: Word, element: Element): Drawing | null;
|
|
37
|
+
}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { __values } from 'tslib';
|
|
2
|
+
import { parseSize, LengthUsage, convertLength } from '../../parse/parseSize.js';
|
|
3
|
+
import { getAttrNumber, getAttrBoolean } from '../../OpenXML.js';
|
|
4
|
+
import { Pic } from './Pic.js';
|
|
5
|
+
import { WPS } from '../word/wps/WPS.js';
|
|
6
|
+
import { Diagram } from './diagram/Diagram.js';
|
|
7
|
+
import { WPG } from '../word/wps/WPG.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* 目前图片和 textbox 都会依赖这个
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* drawing 在文档中的位置,目前有两种情况,child 和 anchor
|
|
14
|
+
*/
|
|
15
|
+
var Position;
|
|
16
|
+
(function (Position) {
|
|
17
|
+
Position["inline"] = "inline";
|
|
18
|
+
Position["anchor"] = "anchor";
|
|
19
|
+
})(Position || (Position = {}));
|
|
20
|
+
function parseAnchor(element) {
|
|
21
|
+
var simplePos = getAttrBoolean(element, 'simplePos', false);
|
|
22
|
+
var hidden = getAttrBoolean(element, 'hidden', false);
|
|
23
|
+
var behindDoc = getAttrBoolean(element, 'behindDoc', false);
|
|
24
|
+
return {
|
|
25
|
+
simplePos: simplePos,
|
|
26
|
+
hidden: hidden,
|
|
27
|
+
behindDoc: behindDoc
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
var Drawing = /** @class */ (function () {
|
|
31
|
+
function Drawing() {
|
|
32
|
+
// drawing 的位置配置
|
|
33
|
+
this.position = Position.inline;
|
|
34
|
+
}
|
|
35
|
+
Drawing.fromXML = function (word, element) {
|
|
36
|
+
var e_1, _a;
|
|
37
|
+
var _b;
|
|
38
|
+
var drawing = new Drawing();
|
|
39
|
+
var containerStyle = {};
|
|
40
|
+
drawing.containerStyle = containerStyle;
|
|
41
|
+
var position = element.firstElementChild;
|
|
42
|
+
if (position) {
|
|
43
|
+
if (position.tagName === 'wp:anchor') {
|
|
44
|
+
drawing.position = Position.anchor;
|
|
45
|
+
drawing.anchor = parseAnchor(position);
|
|
46
|
+
var relativeHeight = getAttrNumber(position, 'relativeHeight', 1);
|
|
47
|
+
containerStyle['z-index'] = relativeHeight;
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
for (var _c = __values(position.children), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
51
|
+
var child = _d.value;
|
|
52
|
+
var tagName = child.tagName;
|
|
53
|
+
switch (tagName) {
|
|
54
|
+
case 'wp:simplePos':
|
|
55
|
+
// 只有设置了 simplePos 才会生效
|
|
56
|
+
// 据说 word 其实不支持这个属性,所以目前实现估计没啥用
|
|
57
|
+
if ((_b = drawing.anchor) === null || _b === void 0 ? void 0 : _b.simplePos) {
|
|
58
|
+
containerStyle['position'] = 'absolute';
|
|
59
|
+
containerStyle['x'] = parseSize(child, 'x', LengthUsage.Emu);
|
|
60
|
+
containerStyle['y'] = parseSize(child, 'y', LengthUsage.Emu);
|
|
61
|
+
}
|
|
62
|
+
break;
|
|
63
|
+
case 'wp:positionH':
|
|
64
|
+
var relativeFromH = child.getAttribute('relativeFrom');
|
|
65
|
+
if (relativeFromH === 'column' ||
|
|
66
|
+
relativeFromH === 'page' ||
|
|
67
|
+
relativeFromH === 'margin') {
|
|
68
|
+
var positionType = child.firstElementChild;
|
|
69
|
+
if (positionType) {
|
|
70
|
+
var positionTypeTagName = positionType.tagName;
|
|
71
|
+
containerStyle['position'] = 'absolute';
|
|
72
|
+
if (positionTypeTagName === 'wp:posOffset') {
|
|
73
|
+
containerStyle['left'] = convertLength(positionType.innerHTML, LengthUsage.Emu);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
containerStyle['left'] = '0';
|
|
77
|
+
console.warn('unsupport positionType', positionTypeTagName);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
console.warn('unsupport positionH relativeFrom', relativeFromH);
|
|
83
|
+
}
|
|
84
|
+
break;
|
|
85
|
+
case 'wp:positionV':
|
|
86
|
+
var relativeFromV = child.getAttribute('relativeFrom');
|
|
87
|
+
if (relativeFromV === 'paragraph' || relativeFromV === 'page') {
|
|
88
|
+
drawing.relativeFromV = relativeFromV;
|
|
89
|
+
var positionType = child.firstElementChild;
|
|
90
|
+
if (positionType) {
|
|
91
|
+
var positionTypeTagName = positionType.tagName;
|
|
92
|
+
containerStyle['position'] = 'absolute';
|
|
93
|
+
if (positionTypeTagName === 'wp:posOffset') {
|
|
94
|
+
containerStyle['top'] = convertLength(positionType.innerHTML, LengthUsage.Emu);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
containerStyle['top'] = '0';
|
|
98
|
+
console.warn('unsupport positionType', positionTypeTagName);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
console.warn('unsupport positionV relativeFrom', relativeFromV);
|
|
104
|
+
}
|
|
105
|
+
break;
|
|
106
|
+
case 'wp:docPr':
|
|
107
|
+
drawing.id = child.getAttribute('id') || undefined;
|
|
108
|
+
drawing.name = child.getAttribute('name') || undefined;
|
|
109
|
+
break;
|
|
110
|
+
case 'wp:cNvGraphicFramePr':
|
|
111
|
+
// 和展现无关
|
|
112
|
+
// http://webapp.docx4java.org/OnlineDemo/ecma376/DrawingML/docPr.html
|
|
113
|
+
// http://webapp.docx4java.org/OnlineDemo/ecma376/DrawingML/cNvGraphicFramePr_1.html
|
|
114
|
+
break;
|
|
115
|
+
case 'a:graphic':
|
|
116
|
+
var graphicData = child.firstElementChild;
|
|
117
|
+
var graphicDataChild = graphicData === null || graphicData === void 0 ? void 0 : graphicData.firstElementChild;
|
|
118
|
+
if (graphicDataChild) {
|
|
119
|
+
var graphicDataChildTagName = graphicDataChild.tagName;
|
|
120
|
+
switch (graphicDataChildTagName) {
|
|
121
|
+
case 'pic:pic':
|
|
122
|
+
drawing.pic = Pic.fromXML(word, graphicDataChild);
|
|
123
|
+
break;
|
|
124
|
+
case 'wps:wsp':
|
|
125
|
+
drawing.wps = WPS.fromXML(word, graphicDataChild);
|
|
126
|
+
break;
|
|
127
|
+
case 'wpg:wgp':
|
|
128
|
+
drawing.wpg = WPG.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.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(child, 'cx', LengthUsage.Emu);
|
|
142
|
+
containerStyle['height'] = parseSize(child, 'cy', 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
|
+
export { Drawing, Position };
|
|
@@ -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,34 @@
|
|
|
1
|
+
import { __values } from 'tslib';
|
|
2
|
+
import { parseShapeGuide } from '../../parse/parseShape.js';
|
|
3
|
+
|
|
4
|
+
var Geom = /** @class */ (function () {
|
|
5
|
+
function Geom() {
|
|
6
|
+
}
|
|
7
|
+
Geom.fromXML = function (word, element) {
|
|
8
|
+
var e_1, _a;
|
|
9
|
+
var geom = new Geom();
|
|
10
|
+
geom.prst = element.getAttribute('prst');
|
|
11
|
+
try {
|
|
12
|
+
for (var _b = __values(element.children), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
13
|
+
var child = _c.value;
|
|
14
|
+
var tagName = child.tagName;
|
|
15
|
+
switch (tagName) {
|
|
16
|
+
case 'a:avLst': {
|
|
17
|
+
geom.avLst = parseShapeGuide(child);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
23
|
+
finally {
|
|
24
|
+
try {
|
|
25
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
26
|
+
}
|
|
27
|
+
finally { if (e_1) throw e_1.error; }
|
|
28
|
+
}
|
|
29
|
+
return geom;
|
|
30
|
+
};
|
|
31
|
+
return Geom;
|
|
32
|
+
}());
|
|
33
|
+
|
|
34
|
+
export { 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,26 @@
|
|
|
1
|
+
import { getAttrBoolean } from '../../OpenXML.js';
|
|
2
|
+
import { BlipFill } from './BlipFill.js';
|
|
3
|
+
import { ShapePr } from './ShapeProperties.js';
|
|
4
|
+
|
|
5
|
+
var Pic = /** @class */ (function () {
|
|
6
|
+
function Pic() {
|
|
7
|
+
}
|
|
8
|
+
Pic.fromXML = function (word, element) {
|
|
9
|
+
var pic = new Pic();
|
|
10
|
+
var cNvPr = element === null || element === void 0 ? void 0 : element.getElementsByTagName('pic:cNvPr').item(0);
|
|
11
|
+
if (cNvPr) {
|
|
12
|
+
pic.alt = cNvPr.getAttribute('descr') || '';
|
|
13
|
+
pic.altVar = cNvPr.getAttribute('descrVar') || '';
|
|
14
|
+
var hidden = getAttrBoolean(cNvPr, 'hidden', false);
|
|
15
|
+
if (hidden) {
|
|
16
|
+
return pic;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
pic.blipFill = BlipFill.fromXML(word, element === null || element === void 0 ? void 0 : element.getElementsByTagName('pic:blipFill').item(0));
|
|
20
|
+
pic.spPr = ShapePr.fromXML(word, element === null || element === void 0 ? void 0 : element.getElementsByTagName('pic:spPr').item(0));
|
|
21
|
+
return pic;
|
|
22
|
+
};
|
|
23
|
+
return Pic;
|
|
24
|
+
}());
|
|
25
|
+
|
|
26
|
+
export { 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,119 @@
|
|
|
1
|
+
import { __values } from 'tslib';
|
|
2
|
+
import { Transform } from './Transform.js';
|
|
3
|
+
import { parseSize, LengthUsage } from '../../parse/parseSize.js';
|
|
4
|
+
import { Geom } from './Geom.js';
|
|
5
|
+
import { parseChildColor } from '../../parse/parseChildColor.js';
|
|
6
|
+
import { CustomGeom } from './CustomGeom.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* http://webapp.docx4java.org/OnlineDemo/ecma376/DrawingML/spPr_2.html
|
|
10
|
+
*/
|
|
11
|
+
function prstDashToCSSBorderType(prstDash) {
|
|
12
|
+
var borderType = 'solid';
|
|
13
|
+
switch (prstDash) {
|
|
14
|
+
case 'dash':
|
|
15
|
+
case 'dashDot':
|
|
16
|
+
case 'lgDash':
|
|
17
|
+
case 'lgDashDot':
|
|
18
|
+
case 'lgDashDotDot':
|
|
19
|
+
case 'sysDash':
|
|
20
|
+
case 'sysDashDot':
|
|
21
|
+
case 'sysDashDotDot':
|
|
22
|
+
borderType = 'dashed';
|
|
23
|
+
break;
|
|
24
|
+
case 'dot':
|
|
25
|
+
case 'sysDot':
|
|
26
|
+
borderType = 'dotted';
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
return borderType;
|
|
30
|
+
}
|
|
31
|
+
function parseOutline(word, element) {
|
|
32
|
+
var e_1, _a;
|
|
33
|
+
var borderWidth = parseSize(element, 'w', LengthUsage.Emu);
|
|
34
|
+
var outline = {
|
|
35
|
+
width: borderWidth
|
|
36
|
+
};
|
|
37
|
+
outline.style = 'solid';
|
|
38
|
+
try {
|
|
39
|
+
for (var _b = __values(element.children), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
40
|
+
var child = _c.value;
|
|
41
|
+
var tagName = child.tagName;
|
|
42
|
+
switch (tagName) {
|
|
43
|
+
case 'a:solidFill':
|
|
44
|
+
outline.color = parseChildColor(word, child);
|
|
45
|
+
break;
|
|
46
|
+
case 'a:noFill':
|
|
47
|
+
outline.style = 'none';
|
|
48
|
+
break;
|
|
49
|
+
case 'a:round':
|
|
50
|
+
// 瞎写的,规范里也没写是多少
|
|
51
|
+
outline.radius = '8%';
|
|
52
|
+
break;
|
|
53
|
+
case 'a:prstDash':
|
|
54
|
+
outline.style = prstDashToCSSBorderType(child.getAttribute('val'));
|
|
55
|
+
break;
|
|
56
|
+
default:
|
|
57
|
+
console.warn('parseOutline: Unknown tag ', tagName, child);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
62
|
+
finally {
|
|
63
|
+
try {
|
|
64
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
65
|
+
}
|
|
66
|
+
finally { if (e_1) throw e_1.error; }
|
|
67
|
+
}
|
|
68
|
+
return outline;
|
|
69
|
+
}
|
|
70
|
+
var ShapePr = /** @class */ (function () {
|
|
71
|
+
function ShapePr() {
|
|
72
|
+
}
|
|
73
|
+
ShapePr.fromXML = function (word, element) {
|
|
74
|
+
var e_2, _a;
|
|
75
|
+
var shapePr = new ShapePr();
|
|
76
|
+
if (element) {
|
|
77
|
+
try {
|
|
78
|
+
for (var _b = __values(element.children), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
79
|
+
var child = _c.value;
|
|
80
|
+
var tagName = child.tagName;
|
|
81
|
+
switch (tagName) {
|
|
82
|
+
case 'a:xfrm':
|
|
83
|
+
shapePr.xfrm = Transform.fromXML(word, child);
|
|
84
|
+
break;
|
|
85
|
+
case 'a:prstGeom':
|
|
86
|
+
shapePr.geom = Geom.fromXML(word, child);
|
|
87
|
+
break;
|
|
88
|
+
case 'a:custGeom':
|
|
89
|
+
shapePr.custGeom = CustomGeom.fromXML(word, child);
|
|
90
|
+
break;
|
|
91
|
+
case 'a:ln':
|
|
92
|
+
// http://officeopenxml.com/drwSp-outline.php
|
|
93
|
+
shapePr.outline = parseOutline(word, child);
|
|
94
|
+
break;
|
|
95
|
+
case 'a:noFill':
|
|
96
|
+
shapePr.noFill = true;
|
|
97
|
+
break;
|
|
98
|
+
case 'a:solidFill':
|
|
99
|
+
shapePr.fillColor = parseChildColor(word, child);
|
|
100
|
+
break;
|
|
101
|
+
default:
|
|
102
|
+
console.warn('ShapePr: Unknown tag ', tagName, child);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
107
|
+
finally {
|
|
108
|
+
try {
|
|
109
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
110
|
+
}
|
|
111
|
+
finally { if (e_2) throw e_2.error; }
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return shapePr;
|
|
115
|
+
};
|
|
116
|
+
return ShapePr;
|
|
117
|
+
}());
|
|
118
|
+
|
|
119
|
+
export { 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 '
|
|
4
|
+
import Word from '../../Word';
|
|
5
5
|
export interface Off {
|
|
6
6
|
x: string;
|
|
7
7
|
y: string;
|
|
@@ -13,5 +13,8 @@ export interface Ext {
|
|
|
13
13
|
export declare class Transform {
|
|
14
14
|
off?: Off;
|
|
15
15
|
ext?: Ext;
|
|
16
|
+
chOff?: Off;
|
|
17
|
+
chExt?: Ext;
|
|
18
|
+
rot?: number;
|
|
16
19
|
static fromXML(word: Word, element: Element): Transform;
|
|
17
20
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { __values } from 'tslib';
|
|
2
|
+
import { parseSize, LengthUsage, convertAngle } from '../../parse/parseSize.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* http://webapp.docx4java.org/OnlineDemo/ecma376/DrawingML/xfrm_2.html
|
|
6
|
+
*/
|
|
7
|
+
var Transform = /** @class */ (function () {
|
|
8
|
+
function Transform() {
|
|
9
|
+
}
|
|
10
|
+
Transform.fromXML = function (word, element) {
|
|
11
|
+
var e_1, _a;
|
|
12
|
+
var transform = new Transform();
|
|
13
|
+
try {
|
|
14
|
+
for (var _b = __values(element.children), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
15
|
+
var child = _c.value;
|
|
16
|
+
var tagName = child.tagName;
|
|
17
|
+
switch (tagName) {
|
|
18
|
+
case 'a:off':
|
|
19
|
+
transform.off = {
|
|
20
|
+
x: parseSize(child, 'x', LengthUsage.Emu),
|
|
21
|
+
y: parseSize(child, 'y', LengthUsage.Emu)
|
|
22
|
+
};
|
|
23
|
+
break;
|
|
24
|
+
case 'a:ext':
|
|
25
|
+
transform.ext = {
|
|
26
|
+
cx: parseSize(child, 'cx', LengthUsage.Emu),
|
|
27
|
+
cy: parseSize(child, 'cy', LengthUsage.Emu)
|
|
28
|
+
};
|
|
29
|
+
break;
|
|
30
|
+
case 'a:chOff':
|
|
31
|
+
transform.chOff = {
|
|
32
|
+
x: parseSize(child, 'x', LengthUsage.Emu),
|
|
33
|
+
y: parseSize(child, 'y', LengthUsage.Emu)
|
|
34
|
+
};
|
|
35
|
+
break;
|
|
36
|
+
case 'a:chExt':
|
|
37
|
+
transform.chExt = {
|
|
38
|
+
cx: parseSize(child, 'cx', LengthUsage.Emu),
|
|
39
|
+
cy: parseSize(child, 'cy', LengthUsage.Emu)
|
|
40
|
+
};
|
|
41
|
+
break;
|
|
42
|
+
default:
|
|
43
|
+
console.warn('Transform: Unknown tag ', tagName, child);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
48
|
+
finally {
|
|
49
|
+
try {
|
|
50
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
51
|
+
}
|
|
52
|
+
finally { if (e_1) throw e_1.error; }
|
|
53
|
+
}
|
|
54
|
+
var rot = element.getAttribute('rot');
|
|
55
|
+
if (rot) {
|
|
56
|
+
transform.rot = convertAngle(rot);
|
|
57
|
+
}
|
|
58
|
+
return transform;
|
|
59
|
+
};
|
|
60
|
+
return Transform;
|
|
61
|
+
}());
|
|
62
|
+
|
|
63
|
+
export { Transform };
|