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
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var OpenXML = require('../OpenXML.js');
|
|
6
|
+
var color = require('../util/color.js');
|
|
7
|
+
var colorNameMap = require('./colorNameMap.js');
|
|
8
|
+
var modifyColor = require('./modifyColor.js');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 解析子节点颜色,这里其实还有 lumMod 和 lumOff
|
|
12
|
+
*/
|
|
13
|
+
function parseChildColor(word, element) {
|
|
14
|
+
var colorChild = element.firstElementChild;
|
|
15
|
+
if (colorChild) {
|
|
16
|
+
var colorType = colorChild.tagName;
|
|
17
|
+
switch (colorType) {
|
|
18
|
+
case 'a:prstClr':
|
|
19
|
+
var color$1 = OpenXML.getVal(colorChild) || '';
|
|
20
|
+
if (color$1 in colorNameMap.PresetColorMap) {
|
|
21
|
+
return modifyColor.modifyColor(colorChild, colorNameMap.PresetColorMap[color$1]);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
console.warn('parseOutline: Unknown color ', color$1, colorChild);
|
|
25
|
+
}
|
|
26
|
+
break;
|
|
27
|
+
case 'a:srgbClr':
|
|
28
|
+
case 'a:scrgbClr':
|
|
29
|
+
case 'w14:srgbClr':
|
|
30
|
+
var rgbColor = OpenXML.getVal(colorChild);
|
|
31
|
+
if (rgbColor) {
|
|
32
|
+
return modifyColor.modifyColor(colorChild, '#' + rgbColor);
|
|
33
|
+
}
|
|
34
|
+
var r = OpenXML.getAttrPercent(colorChild, 'r');
|
|
35
|
+
var g = OpenXML.getAttrPercent(colorChild, 'g');
|
|
36
|
+
var b = OpenXML.getAttrPercent(colorChild, 'b');
|
|
37
|
+
var scrgbColor = color.Color.fromRGB(r, g, b);
|
|
38
|
+
return modifyColor.modifyColor(colorChild, scrgbColor.toHex());
|
|
39
|
+
case 'a:hslClr':
|
|
40
|
+
var h = OpenXML.getAttrPercent(colorChild, 'r');
|
|
41
|
+
var s = OpenXML.getAttrPercent(colorChild, 'g');
|
|
42
|
+
var l = OpenXML.getAttrPercent(colorChild, 'b');
|
|
43
|
+
var val = OpenXML.getVal(colorChild);
|
|
44
|
+
// 文档例子里有,不确定
|
|
45
|
+
if (val) {
|
|
46
|
+
return modifyColor.modifyColor(colorChild, '#' + val);
|
|
47
|
+
}
|
|
48
|
+
var hslColor = color.Color.fromHSL(h, s, l);
|
|
49
|
+
return modifyColor.modifyColor(colorChild, hslColor.toHex());
|
|
50
|
+
case 'a:schemeClr':
|
|
51
|
+
case 'w14:schemeClr':
|
|
52
|
+
var schemeClr = OpenXML.getVal(colorChild);
|
|
53
|
+
if (schemeClr) {
|
|
54
|
+
return modifyColor.modifyColor(colorChild, word.getThemeColor(schemeClr));
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
console.warn('parseOutline: Unknown schemeClr ', colorChild);
|
|
58
|
+
}
|
|
59
|
+
break;
|
|
60
|
+
case 'a:sysClr':
|
|
61
|
+
// 这里每个系统不一样,所以直接依赖浏览器的能力
|
|
62
|
+
return OpenXML.getVal(colorChild);
|
|
63
|
+
default:
|
|
64
|
+
console.warn('parseOutline: Unknown color type ', colorType, colorChild);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return '';
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
exports.parseChildColor = parseChildColor;
|
package/lib/parse/parseColor.js
CHANGED
|
@@ -3,30 +3,15 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var OpenXML = require('../OpenXML.js');
|
|
6
|
-
var
|
|
6
|
+
var colorNameMap = require('./colorNameMap.js');
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* 解析颜色,转成 css 的颜色
|
|
10
10
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
'darkBlue',
|
|
16
|
-
'darkCyan',
|
|
17
|
-
'darkGray',
|
|
18
|
-
'darkGreen',
|
|
19
|
-
'darkMagenta',
|
|
20
|
-
'darkRed',
|
|
21
|
-
'darkYellow',
|
|
22
|
-
'green',
|
|
23
|
-
'lightGray',
|
|
24
|
-
'magenta',
|
|
25
|
-
'none',
|
|
26
|
-
'red',
|
|
27
|
-
'white',
|
|
28
|
-
'yellow'
|
|
29
|
-
];
|
|
11
|
+
/**
|
|
12
|
+
* css 里可以识别的颜色
|
|
13
|
+
*/
|
|
14
|
+
var cssColors = ['black', 'blue', 'green', 'red', 'white', 'yellow'];
|
|
30
15
|
/**
|
|
31
16
|
*
|
|
32
17
|
* 解析属性上的 color,比如 <w:top w:val="single" w:sz="24" w:space="1" w:color="FF0000" />
|
|
@@ -41,10 +26,16 @@ function parseColorAttr(word, element, attrName, autoColor) {
|
|
|
41
26
|
if (color) {
|
|
42
27
|
if (color == 'auto') {
|
|
43
28
|
return autoColor;
|
|
29
|
+
/**
|
|
30
|
+
* css 里可以识别的颜色
|
|
31
|
+
*/
|
|
44
32
|
}
|
|
45
|
-
else if (
|
|
33
|
+
else if (cssColors.includes(color)) {
|
|
46
34
|
return color;
|
|
47
35
|
}
|
|
36
|
+
else if (color in colorNameMap.PresetColorMap) {
|
|
37
|
+
return colorNameMap.PresetColorMap[color];
|
|
38
|
+
}
|
|
48
39
|
return "#".concat(color);
|
|
49
40
|
}
|
|
50
41
|
var themeColor = element.getAttribute('w:themeColor');
|
|
@@ -58,55 +49,55 @@ function parseShdColor(word, element) {
|
|
|
58
49
|
var color = element.getAttribute('w:fill') || '';
|
|
59
50
|
var val = OpenXML.getVal(element);
|
|
60
51
|
if (color === 'auto') {
|
|
61
|
-
color = '
|
|
52
|
+
color = 'FFFFFF';
|
|
62
53
|
}
|
|
63
54
|
if (color.length === 6) {
|
|
64
55
|
switch (val) {
|
|
65
|
-
case
|
|
56
|
+
case 'clear':
|
|
66
57
|
return "#".concat(color);
|
|
67
|
-
case
|
|
58
|
+
case 'pct10':
|
|
68
59
|
return colorPercent(color, 0.1);
|
|
69
|
-
case
|
|
60
|
+
case 'pct12':
|
|
70
61
|
return colorPercent(color, 0.125);
|
|
71
|
-
case
|
|
62
|
+
case 'pct15':
|
|
72
63
|
return colorPercent(color, 0.15);
|
|
73
|
-
case
|
|
64
|
+
case 'pct20':
|
|
74
65
|
return colorPercent(color, 0.2);
|
|
75
|
-
case
|
|
66
|
+
case 'pct25':
|
|
76
67
|
return colorPercent(color, 0.25);
|
|
77
|
-
case
|
|
68
|
+
case 'pct30':
|
|
78
69
|
return colorPercent(color, 0.3);
|
|
79
|
-
case
|
|
70
|
+
case 'pct35':
|
|
80
71
|
return colorPercent(color, 0.35);
|
|
81
|
-
case
|
|
72
|
+
case 'pct37':
|
|
82
73
|
return colorPercent(color, 0.375);
|
|
83
|
-
case
|
|
74
|
+
case 'pct40':
|
|
84
75
|
return colorPercent(color, 0.4);
|
|
85
|
-
case
|
|
76
|
+
case 'pct45':
|
|
86
77
|
return colorPercent(color, 0.45);
|
|
87
|
-
case
|
|
78
|
+
case 'pct5':
|
|
88
79
|
return colorPercent(color, 0.05);
|
|
89
|
-
case
|
|
80
|
+
case 'pct50':
|
|
90
81
|
return colorPercent(color, 0.5);
|
|
91
|
-
case
|
|
82
|
+
case 'pct55':
|
|
92
83
|
return colorPercent(color, 0.55);
|
|
93
|
-
case
|
|
84
|
+
case 'pct60':
|
|
94
85
|
return colorPercent(color, 0.6);
|
|
95
|
-
case
|
|
86
|
+
case 'pct65':
|
|
96
87
|
return colorPercent(color, 0.65);
|
|
97
|
-
case
|
|
88
|
+
case 'pct70':
|
|
98
89
|
return colorPercent(color, 0.7);
|
|
99
|
-
case
|
|
90
|
+
case 'pct75':
|
|
100
91
|
return colorPercent(color, 0.75);
|
|
101
|
-
case
|
|
92
|
+
case 'pct80':
|
|
102
93
|
return colorPercent(color, 0.8);
|
|
103
|
-
case
|
|
94
|
+
case 'pct85':
|
|
104
95
|
return colorPercent(color, 0.85);
|
|
105
|
-
case
|
|
96
|
+
case 'pct87':
|
|
106
97
|
return colorPercent(color, 0.87);
|
|
107
|
-
case
|
|
98
|
+
case 'pct90':
|
|
108
99
|
return colorPercent(color, 0.9);
|
|
109
|
-
case
|
|
100
|
+
case 'pct95':
|
|
110
101
|
return colorPercent(color, 0.95);
|
|
111
102
|
default:
|
|
112
103
|
console.warn('unsupport shd val', val);
|
|
@@ -119,6 +110,10 @@ function parseShdColor(word, element) {
|
|
|
119
110
|
* 用 alpha 来模拟 ptc 功能
|
|
120
111
|
*/
|
|
121
112
|
function colorPercent(color, percent) {
|
|
113
|
+
// 白色取 alpha 没什么意义,转成黑色
|
|
114
|
+
if (color === 'FFFFFF') {
|
|
115
|
+
color = '000000';
|
|
116
|
+
}
|
|
122
117
|
var r = parseInt(color.substring(0, 2), 16);
|
|
123
118
|
var g = parseInt(color.substring(2, 4), 16);
|
|
124
119
|
var b = parseInt(color.substring(4, 6), 16);
|
|
@@ -132,6 +127,7 @@ function parseColor(word, element) {
|
|
|
132
127
|
return parseColorAttr(word, element, 'w:val');
|
|
133
128
|
}
|
|
134
129
|
|
|
130
|
+
exports.cssColors = cssColors;
|
|
135
131
|
exports.parseColor = parseColor;
|
|
136
132
|
exports.parseColorAttr = parseColorAttr;
|
|
137
133
|
exports.parseShdColor = parseShdColor;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var tslib = require('tslib');
|
|
6
|
+
var Note = require('../openxml/word/Note.js');
|
|
7
|
+
|
|
8
|
+
function parseEndnotes(word, doc) {
|
|
9
|
+
var e_1, _a;
|
|
10
|
+
var endnotes = {};
|
|
11
|
+
var endnotesElement = [].slice.call(doc.getElementsByTagName('w:endnote'));
|
|
12
|
+
try {
|
|
13
|
+
for (var endnotesElement_1 = tslib.__values(endnotesElement), endnotesElement_1_1 = endnotesElement_1.next(); !endnotesElement_1_1.done; endnotesElement_1_1 = endnotesElement_1.next()) {
|
|
14
|
+
var endnoteElement = endnotesElement_1_1.value;
|
|
15
|
+
var endnote = Note.Note.fromXML(word, endnoteElement);
|
|
16
|
+
endnotes[endnoteElement.getAttribute('w:id')] = endnote;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
20
|
+
finally {
|
|
21
|
+
try {
|
|
22
|
+
if (endnotesElement_1_1 && !endnotesElement_1_1.done && (_a = endnotesElement_1.return)) _a.call(endnotesElement_1);
|
|
23
|
+
}
|
|
24
|
+
finally { if (e_1) throw e_1.error; }
|
|
25
|
+
}
|
|
26
|
+
return endnotes;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
exports.parseEndnotes = parseEndnotes;
|
package/lib/parse/parseFont.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var tslib = require('tslib');
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* 解析字体
|
|
@@ -16,7 +16,7 @@ function parseFont(word, element, style) {
|
|
|
16
16
|
var fonts = [];
|
|
17
17
|
var fontMapping = word.renderOptions.fontMapping;
|
|
18
18
|
try {
|
|
19
|
-
for (var _b =
|
|
19
|
+
for (var _b = tslib.__values(element.attributes), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
20
20
|
var attribute = _c.value;
|
|
21
21
|
var name_1 = attribute.name;
|
|
22
22
|
var value = attribute.value;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var parseBorder = require('./parseBorder.js');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* parseBorders 不支持 insideH 和 insideV,所以单独支持一下
|
|
9
|
+
* 实际显示时需要过滤掉第一列
|
|
10
|
+
*/
|
|
11
|
+
function parseInsideBorders(word, element) {
|
|
12
|
+
var H;
|
|
13
|
+
var insideH = element.getElementsByTagName('w:insideH').item(0);
|
|
14
|
+
if (insideH) {
|
|
15
|
+
H = parseBorder.parseBorder(word, insideH);
|
|
16
|
+
}
|
|
17
|
+
var V;
|
|
18
|
+
var insideV = element.getElementsByTagName('w:insideV').item(0);
|
|
19
|
+
if (insideV) {
|
|
20
|
+
V = parseBorder.parseBorder(word, insideV);
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
H: H,
|
|
24
|
+
V: V
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
exports.parseInsideBorders = parseInsideBorders;
|
package/lib/parse/parsePr.d.ts
CHANGED
package/lib/parse/parsePr.js
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
var Types = require('../openxml/Types.js');
|
|
5
|
+
var tslib = require('tslib');
|
|
7
6
|
var parseSize = require('./parseSize.js');
|
|
8
7
|
var OpenXML = require('../OpenXML.js');
|
|
9
8
|
var parseBorder = require('./parseBorder.js');
|
|
10
9
|
var parseColor = require('./parseColor.js');
|
|
10
|
+
var parseChildColor = require('./parseChildColor.js');
|
|
11
11
|
var parseInd = require('./parseInd.js');
|
|
12
12
|
var parseSpacing = require('./parseSpacing.js');
|
|
13
13
|
var parseFont = require('./parseFont.js');
|
|
@@ -15,6 +15,9 @@ var parseTrHeight = require('./parseTrHeight.js');
|
|
|
15
15
|
var jcToTextAlign = require('./jcToTextAlign.js');
|
|
16
16
|
var parseTextDirection = require('./parseTextDirection.js');
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* 包括 rPr 及 pPr 的解析,参考了 docxjs 里的实现
|
|
20
|
+
*/
|
|
18
21
|
/**
|
|
19
22
|
* 解析 underline 并附上样式
|
|
20
23
|
* http://webapp.docx4java.org/OnlineDemo/ecma376/WordML/u.html
|
|
@@ -69,13 +72,14 @@ function parseUnderline(word, element, style) {
|
|
|
69
72
|
function parseFrame(element, style) {
|
|
70
73
|
var e_1, _a;
|
|
71
74
|
try {
|
|
72
|
-
for (var _b =
|
|
75
|
+
for (var _b = tslib.__values(element.attributes), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
73
76
|
var attribute = _c.value;
|
|
74
77
|
var name_1 = attribute.name;
|
|
75
78
|
var value = attribute.value;
|
|
76
79
|
switch (name_1) {
|
|
77
80
|
case 'w:dropCap':
|
|
78
81
|
if (value === 'drop') {
|
|
82
|
+
// initial-letter 很少浏览器支持,所以用 float 代替
|
|
79
83
|
style['float'] = 'left';
|
|
80
84
|
}
|
|
81
85
|
break;
|
|
@@ -89,6 +93,17 @@ function parseFrame(element, style) {
|
|
|
89
93
|
style['width'] = parseSize.parseSize(value, 'w:w');
|
|
90
94
|
}
|
|
91
95
|
break;
|
|
96
|
+
case 'w:hAnchor':
|
|
97
|
+
case 'w:vAnchor':
|
|
98
|
+
case 'w:lines':
|
|
99
|
+
// 目前没有办法做到这些属性的控制
|
|
100
|
+
break;
|
|
101
|
+
case 'w:wrap':
|
|
102
|
+
// 其它不支持,先报错
|
|
103
|
+
if (value !== 'around') {
|
|
104
|
+
console.warn('parseFrame: w:wrap not support ' + value);
|
|
105
|
+
}
|
|
106
|
+
break;
|
|
92
107
|
default:
|
|
93
108
|
console.warn('parseFrame: unknown attribute ' + name_1, attribute);
|
|
94
109
|
}
|
|
@@ -102,7 +117,30 @@ function parseFrame(element, style) {
|
|
|
102
117
|
finally { if (e_1) throw e_1.error; }
|
|
103
118
|
}
|
|
104
119
|
}
|
|
105
|
-
|
|
120
|
+
/**
|
|
121
|
+
* 将 em 转成 css 里对应的 text-emphasis 值
|
|
122
|
+
* http://webapp.docx4java.org/OnlineDemo/ecma376/WordML/ST_Em.html
|
|
123
|
+
*/
|
|
124
|
+
function convertEm(em, style) {
|
|
125
|
+
switch (em) {
|
|
126
|
+
case 'dot':
|
|
127
|
+
style['text-emphasis'] = 'filled';
|
|
128
|
+
// 按规范里描述应该是在文字上面,但在 word 实际显示的时候是在下面
|
|
129
|
+
// 怀疑是中文场景下做了特殊处理
|
|
130
|
+
style['text-emphasis-position'] = 'under right';
|
|
131
|
+
break;
|
|
132
|
+
case 'comma':
|
|
133
|
+
style['text-emphasis'] = 'filled sesame';
|
|
134
|
+
break;
|
|
135
|
+
case 'circle':
|
|
136
|
+
style['text-emphasis'] = 'open';
|
|
137
|
+
break;
|
|
138
|
+
case 'underDot':
|
|
139
|
+
style['text-emphasis'] = 'filled';
|
|
140
|
+
style['text-emphasis-position'] = 'under right';
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
106
144
|
/**
|
|
107
145
|
* 解析各种 pPr 及 rPr,返回样式
|
|
108
146
|
* @param type 所属类型
|
|
@@ -112,7 +150,7 @@ function parsePr(word, element, type) {
|
|
|
112
150
|
var e_2, _a;
|
|
113
151
|
var style = {};
|
|
114
152
|
try {
|
|
115
|
-
for (var _b =
|
|
153
|
+
for (var _b = tslib.__values(element.children), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
116
154
|
var child = _c.value;
|
|
117
155
|
var tagName = child.tagName;
|
|
118
156
|
switch (tagName) {
|
|
@@ -148,16 +186,16 @@ function parsePr(word, element, type) {
|
|
|
148
186
|
case 'w:highlight':
|
|
149
187
|
// http://webapp.docx4java.org/OnlineDemo/ecma376/WordML/highlight.html
|
|
150
188
|
// 这个按文档是重要性高于 shd
|
|
151
|
-
style['background-color'] = parseColor.parseColorAttr(word, child, 'w:
|
|
189
|
+
style['background-color'] = parseColor.parseColorAttr(word, child, 'w:val', 'yellow');
|
|
152
190
|
break;
|
|
153
191
|
case 'w:vertAlign':
|
|
154
192
|
// http://webapp.docx4java.org/OnlineDemo/ecma376/WordML/vertAlign.html
|
|
155
193
|
// 这个其实和 position 有冲突,但预计这两个同时出现的概率不高
|
|
156
194
|
var vertAlign = OpenXML.getVal(child);
|
|
157
|
-
if (vertAlign ===
|
|
195
|
+
if (vertAlign === 'superscript') {
|
|
158
196
|
style['vertical-align'] = 'super';
|
|
159
197
|
}
|
|
160
|
-
else if (vertAlign ===
|
|
198
|
+
else if (vertAlign === 'subscript') {
|
|
161
199
|
style['vertical-align'] = 'sub';
|
|
162
200
|
}
|
|
163
201
|
break;
|
|
@@ -231,7 +269,7 @@ function parsePr(word, element, type) {
|
|
|
231
269
|
// );
|
|
232
270
|
break;
|
|
233
271
|
case 'w:pStyle':
|
|
234
|
-
//
|
|
272
|
+
// 这个在 paragraph 里处理了
|
|
235
273
|
break;
|
|
236
274
|
case 'w:lang':
|
|
237
275
|
case 'w:noProof':
|
|
@@ -254,7 +292,14 @@ function parsePr(word, element, type) {
|
|
|
254
292
|
// 这个在 parseParagraphProperties 里处理了
|
|
255
293
|
break;
|
|
256
294
|
case 'w:rPr':
|
|
257
|
-
// TODO:
|
|
295
|
+
// TODO: 这个有时候和 r 里的 rPr 不一致,不知道如何处理
|
|
296
|
+
var reflection = child.getElementsByTagName('w14:reflection').item(0);
|
|
297
|
+
if (reflection) {
|
|
298
|
+
// css 只支持在块级节点设置
|
|
299
|
+
// 只支持一小部分设置项,另外因为只支持块级别的情况,所以看起来差异较大
|
|
300
|
+
var reflectionDistance = parseSize.parseSize(reflection, 'w4:dist', parseSize.LengthUsage.Emu) || '0px';
|
|
301
|
+
style['-webkit-box-reflect'] = "below ".concat(reflectionDistance, " linear-gradient(transparent, white)");
|
|
302
|
+
}
|
|
258
303
|
break;
|
|
259
304
|
case 'w:rStyle':
|
|
260
305
|
// 在 Run 里地方处理了
|
|
@@ -270,6 +315,9 @@ function parsePr(word, element, type) {
|
|
|
270
315
|
// http://webapp.docx4java.org/OnlineDemo/ecma376/WordML/snapToGrid_2.html
|
|
271
316
|
// 目前还不支持 grid
|
|
272
317
|
break;
|
|
318
|
+
case 'w:topLinePunct':
|
|
319
|
+
// 没法支持
|
|
320
|
+
break;
|
|
273
321
|
case 'w:wordWrap':
|
|
274
322
|
// 不太确定这里是用 word-break 还是 overflow-wrap
|
|
275
323
|
if (OpenXML.getValBoolean(child)) {
|
|
@@ -279,10 +327,10 @@ function parsePr(word, element, type) {
|
|
|
279
327
|
case 'w:textAlignment':
|
|
280
328
|
// http://webapp.docx4java.org/OnlineDemo/ecma376/WordML/textAlignment.html
|
|
281
329
|
var alignment = OpenXML.getVal(child);
|
|
282
|
-
if (alignment ===
|
|
330
|
+
if (alignment === 'center') {
|
|
283
331
|
style['vertical-align'] = 'middle';
|
|
284
332
|
}
|
|
285
|
-
else if (alignment !==
|
|
333
|
+
else if (alignment !== 'auto') {
|
|
286
334
|
style['vertical-align'] = alignment;
|
|
287
335
|
}
|
|
288
336
|
break;
|
|
@@ -311,6 +359,55 @@ function parsePr(word, element, type) {
|
|
|
311
359
|
// http://webapp.docx4java.org/OnlineDemo/ecma376/WordML/overflowPunct.html
|
|
312
360
|
// 支持不了
|
|
313
361
|
break;
|
|
362
|
+
case 'w:em':
|
|
363
|
+
convertEm(OpenXML.getVal(child), style);
|
|
364
|
+
break;
|
|
365
|
+
case 'w:w':
|
|
366
|
+
// http://webapp.docx4java.org/OnlineDemo/ecma376/WordML/w_1.html
|
|
367
|
+
// 看起来应该是把文字拉伸
|
|
368
|
+
var w = OpenXML.getValNumber(child);
|
|
369
|
+
style['transform'] = "scaleX(".concat(w / 100, ")");
|
|
370
|
+
style['display'] = 'inline-block'; // 需要这样才能生效
|
|
371
|
+
break;
|
|
372
|
+
case 'w:outline':
|
|
373
|
+
style['text-shadow'] =
|
|
374
|
+
'-1px -1px 0 #AAA, 1px -1px 0 #AAA, -1px 1px 0 #AAA, 1px 1px 0 #AAA';
|
|
375
|
+
break;
|
|
376
|
+
case 'w:shadown':
|
|
377
|
+
case 'w:imprint':
|
|
378
|
+
if (OpenXML.getValBoolean(child, true)) {
|
|
379
|
+
style['text-shadow'] = '1px 1px 2px rgba(0, 0, 0, 0.6)';
|
|
380
|
+
}
|
|
381
|
+
break;
|
|
382
|
+
case 'w14:shadow':
|
|
383
|
+
var blurRad = parseSize.parseSize(child, 'w14:blurRad', parseSize.LengthUsage.Emu) || '4px';
|
|
384
|
+
// 其它结果算出来不像就先忽略了
|
|
385
|
+
var color = 'rgba(0, 0, 0, 0.6)';
|
|
386
|
+
var childColor = parseChildColor.parseChildColor(word, child);
|
|
387
|
+
if (childColor) {
|
|
388
|
+
color = childColor;
|
|
389
|
+
}
|
|
390
|
+
style['text-shadow'] = "1px 1px ".concat(blurRad, " ").concat(color);
|
|
391
|
+
break;
|
|
392
|
+
case 'w14:textOutline':
|
|
393
|
+
var outlineWidth = parseSize.parseSize(child, 'w14:w', parseSize.LengthUsage.Emu) || '1px';
|
|
394
|
+
style['-webkit-text-stroke-width'] = outlineWidth;
|
|
395
|
+
var outlineColor = 'white';
|
|
396
|
+
var fillColor = child.getElementsByTagName('w14:solidFill');
|
|
397
|
+
if (fillColor.length > 0) {
|
|
398
|
+
outlineColor = parseChildColor.parseChildColor(word, fillColor.item(0)) || 'white';
|
|
399
|
+
}
|
|
400
|
+
style['-webkit-text-stroke-color'] = outlineColor;
|
|
401
|
+
break;
|
|
402
|
+
case 'w14:reflection':
|
|
403
|
+
// 在 rPr 里处理了
|
|
404
|
+
break;
|
|
405
|
+
case 'w14:textFill':
|
|
406
|
+
// color 已经够用了,为了避免 lumMod 计算不正确反而导致问题,所以就不支持了
|
|
407
|
+
break;
|
|
408
|
+
case 'w14:ligatures':
|
|
409
|
+
// 没文档,不知道
|
|
410
|
+
break;
|
|
314
411
|
default:
|
|
315
412
|
console.warn('parsePr Unknown tagName', tagName, child);
|
|
316
413
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var tslib = require('tslib');
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* 解析 _rels/.rels 文件
|
|
@@ -25,7 +25,7 @@ function parseRelationships(element, part) {
|
|
|
25
25
|
var relationships = {};
|
|
26
26
|
var relationshipElements = element.getElementsByTagName('Relationship');
|
|
27
27
|
try {
|
|
28
|
-
for (var relationshipElements_1 =
|
|
28
|
+
for (var relationshipElements_1 = tslib.__values(relationshipElements), relationshipElements_1_1 = relationshipElements_1.next(); !relationshipElements_1_1.done; relationshipElements_1_1 = relationshipElements_1.next()) {
|
|
29
29
|
var relationshipElement = relationshipElements_1_1.value;
|
|
30
30
|
var relationship = parseRelationship(relationshipElement, part);
|
|
31
31
|
relationships[relationship.id] = relationship;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 解析 shape
|
|
3
|
+
*/
|
|
4
|
+
import { Path, PathPoint } from '../openxml/drawing/Path';
|
|
5
|
+
import { Shape, ShapeGuide } from '../openxml/drawing/Shape';
|
|
6
|
+
export declare function parsePts(element: Element): PathPoint[];
|
|
7
|
+
export declare function parsePath(element: Element): Path;
|
|
8
|
+
export declare function parsePathLst(element: Element): Path[];
|
|
9
|
+
export declare function parseShapeGuide(element: Element): ShapeGuide[];
|
|
10
|
+
export declare function parseShape(element: Element): Shape;
|