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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* openxml 默认是 zip
|
|
2
|
+
* openxml 默认是 zip 格式构造起来比较麻烦,这个格式可以方便文本编辑,word 也能直接打开
|
|
3
3
|
*/
|
|
4
4
|
import { PackageParser } from './PackageParser';
|
|
5
5
|
export default class XMLPackageParser implements PackageParser {
|
|
@@ -9,7 +9,7 @@ export default class XMLPackageParser implements PackageParser {
|
|
|
9
9
|
/**
|
|
10
10
|
* 加载 zip 文件
|
|
11
11
|
*/
|
|
12
|
-
load(fileContent: ArrayBuffer | string): void;
|
|
12
|
+
load(fileContent: ArrayBuffer | string | Uint8Array): void;
|
|
13
13
|
/**
|
|
14
14
|
* 读取 xml 文件,转成 json 对象
|
|
15
15
|
* @param filePath 文件路径
|
|
@@ -19,7 +19,7 @@ export default class XMLPackageParser implements PackageParser {
|
|
|
19
19
|
/**
|
|
20
20
|
* 在 xml 下基本不用这个
|
|
21
21
|
*/
|
|
22
|
-
getFileByType(filePath: string, type: 'string' | 'blob'): string;
|
|
22
|
+
getFileByType(filePath: string, type: 'string' | 'blob'): string | Uint8Array | Blob | null;
|
|
23
23
|
/**
|
|
24
24
|
* 判断文件是否存在
|
|
25
25
|
*/
|
|
@@ -17,7 +17,7 @@ export default class ZipPackageParser implements PackageParser {
|
|
|
17
17
|
/**
|
|
18
18
|
* 根据类型读取文件
|
|
19
19
|
*/
|
|
20
|
-
getFileByType(filePath: string, type: 'string' | 'blob'): string | Blob;
|
|
20
|
+
getFileByType(filePath: string, type: 'string' | 'blob' | 'uint8array'): string | Uint8Array | Blob | null;
|
|
21
21
|
/**
|
|
22
22
|
* 判断文件是否存在
|
|
23
23
|
*/
|
|
@@ -14,12 +14,7 @@ var ZipPackageParser = /** @class */ (function () {
|
|
|
14
14
|
* 加载 zip 文件
|
|
15
15
|
*/
|
|
16
16
|
ZipPackageParser.prototype.load = function (docxFile) {
|
|
17
|
-
this.zip = fflate.unzipSync(new Uint8Array(docxFile)
|
|
18
|
-
filter: function (file) {
|
|
19
|
-
// 不解析大于 10 MiB 的文件
|
|
20
|
-
return file.originalSize <= 10000000;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
17
|
+
this.zip = fflate.unzipSync(new Uint8Array(docxFile));
|
|
23
18
|
};
|
|
24
19
|
/**
|
|
25
20
|
* 读取 xml 文件,转成 json 对象
|
|
@@ -29,7 +24,7 @@ var ZipPackageParser = /** @class */ (function () {
|
|
|
29
24
|
ZipPackageParser.prototype.getXML = function (filePath) {
|
|
30
25
|
var fileContent = this.getFileByType(filePath, 'string');
|
|
31
26
|
var doc = new DOMParser().parseFromString(fileContent, 'application/xml');
|
|
32
|
-
var errorNode = doc.
|
|
27
|
+
var errorNode = doc.getElementsByTagName('parsererror').item(0);
|
|
33
28
|
if (errorNode) {
|
|
34
29
|
throw new Error(errorNode.textContent || "can't parse xml");
|
|
35
30
|
}
|
|
@@ -50,8 +45,12 @@ var ZipPackageParser = /** @class */ (function () {
|
|
|
50
45
|
else if (type === 'blob') {
|
|
51
46
|
return new Blob([file]);
|
|
52
47
|
}
|
|
48
|
+
else if (type === 'uint8array') {
|
|
49
|
+
return file;
|
|
50
|
+
}
|
|
53
51
|
}
|
|
54
|
-
|
|
52
|
+
console.warn('getFileByType', filePath, 'not found');
|
|
53
|
+
return null;
|
|
55
54
|
};
|
|
56
55
|
/**
|
|
57
56
|
* 判断文件是否存在
|
|
@@ -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 parseFootnotes(word, doc) {
|
|
9
|
+
var e_1, _a;
|
|
10
|
+
var footnotes = {};
|
|
11
|
+
var footnotesElement = [].slice.call(doc.getElementsByTagName('w:footnote'));
|
|
12
|
+
try {
|
|
13
|
+
for (var footnotesElement_1 = tslib.__values(footnotesElement), footnotesElement_1_1 = footnotesElement_1.next(); !footnotesElement_1_1.done; footnotesElement_1_1 = footnotesElement_1.next()) {
|
|
14
|
+
var footnoteElement = footnotesElement_1_1.value;
|
|
15
|
+
var footnote = Note.Note.fromXML(word, footnoteElement);
|
|
16
|
+
footnotes[footnoteElement.getAttribute('w:id')] = footnote;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
20
|
+
finally {
|
|
21
|
+
try {
|
|
22
|
+
if (footnotesElement_1_1 && !footnotesElement_1_1.done && (_a = footnotesElement_1.return)) _a.call(footnotesElement_1);
|
|
23
|
+
}
|
|
24
|
+
finally { if (e_1) throw e_1.error; }
|
|
25
|
+
}
|
|
26
|
+
return footnotes;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
exports.parseFootnotes = parseFootnotes;
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 内置颜色
|
|
7
|
+
* 参考了 pptxjs 里的例子,并补充了 ST_PresetColorVal 里缺失的定义
|
|
8
|
+
*/
|
|
9
|
+
var PresetColorMap = {
|
|
10
|
+
aliceBlue: '#f0f8ff',
|
|
11
|
+
antiqueWhite: '#faebd7',
|
|
12
|
+
aqua: '#00ffff',
|
|
13
|
+
aquamarine: '#7fffd4',
|
|
14
|
+
azure: '#f0ffff',
|
|
15
|
+
beige: '#f5f5dc',
|
|
16
|
+
bisque: '#ffe4c4',
|
|
17
|
+
black: '#000000',
|
|
18
|
+
blanchedAlmond: '#ffebcd',
|
|
19
|
+
blue: '#0000ff',
|
|
20
|
+
blueViolet: '#8a2be2',
|
|
21
|
+
brown: '#a52a2a',
|
|
22
|
+
burlyWood: '#deb887',
|
|
23
|
+
cadetBlue: '#5f9ea0',
|
|
24
|
+
chartreuse: '#7fff00',
|
|
25
|
+
chocolate: '#d2691e',
|
|
26
|
+
coral: '#ff7f50',
|
|
27
|
+
cornflowerBlue: '#6495ed',
|
|
28
|
+
cornsilk: '#fff8dc',
|
|
29
|
+
crimson: '#dc143c',
|
|
30
|
+
cyan: '#00FFFF',
|
|
31
|
+
darkBlue: '#00008B',
|
|
32
|
+
dkBlue: '#00008B',
|
|
33
|
+
darkCyan: '#008B8B',
|
|
34
|
+
dkCyan: '#008B8B',
|
|
35
|
+
darkGoldenrod: '#b8860b',
|
|
36
|
+
dkGoldenrod: '#b8860b',
|
|
37
|
+
darkGray: '#A9A9A9',
|
|
38
|
+
dkGray: '#A9A9A9',
|
|
39
|
+
darkGreen: '#006400',
|
|
40
|
+
dkGreen: '#006400',
|
|
41
|
+
darkGrey: '#a9a9a9',
|
|
42
|
+
dkGrey: '#a9a9a9',
|
|
43
|
+
darkKhaki: '#bdb76b',
|
|
44
|
+
dkKhaki: '#bdb76b',
|
|
45
|
+
darkMagenta: '#800080',
|
|
46
|
+
dkMagenta: '#800080',
|
|
47
|
+
darkOliveGreen: '#556b2f',
|
|
48
|
+
dkOliveGreen: '#556b2f',
|
|
49
|
+
darkOrange: '#ff8c00',
|
|
50
|
+
dkOrange: '#ff8c00',
|
|
51
|
+
darkOrchid: '#9932cc',
|
|
52
|
+
dkOrchid: '#9932cc',
|
|
53
|
+
darkRed: '#8B0000',
|
|
54
|
+
dkRed: '#8B0000',
|
|
55
|
+
darkSalmon: '#e9967a',
|
|
56
|
+
dkSalmon: '#e9967a',
|
|
57
|
+
darkSeaGreen: '#8fbc8f',
|
|
58
|
+
dkSeaGreen: '#8fbc8f',
|
|
59
|
+
darkSlateBlue: '#483d8b',
|
|
60
|
+
dkSlateBlue: '#483d8b',
|
|
61
|
+
darkSlateGray: '#2f4f4f',
|
|
62
|
+
dkSlateGray: '#2f4f4f',
|
|
63
|
+
darkSlateGrey: '#2f4f4f',
|
|
64
|
+
dkSlateGrey: '#2f4f4f',
|
|
65
|
+
darkTurquoise: '#00ced1',
|
|
66
|
+
dkTurquoise: '#00ced1',
|
|
67
|
+
darkViolet: '#9400d3',
|
|
68
|
+
dkViolet: '#9400d3',
|
|
69
|
+
darkYellow: '#808000',
|
|
70
|
+
deepPink: '#ff1493',
|
|
71
|
+
deepSkyBlue: '#00bfff',
|
|
72
|
+
dimGray: '#696969',
|
|
73
|
+
dimGrey: '#696969',
|
|
74
|
+
dodgerBlue: '#1e90ff',
|
|
75
|
+
firebrick: '#b22222',
|
|
76
|
+
floralWhite: '#fffaf0',
|
|
77
|
+
forestGreen: '#228b22',
|
|
78
|
+
fuchsia: '#ff00ff',
|
|
79
|
+
gainsboro: '#dcdcdc',
|
|
80
|
+
ghostWhite: '#f8f8ff',
|
|
81
|
+
gold: '#ffd700',
|
|
82
|
+
goldenrod: '#daa520',
|
|
83
|
+
gray: '#808080',
|
|
84
|
+
green: '#008000',
|
|
85
|
+
greenYellow: '#adff2f',
|
|
86
|
+
grey: '#808080',
|
|
87
|
+
honeydew: '#f0fff0',
|
|
88
|
+
hotPink: '#ff69b4',
|
|
89
|
+
indianRed: '#cd5c5c',
|
|
90
|
+
indigo: '#4b0082',
|
|
91
|
+
ivory: '#fffff0',
|
|
92
|
+
khaki: '#f0e68c',
|
|
93
|
+
lavender: '#e6e6fa',
|
|
94
|
+
lavenderBlush: '#fff0f5',
|
|
95
|
+
lawnGreen: '#7cfc00',
|
|
96
|
+
lemonChiffon: '#fffacd',
|
|
97
|
+
lightBlue: '#add8e6',
|
|
98
|
+
ltBlue: '#add8e6',
|
|
99
|
+
lightCoral: '#f08080',
|
|
100
|
+
ltCoral: '#f08080',
|
|
101
|
+
lightCyan: '#e0ffff',
|
|
102
|
+
ltCyan: '#e0ffff',
|
|
103
|
+
lightGoldenrodYellow: '#fafad2',
|
|
104
|
+
ltGoldenrodYellow: '#fafad2',
|
|
105
|
+
lightGray: '#D3D3D3',
|
|
106
|
+
ltGray: '#D3D3D3',
|
|
107
|
+
lightGreen: '#90ee90',
|
|
108
|
+
ltGreen: '#90ee90',
|
|
109
|
+
lightGrey: '#d3d3d3',
|
|
110
|
+
ltGrey: '#d3d3d3',
|
|
111
|
+
lightPink: '#ffb6c1',
|
|
112
|
+
ltPink: '#ffb6c1',
|
|
113
|
+
lightSalmon: '#ffa07a',
|
|
114
|
+
ltSalmon: '#ffa07a',
|
|
115
|
+
lightSeaGreen: '#20b2aa',
|
|
116
|
+
ltSeaGreen: '#20b2aa',
|
|
117
|
+
lightSkyBlue: '#87cefa',
|
|
118
|
+
ltSkyBlue: '#87cefa',
|
|
119
|
+
lightSlateGray: '#778899',
|
|
120
|
+
ltSlateGray: '#778899',
|
|
121
|
+
lightSlateGrey: '#778899',
|
|
122
|
+
ltSlateGrey: '#778899',
|
|
123
|
+
lightSteelBlue: '#b0c4de',
|
|
124
|
+
ltSteelBlue: '#b0c4de',
|
|
125
|
+
lightYellow: '#ffffe0',
|
|
126
|
+
ltYellow: '#ffffe0',
|
|
127
|
+
lime: '#00ff00',
|
|
128
|
+
limeGreen: '#32cd32',
|
|
129
|
+
linen: '#faf0e6',
|
|
130
|
+
magenta: '#FF00FF',
|
|
131
|
+
maroon: '#800000',
|
|
132
|
+
mediumAquamarine: '#66cdaa',
|
|
133
|
+
medAquamarine: '#66cdaa',
|
|
134
|
+
mediumBlue: '#0000cd',
|
|
135
|
+
medBlue: '#0000cd',
|
|
136
|
+
mediumOrchid: '#ba55d3',
|
|
137
|
+
medOrchid: '#ba55d3',
|
|
138
|
+
mediumPurple: '#9370db',
|
|
139
|
+
medPurple: '#9370db',
|
|
140
|
+
mediumSeaGreen: '#3cb371',
|
|
141
|
+
medSeaGreen: '#3cb371',
|
|
142
|
+
mediumSlateBlue: '#7b68ee',
|
|
143
|
+
medSlateBlue: '#7b68ee',
|
|
144
|
+
mediumSpringGreen: '#00fa9a',
|
|
145
|
+
medSpringGreen: '#00fa9a',
|
|
146
|
+
mediumTurquoise: '#48d1cc',
|
|
147
|
+
medTurquoise: '#48d1cc',
|
|
148
|
+
mediumVioletRed: '#c71585',
|
|
149
|
+
medVioletRed: '#c71585',
|
|
150
|
+
midnightBlue: '#191970',
|
|
151
|
+
mintCream: '#f5fffa',
|
|
152
|
+
mistyRose: '#ffe4e1',
|
|
153
|
+
moccasin: '#ffe4b5',
|
|
154
|
+
navajoWhite: '#ffdead',
|
|
155
|
+
navy: '#000080',
|
|
156
|
+
none: 'transparent',
|
|
157
|
+
oldLace: '#fdf5e6',
|
|
158
|
+
olive: '#808000',
|
|
159
|
+
oliveDrab: '#6b8e23',
|
|
160
|
+
orange: '#ffa500',
|
|
161
|
+
orangeRed: '#ff4500',
|
|
162
|
+
orchid: '#da70d6',
|
|
163
|
+
paleGoldenrod: '#eee8aa',
|
|
164
|
+
paleGreen: '#98fb98',
|
|
165
|
+
paleTurquoise: '#afeeee',
|
|
166
|
+
paleVioletRed: '#db7093',
|
|
167
|
+
papayaWhip: '#ffefd5',
|
|
168
|
+
peachPuff: '#ffdab9',
|
|
169
|
+
peru: '#cd853f',
|
|
170
|
+
pink: '#ffc0cb',
|
|
171
|
+
plum: '#dda0dd',
|
|
172
|
+
powderBlue: '#b0e0e6',
|
|
173
|
+
purple: '#800080',
|
|
174
|
+
rebeccaPurple: '#663399',
|
|
175
|
+
red: '#ff0000',
|
|
176
|
+
rosyBrown: '#bc8f8f',
|
|
177
|
+
royalBlue: '#4169e1',
|
|
178
|
+
saddleBrown: '#8b4513',
|
|
179
|
+
salmon: '#fa8072',
|
|
180
|
+
sandyBrown: '#f4a460',
|
|
181
|
+
seaGreen: '#2e8b57',
|
|
182
|
+
seaShell: '#fff5ee',
|
|
183
|
+
sienna: '#a0522d',
|
|
184
|
+
silver: '#c0c0c0',
|
|
185
|
+
skyBlue: '#87ceeb',
|
|
186
|
+
slateBlue: '#6a5acd',
|
|
187
|
+
slateGray: '#708090',
|
|
188
|
+
slateGrey: '#708090',
|
|
189
|
+
snow: '#fffafa',
|
|
190
|
+
springGreen: '#00ff7f',
|
|
191
|
+
steelBlue: '#4682b4',
|
|
192
|
+
tan: '#d2b48c',
|
|
193
|
+
teal: '#008080',
|
|
194
|
+
thistle: '#d8bfd8',
|
|
195
|
+
tomato: '#ff6347',
|
|
196
|
+
turquoise: '#40e0d0',
|
|
197
|
+
violet: '#ee82ee',
|
|
198
|
+
wheat: '#f5deb3',
|
|
199
|
+
white: '#ffffff',
|
|
200
|
+
whiteSmoke: '#f5f5f5',
|
|
201
|
+
yellow: '#ffff00',
|
|
202
|
+
yellowGreen: '#9acd32'
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
exports.PresetColorMap = PresetColorMap;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var tslib = require('tslib');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 将 sdt 内容合并到上层节点,返回合并后的数组
|
|
9
|
+
*/
|
|
10
|
+
function flattenSdtArray(arr) {
|
|
11
|
+
var e_1, _a;
|
|
12
|
+
var returnArray = arr.slice();
|
|
13
|
+
var index = 0;
|
|
14
|
+
// 如果 sdt 里还有 sdt 就需要递归
|
|
15
|
+
var needRecursion = false;
|
|
16
|
+
try {
|
|
17
|
+
for (var arr_1 = tslib.__values(arr), arr_1_1 = arr_1.next(); !arr_1_1.done; arr_1_1 = arr_1.next()) {
|
|
18
|
+
var child = arr_1_1.value;
|
|
19
|
+
var tagName = child.tagName;
|
|
20
|
+
switch (tagName) {
|
|
21
|
+
case 'w:smartTag':
|
|
22
|
+
case 'w:customXml':
|
|
23
|
+
var customXMLChildren = [].slice.call(child.children);
|
|
24
|
+
returnArray.splice.apply(returnArray, tslib.__spreadArray([index, 1], tslib.__read(customXMLChildren), false));
|
|
25
|
+
index = index + customXMLChildren.length;
|
|
26
|
+
continue;
|
|
27
|
+
case 'w:sdt':
|
|
28
|
+
var sdtContent = child.getElementsByTagName('w:sdtContent').item(0);
|
|
29
|
+
var childSdt = child.getElementsByTagName('w:sdt').item(0);
|
|
30
|
+
if (childSdt) {
|
|
31
|
+
needRecursion = true;
|
|
32
|
+
}
|
|
33
|
+
if (sdtContent) {
|
|
34
|
+
var sdtContentChildren = [].slice.call(sdtContent.children);
|
|
35
|
+
returnArray.splice.apply(returnArray, tslib.__spreadArray([index, 1], tslib.__read(sdtContentChildren), false));
|
|
36
|
+
index = index + sdtContentChildren.length;
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
index = index + 1;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
45
|
+
finally {
|
|
46
|
+
try {
|
|
47
|
+
if (arr_1_1 && !arr_1_1.done && (_a = arr_1.return)) _a.call(arr_1);
|
|
48
|
+
}
|
|
49
|
+
finally { if (e_1) throw e_1.error; }
|
|
50
|
+
}
|
|
51
|
+
if (needRecursion) {
|
|
52
|
+
return flattenSdtArray(returnArray);
|
|
53
|
+
}
|
|
54
|
+
return returnArray;
|
|
55
|
+
}
|
|
56
|
+
function mergeSdt(element) {
|
|
57
|
+
var arr = [].slice.call(element.children);
|
|
58
|
+
return flattenSdtArray(arr);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
exports.mergeSdt = mergeSdt;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function modifyColor(element: Element, colorStr: string): string;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var tslib = require('tslib');
|
|
6
|
+
var OpenXML = require('../OpenXML.js');
|
|
7
|
+
var color = require('../util/color.js');
|
|
8
|
+
var parseSize = require('./parseSize.js');
|
|
9
|
+
|
|
10
|
+
// 处理颜色变化
|
|
11
|
+
// 20.1.2.3
|
|
12
|
+
function modifyColor(element, colorStr) {
|
|
13
|
+
var e_1, _a;
|
|
14
|
+
var color$1 = new color.Color(colorStr);
|
|
15
|
+
if (color$1.isValid) {
|
|
16
|
+
var alpha = 1;
|
|
17
|
+
try {
|
|
18
|
+
for (var _b = tslib.__values(element.children), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
19
|
+
var child = _c.value;
|
|
20
|
+
var tagName = child.tagName;
|
|
21
|
+
switch (tagName) {
|
|
22
|
+
case 'a:alpha':
|
|
23
|
+
case 'w14:alpha':
|
|
24
|
+
alpha = OpenXML.getAttrPercent(child, 'val');
|
|
25
|
+
break;
|
|
26
|
+
case 'a:blue':
|
|
27
|
+
color$1.b = 256 * OpenXML.getAttrPercent(child, 'val');
|
|
28
|
+
break;
|
|
29
|
+
case 'a:blueMod':
|
|
30
|
+
color$1.b = color$1.b * OpenXML.getAttrPercent(child, 'val');
|
|
31
|
+
break;
|
|
32
|
+
case 'a:blueOff':
|
|
33
|
+
color$1.b += color$1.b * OpenXML.getAttrPercent(child, 'val');
|
|
34
|
+
break;
|
|
35
|
+
case 'a:comp':
|
|
36
|
+
color$1.comp();
|
|
37
|
+
break;
|
|
38
|
+
case 'a:green':
|
|
39
|
+
color$1.g = 256 * OpenXML.getAttrPercent(child, 'val');
|
|
40
|
+
break;
|
|
41
|
+
case 'a:greenMod':
|
|
42
|
+
color$1.g = color$1.g * OpenXML.getAttrPercent(child, 'val');
|
|
43
|
+
break;
|
|
44
|
+
case 'a:greenOff':
|
|
45
|
+
color$1.g += color$1.g * OpenXML.getAttrPercent(child, 'val');
|
|
46
|
+
break;
|
|
47
|
+
case 'a:red':
|
|
48
|
+
color$1.r = 256 * OpenXML.getAttrPercent(child, 'val');
|
|
49
|
+
break;
|
|
50
|
+
case 'a:redMod':
|
|
51
|
+
color$1.r = color$1.r * OpenXML.getAttrPercent(child, 'val');
|
|
52
|
+
break;
|
|
53
|
+
case 'a:redOff':
|
|
54
|
+
color$1.r += color$1.r * OpenXML.getAttrPercent(child, 'val');
|
|
55
|
+
break;
|
|
56
|
+
case 'a:lum':
|
|
57
|
+
color$1.lum(OpenXML.getAttrPercent(child, 'val'));
|
|
58
|
+
break;
|
|
59
|
+
case 'a:lumMod':
|
|
60
|
+
color$1.lumMod(OpenXML.getAttrPercent(child, 'val'));
|
|
61
|
+
break;
|
|
62
|
+
case 'a:lumOff':
|
|
63
|
+
color$1.lumOff(OpenXML.getAttrPercent(child, 'val'));
|
|
64
|
+
break;
|
|
65
|
+
case 'a:hue':
|
|
66
|
+
color$1.hue(parseSize.convertAngle(child.getAttribute('hue')) / 360);
|
|
67
|
+
break;
|
|
68
|
+
case 'a:hueMod':
|
|
69
|
+
color$1.hueMod(OpenXML.getAttrPercent(child, 'val'));
|
|
70
|
+
break;
|
|
71
|
+
case 'a:hueOff':
|
|
72
|
+
color$1.hueOff(OpenXML.getAttrPercent(child, 'val'));
|
|
73
|
+
break;
|
|
74
|
+
case 'a:sat':
|
|
75
|
+
color$1.sat(OpenXML.getAttrPercent(child, 'val'));
|
|
76
|
+
break;
|
|
77
|
+
case 'a:satMod':
|
|
78
|
+
color$1.satMod(OpenXML.getAttrPercent(child, 'val'));
|
|
79
|
+
break;
|
|
80
|
+
case 'a:satOff':
|
|
81
|
+
color$1.satOff(OpenXML.getAttrPercent(child, 'val'));
|
|
82
|
+
break;
|
|
83
|
+
case 'a:shade':
|
|
84
|
+
color$1.shade(OpenXML.getAttrPercent(child, 'val'));
|
|
85
|
+
break;
|
|
86
|
+
case 'a:tint':
|
|
87
|
+
color$1.tint(OpenXML.getAttrPercent(child, 'val'));
|
|
88
|
+
break;
|
|
89
|
+
default:
|
|
90
|
+
console.log('unknown color modify', child);
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
96
|
+
finally {
|
|
97
|
+
try {
|
|
98
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
99
|
+
}
|
|
100
|
+
finally { if (e_1) throw e_1.error; }
|
|
101
|
+
}
|
|
102
|
+
if (alpha !== 1) {
|
|
103
|
+
return color$1.toRgba(alpha);
|
|
104
|
+
}
|
|
105
|
+
return color$1.toHex();
|
|
106
|
+
}
|
|
107
|
+
return colorStr;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
exports.modifyColor = modifyColor;
|
package/lib/parse/parseBorder.js
CHANGED
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var tslib = require('tslib');
|
|
6
6
|
var OpenXML = require('../OpenXML.js');
|
|
7
7
|
var parseColor = require('./parseColor.js');
|
|
8
8
|
var parseSize = require('./parseSize.js');
|
|
9
|
-
var Types = require('../openxml/Types.js');
|
|
10
9
|
|
|
11
10
|
// 默认边框颜色
|
|
12
11
|
var DEFAULT_BORDER_COLOR = 'black';
|
|
@@ -15,27 +14,9 @@ var DEFAULT_BORDER_COLOR = 'black';
|
|
|
15
14
|
*/
|
|
16
15
|
function parseBorder(word, element) {
|
|
17
16
|
var type = OpenXML.getVal(element);
|
|
18
|
-
if (type ===
|
|
17
|
+
if (type === 'nil' || type === 'none') {
|
|
19
18
|
return 'none';
|
|
20
19
|
}
|
|
21
|
-
// 这里和 css 不完全一致,css 能表现的要少很多,也是导致展现效果难以一致的原因
|
|
22
|
-
switch (type) {
|
|
23
|
-
case Types.ST_Border.dashed:
|
|
24
|
-
case Types.ST_Border.dashDotStroked:
|
|
25
|
-
case Types.ST_Border.dashSmallGap:
|
|
26
|
-
break;
|
|
27
|
-
case Types.ST_Border.dotDash:
|
|
28
|
-
case Types.ST_Border.dotDotDash:
|
|
29
|
-
case Types.ST_Border.dotted:
|
|
30
|
-
break;
|
|
31
|
-
case Types.ST_Border.double:
|
|
32
|
-
case Types.ST_Border.doubleWave:
|
|
33
|
-
break;
|
|
34
|
-
case Types.ST_Border.inset:
|
|
35
|
-
break;
|
|
36
|
-
case Types.ST_Border.outset:
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
20
|
var color = parseColor.parseColorAttr(word, element);
|
|
40
21
|
var size = parseSize.parseSize(element, 'w:sz', parseSize.LengthUsage.Border);
|
|
41
22
|
return "".concat(size, " solid ").concat(color == 'auto' ? DEFAULT_BORDER_COLOR : color);
|
|
@@ -46,7 +27,7 @@ function parseBorder(word, element) {
|
|
|
46
27
|
function parseBorders(word, element, style) {
|
|
47
28
|
var e_1, _a;
|
|
48
29
|
try {
|
|
49
|
-
for (var _b =
|
|
30
|
+
for (var _b = tslib.__values(element.children), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
50
31
|
var child = _c.value;
|
|
51
32
|
var tagName = child.tagName;
|
|
52
33
|
switch (tagName) {
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var tslib = require('tslib');
|
|
6
|
+
var parseSize = require('./parseSize.js');
|
|
7
|
+
|
|
8
|
+
// http://officeopenxml.com/WPtableCellProperties-Margins.php
|
|
9
|
+
function parseCellMargin(element, style) {
|
|
10
|
+
var e_1, _a;
|
|
11
|
+
try {
|
|
12
|
+
for (var _b = tslib.__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 'w:left':
|
|
17
|
+
case 'w:start':
|
|
18
|
+
style['padding-left'] = parseSize.parseSize(child, 'w:w');
|
|
19
|
+
break;
|
|
20
|
+
case 'w:right':
|
|
21
|
+
case 'w:end':
|
|
22
|
+
style['padding-right'] = parseSize.parseSize(child, 'w:w');
|
|
23
|
+
break;
|
|
24
|
+
case 'w:top':
|
|
25
|
+
style['padding-top'] = parseSize.parseSize(child, 'w:w');
|
|
26
|
+
break;
|
|
27
|
+
case 'w:bottom':
|
|
28
|
+
style['padding-bottom'] = parseSize.parseSize(child, 'w:w');
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
34
|
+
finally {
|
|
35
|
+
try {
|
|
36
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
37
|
+
}
|
|
38
|
+
finally { if (e_1) throw e_1.error; }
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
exports.parseCellMargin = parseCellMargin;
|