office-viewer 0.1.0 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -2
- package/esm/OpenXML.d.ts +19 -0
- package/esm/OpenXML.js +43 -2
- package/esm/Word.d.ts +132 -15
- package/esm/Word.js +233 -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 +35 -0
- package/esm/openxml/drawing/Drawing.js +169 -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 +2 -1
- package/esm/openxml/{word/drawing → drawing}/Transform.js +7 -3
- 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/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 +5 -0
- package/esm/openxml/word/wps/WPS.d.ts +18 -0
- package/esm/openxml/word/wps/WPS.js +147 -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 +129 -24
- 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 +26 -29
- 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 +35 -10
- 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 +1 -0
- package/esm/render/renderTab.js +4 -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/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 +214 -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 +238 -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 +35 -0
- package/lib/openxml/drawing/Drawing.js +173 -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 +2 -1
- package/lib/openxml/{word/drawing → drawing}/Transform.js +7 -3
- 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/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 +5 -0
- package/lib/openxml/word/wps/WPS.d.ts +18 -0
- package/lib/openxml/word/wps/WPS.js +151 -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 +129 -24
- 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 +26 -29
- 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 +34 -9
- 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 +1 -0
- package/lib/render/renderTab.js +4 -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/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 +219 -0
- package/lib/util/xml.js +4 -0
- package/package.json +17 -6
- 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/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
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* http://officeopenxml.com/WPtable.php
|
|
3
3
|
*/
|
|
4
|
-
import Word from '../../Word';
|
|
5
4
|
import { CSSStyle } from '../Style';
|
|
6
|
-
import { CT_TblLook } from '../Types';
|
|
7
5
|
import { Properties } from './properties/Properties';
|
|
8
|
-
import { Tr } from './table/Tr';
|
|
9
|
-
export type
|
|
6
|
+
import type { Tr } from './table/Tr';
|
|
7
|
+
export type TblLookKey = 'firstRow' | 'firstRow' | 'lastRow' | 'firstColumn' | 'lastColumn' | 'noHBand' | 'noVBand';
|
|
10
8
|
export interface TablePr extends Properties {
|
|
11
9
|
/**
|
|
12
10
|
* 表格标题
|
|
@@ -26,7 +24,7 @@ export interface TablePr extends Properties {
|
|
|
26
24
|
/**
|
|
27
25
|
* 条件格式
|
|
28
26
|
*/
|
|
29
|
-
tblLook?: Record<
|
|
27
|
+
tblLook?: Record<TblLookKey, boolean>;
|
|
30
28
|
/**
|
|
31
29
|
* 行间隔
|
|
32
30
|
*/
|
|
@@ -36,14 +34,11 @@ export interface TablePr extends Properties {
|
|
|
36
34
|
*/
|
|
37
35
|
colBandSize?: number;
|
|
38
36
|
}
|
|
39
|
-
interface GridCol {
|
|
37
|
+
export interface GridCol {
|
|
40
38
|
w: string;
|
|
41
39
|
}
|
|
42
40
|
export declare class Table {
|
|
43
41
|
properties: TablePr;
|
|
44
42
|
tblGrid: GridCol[];
|
|
45
43
|
trs: Tr[];
|
|
46
|
-
static parseTablePr(word: Word, element: Element): TablePr;
|
|
47
|
-
static fromXML(word: Word, element: Element): Table;
|
|
48
44
|
}
|
|
49
|
-
export {};
|
|
@@ -2,250 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var tslib_es6 = require('../../node_modules/tslib/tslib.es6.js');
|
|
6
|
-
var OpenXML = require('../../OpenXML.js');
|
|
7
|
-
var parseBorder = require('../../parse/parseBorder.js');
|
|
8
|
-
var parseColor = require('../../parse/parseColor.js');
|
|
9
|
-
var parseSize = require('../../parse/parseSize.js');
|
|
10
|
-
var Types = require('../Types.js');
|
|
11
|
-
var Tc = require('./table/Tc.js');
|
|
12
|
-
var Tr = require('./table/Tr.js');
|
|
13
|
-
|
|
14
5
|
/**
|
|
15
6
|
* http://officeopenxml.com/WPtable.php
|
|
16
7
|
*/
|
|
17
|
-
/**
|
|
18
|
-
* 表格的 jc 需要使用 float 来实现
|
|
19
|
-
* http://officeopenxml.com/WPtableAlignment.php
|
|
20
|
-
*/
|
|
21
|
-
function parseTblJc(element, cssStyle) {
|
|
22
|
-
var val = OpenXML.getVal(element);
|
|
23
|
-
switch (val) {
|
|
24
|
-
case 'left':
|
|
25
|
-
case 'start':
|
|
26
|
-
// TODO: 会导致前面的文字掉下去,感觉还是不能支持这个功能
|
|
27
|
-
// cssStyle['float'] = 'left';
|
|
28
|
-
break;
|
|
29
|
-
case 'right':
|
|
30
|
-
case 'end':
|
|
31
|
-
cssStyle['float'] = 'right';
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* 这个其实分左右,但目前只支持左,右可能是阿拉伯语?
|
|
36
|
-
* http://webapp.docx4java.org/OnlineDemo/ecma376/WordML/tblInd_2.html
|
|
37
|
-
*/
|
|
38
|
-
function parseTblInd(element, style) {
|
|
39
|
-
var width = Tc.parseTblWidth(element);
|
|
40
|
-
if (width) {
|
|
41
|
-
style['margin-left'] = width;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
function parseTblW(element, style) {
|
|
45
|
-
var width = Tc.parseTblWidth(element);
|
|
46
|
-
if (width) {
|
|
47
|
-
style['width'] = width;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* http://officeopenxml.com/WPtableLayout.php
|
|
52
|
-
*/
|
|
53
|
-
function parseTblLayout(element, style) {
|
|
54
|
-
var type = element.getAttribute('w:type');
|
|
55
|
-
if (type === Types.ST_TblLayoutType.fixed) {
|
|
56
|
-
style['table-layout'] = 'fixed';
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
function parseTblGrid(element) {
|
|
60
|
-
var e_1, _a;
|
|
61
|
-
var gridCol = [];
|
|
62
|
-
var gridColElements = element.getElementsByTagName('w:gridCol');
|
|
63
|
-
try {
|
|
64
|
-
for (var gridColElements_1 = tslib_es6.__values(gridColElements), gridColElements_1_1 = gridColElements_1.next(); !gridColElements_1_1.done; gridColElements_1_1 = gridColElements_1.next()) {
|
|
65
|
-
var gridColElement = gridColElements_1_1.value;
|
|
66
|
-
var w = parseSize.parseSize(gridColElement, 'w:w');
|
|
67
|
-
gridCol.push({ w: w });
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
71
|
-
finally {
|
|
72
|
-
try {
|
|
73
|
-
if (gridColElements_1_1 && !gridColElements_1_1.done && (_a = gridColElements_1.return)) _a.call(gridColElements_1);
|
|
74
|
-
}
|
|
75
|
-
finally { if (e_1) throw e_1.error; }
|
|
76
|
-
}
|
|
77
|
-
return gridCol;
|
|
78
|
-
}
|
|
79
|
-
// http://webapp.docx4java.org/OnlineDemo/ecma376/WordML/ST_TblStyleOverrideType.html
|
|
80
|
-
// val 是旧的格式
|
|
81
|
-
function parseTblLook(child) {
|
|
82
|
-
var tblLook = {};
|
|
83
|
-
var tblLookVal = OpenXML.getValHex(child);
|
|
84
|
-
if (OpenXML.getAttrBoolean(child, 'firstRow', false) || tblLookVal & 0x0020) {
|
|
85
|
-
tblLook['firstRow'] = true;
|
|
86
|
-
}
|
|
87
|
-
if (OpenXML.getAttrBoolean(child, 'lastRow', false) || tblLookVal & 0x0040) {
|
|
88
|
-
tblLook['lastRow'] = true;
|
|
89
|
-
}
|
|
90
|
-
if (OpenXML.getAttrBoolean(child, 'firstColumn', false) || tblLookVal & 0x0080) {
|
|
91
|
-
tblLook['firstColumn'] = true;
|
|
92
|
-
}
|
|
93
|
-
if (OpenXML.getAttrBoolean(child, 'lastColumn', false) || tblLookVal & 0x0100) {
|
|
94
|
-
tblLook['lastColumn'] = true;
|
|
95
|
-
}
|
|
96
|
-
if (OpenXML.getAttrBoolean(child, 'noHBand', false) || tblLookVal & 0x0200) {
|
|
97
|
-
tblLook['noHBand'] = true;
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
tblLook['noHBand'] = false;
|
|
101
|
-
}
|
|
102
|
-
if (OpenXML.getAttrBoolean(child, 'noVBand', false) || tblLookVal & 0x0400) {
|
|
103
|
-
tblLook['noVBand'] = true;
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
tblLook['noVBand'] = false;
|
|
107
|
-
}
|
|
108
|
-
return tblLook;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* http://webapp.docx4java.org/OnlineDemo/ecma376/WordML/tblpPr.html
|
|
112
|
-
* 只支持部分
|
|
113
|
-
*/
|
|
114
|
-
function parsetTlpPr(word, child, style) {
|
|
115
|
-
// 如果设置 padding 会导致绝对定位不准确,所以一旦设置就不支持
|
|
116
|
-
if (typeof word.renderOptions.padding === 'undefined') {
|
|
117
|
-
var tplpX = parseSize.parseSize(child, 'w:tblpX');
|
|
118
|
-
var tplpY = parseSize.parseSize(child, 'w:tblpY');
|
|
119
|
-
style.position = 'absolute';
|
|
120
|
-
style.top = tplpY;
|
|
121
|
-
style.left = tplpX;
|
|
122
|
-
}
|
|
123
|
-
// 之前想用 float 来实现,但是会导致文字掉下去
|
|
124
|
-
// const topFromText = parseSize(child, 'w:topFromText');
|
|
125
|
-
// const bottomFromText = parseSize(child, 'w:bottomFromText');
|
|
126
|
-
// const rightFromText = parseSize(child, 'w:rightFromText');
|
|
127
|
-
// const leftFromText = parseSize(child, 'w:leftFromText');
|
|
128
|
-
// style['float'] = 'left';
|
|
129
|
-
// style['margin-bottom'] = addSize(style['margin-bottom'], bottomFromText);
|
|
130
|
-
// style['margin-left'] = addSize(style['margin-left'], leftFromText);
|
|
131
|
-
// style['margin-right'] = addSize(style['margin-right'], rightFromText);
|
|
132
|
-
// style['margin-top'] = addSize(style['margin-top'], topFromText);
|
|
133
|
-
}
|
|
134
8
|
var Table = /** @class */ (function () {
|
|
135
9
|
function Table() {
|
|
136
10
|
this.properties = {};
|
|
137
11
|
this.tblGrid = [];
|
|
138
12
|
this.trs = [];
|
|
139
13
|
}
|
|
140
|
-
Table.parseTablePr = function (word, element) {
|
|
141
|
-
var e_2, _a;
|
|
142
|
-
var properties = {};
|
|
143
|
-
var tableStyle = {};
|
|
144
|
-
var tcStyle = {};
|
|
145
|
-
properties.tblLook = {};
|
|
146
|
-
properties.cssStyle = tableStyle;
|
|
147
|
-
properties.tcCSSStyle = tcStyle;
|
|
148
|
-
try {
|
|
149
|
-
for (var _b = tslib_es6.__values(element.children), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
150
|
-
var child = _c.value;
|
|
151
|
-
var tagName = child.tagName;
|
|
152
|
-
switch (tagName) {
|
|
153
|
-
case 'w:tblBorders':
|
|
154
|
-
parseBorder.parseBorders(word, child, tableStyle);
|
|
155
|
-
properties.insideBorder = Tc.parseInsideBorders(word, child);
|
|
156
|
-
break;
|
|
157
|
-
case 'w:tcBorders':
|
|
158
|
-
parseBorder.parseBorders(word, child, tableStyle);
|
|
159
|
-
break;
|
|
160
|
-
case 'w:tblInd':
|
|
161
|
-
parseTblInd(child, tableStyle);
|
|
162
|
-
break;
|
|
163
|
-
case 'w:jc':
|
|
164
|
-
parseTblJc(child, tableStyle);
|
|
165
|
-
break;
|
|
166
|
-
case 'w:tblCellMar':
|
|
167
|
-
case 'w:tcMar':
|
|
168
|
-
// http://webapp.docx4java.org/OnlineDemo/ecma376/WordML/tblCellMar_1.html
|
|
169
|
-
Tc.parseCellMargin(child, tcStyle);
|
|
170
|
-
break;
|
|
171
|
-
case 'w:tblStyle':
|
|
172
|
-
properties.pStyle = OpenXML.getVal(child);
|
|
173
|
-
break;
|
|
174
|
-
case 'w:tblW':
|
|
175
|
-
parseTblW(child, tableStyle);
|
|
176
|
-
break;
|
|
177
|
-
case 'w:shd':
|
|
178
|
-
// http://officeopenxml.com/WPtableShading.php
|
|
179
|
-
tableStyle['background-color'] = parseColor.parseShdColor(word, child);
|
|
180
|
-
break;
|
|
181
|
-
case 'w:tblCaption':
|
|
182
|
-
properties.tblCaption = OpenXML.getVal(child);
|
|
183
|
-
break;
|
|
184
|
-
case 'w:tblCellSpacing':
|
|
185
|
-
Tc.parseTblCellSpacing(child, tableStyle);
|
|
186
|
-
break;
|
|
187
|
-
case 'w:tblLayout':
|
|
188
|
-
parseTblLayout(child, tableStyle);
|
|
189
|
-
break;
|
|
190
|
-
case 'w:tblLook':
|
|
191
|
-
properties.tblLook = parseTblLook(child);
|
|
192
|
-
break;
|
|
193
|
-
case 'w:tblStyleRowBandSize':
|
|
194
|
-
properties.rowBandSize = OpenXML.getValNumber(child);
|
|
195
|
-
break;
|
|
196
|
-
case 'w:tblStyleColBandSize':
|
|
197
|
-
properties.colBandSize = OpenXML.getValNumber(child);
|
|
198
|
-
break;
|
|
199
|
-
case 'w:tblpPr':
|
|
200
|
-
parsetTlpPr(word, child, tableStyle);
|
|
201
|
-
break;
|
|
202
|
-
default:
|
|
203
|
-
console.warn('parseTableProperties unknown tag', tagName, child);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
208
|
-
finally {
|
|
209
|
-
try {
|
|
210
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
211
|
-
}
|
|
212
|
-
finally { if (e_2) throw e_2.error; }
|
|
213
|
-
}
|
|
214
|
-
return properties;
|
|
215
|
-
};
|
|
216
|
-
Table.fromXML = function (word, element) {
|
|
217
|
-
var e_3, _a;
|
|
218
|
-
var table = new Table();
|
|
219
|
-
// 用于计算列的跨行,这里记下前面的跨行情况
|
|
220
|
-
var rowSpanMap = {};
|
|
221
|
-
try {
|
|
222
|
-
for (var _b = tslib_es6.__values(element.children), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
223
|
-
var child = _c.value;
|
|
224
|
-
var tagName = child.tagName;
|
|
225
|
-
switch (tagName) {
|
|
226
|
-
case 'w:tblPr':
|
|
227
|
-
table.properties = Table.parseTablePr(word, child);
|
|
228
|
-
break;
|
|
229
|
-
case 'w:tr':
|
|
230
|
-
table.trs.push(Tr.Tr.fromXML(word, child, rowSpanMap));
|
|
231
|
-
break;
|
|
232
|
-
case 'w:tblGrid':
|
|
233
|
-
table.tblGrid = parseTblGrid(child);
|
|
234
|
-
break;
|
|
235
|
-
default:
|
|
236
|
-
console.warn('Table.fromXML unknown tag', tagName, child);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
241
|
-
finally {
|
|
242
|
-
try {
|
|
243
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
244
|
-
}
|
|
245
|
-
finally { if (e_3) throw e_3.error; }
|
|
246
|
-
}
|
|
247
|
-
return table;
|
|
248
|
-
};
|
|
249
14
|
return Table;
|
|
250
15
|
}());
|
|
251
16
|
|
|
@@ -4,10 +4,9 @@
|
|
|
4
4
|
* http://webapp.docx4java.org/OnlineDemo/ecma376/WordML/Main%20Document%20Story.html
|
|
5
5
|
*/
|
|
6
6
|
import Word from '../../Word';
|
|
7
|
-
import { DocumentBackground } from './Background';
|
|
8
7
|
import { Body } from './Body';
|
|
9
8
|
export declare class WDocument {
|
|
10
9
|
body: Body;
|
|
11
|
-
|
|
10
|
+
backgroundColor?: string;
|
|
12
11
|
static fromXML(word: Word, element: Document): WDocument;
|
|
13
12
|
}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var tslib = require('tslib');
|
|
6
|
+
var color = require('../../util/color.js');
|
|
6
7
|
var parseColor = require('../../parse/parseColor.js');
|
|
7
8
|
var Body = require('./Body.js');
|
|
8
9
|
|
|
@@ -11,22 +12,44 @@ var Body = require('./Body.js');
|
|
|
11
12
|
* http://webapp.docx4java.org/OnlineDemo/ecma376/WordML/document.html
|
|
12
13
|
* http://webapp.docx4java.org/OnlineDemo/ecma376/WordML/Main%20Document%20Story.html
|
|
13
14
|
*/
|
|
15
|
+
/**
|
|
16
|
+
* 计算出最终实际背景色
|
|
17
|
+
*/
|
|
18
|
+
function getBackgroundColor(documentBackground) {
|
|
19
|
+
if (documentBackground.color) {
|
|
20
|
+
return documentBackground.color;
|
|
21
|
+
}
|
|
22
|
+
if (documentBackground.themeColor) {
|
|
23
|
+
var themeColor = documentBackground.themeColor;
|
|
24
|
+
if (documentBackground.themeTint) {
|
|
25
|
+
var color$1 = new color.Color(themeColor);
|
|
26
|
+
var themeShade = parseInt(documentBackground.themeTint, 16);
|
|
27
|
+
color$1.tint(themeShade / 256);
|
|
28
|
+
}
|
|
29
|
+
else if (documentBackground.themeShade) {
|
|
30
|
+
var color$1 = new color.Color(themeColor);
|
|
31
|
+
var themeShade = parseInt(documentBackground.themeShade, 16);
|
|
32
|
+
color$1.lumMod(themeShade / 256);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return '#FFFFF';
|
|
36
|
+
}
|
|
14
37
|
var WDocument = /** @class */ (function () {
|
|
15
38
|
function WDocument() {
|
|
16
39
|
}
|
|
17
40
|
WDocument.fromXML = function (word, element) {
|
|
18
|
-
var e_1, _a;
|
|
41
|
+
var e_1, _a, e_2, _b;
|
|
19
42
|
var doc = new WDocument();
|
|
20
|
-
var body = element.
|
|
43
|
+
var body = element.getElementsByTagName('w:body').item(0);
|
|
21
44
|
if (body) {
|
|
22
45
|
doc.body = Body.Body.fromXML(word, body);
|
|
23
46
|
}
|
|
24
|
-
var background = element.
|
|
47
|
+
var background = element.getElementsByTagName('w:background').item(0);
|
|
25
48
|
if (background) {
|
|
26
49
|
var documentBackground = {};
|
|
27
50
|
try {
|
|
28
|
-
for (var
|
|
29
|
-
var attr =
|
|
51
|
+
for (var _c = tslib.__values(background.attributes), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
52
|
+
var attr = _d.value;
|
|
30
53
|
var name_1 = attr.name;
|
|
31
54
|
switch (name_1) {
|
|
32
55
|
case 'w:color':
|
|
@@ -42,6 +65,7 @@ var WDocument = /** @class */ (function () {
|
|
|
42
65
|
documentBackground.themeTint = parseColor.parseColorAttr(word, background, 'w:themeTint');
|
|
43
66
|
break;
|
|
44
67
|
default:
|
|
68
|
+
console.log('unknown background', background);
|
|
45
69
|
break;
|
|
46
70
|
}
|
|
47
71
|
}
|
|
@@ -49,10 +73,32 @@ var WDocument = /** @class */ (function () {
|
|
|
49
73
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
50
74
|
finally {
|
|
51
75
|
try {
|
|
52
|
-
if (
|
|
76
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
53
77
|
}
|
|
54
78
|
finally { if (e_1) throw e_1.error; }
|
|
55
79
|
}
|
|
80
|
+
try {
|
|
81
|
+
for (var _e = tslib.__values(background.children), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
82
|
+
var child = _f.value;
|
|
83
|
+
var name_2 = child.tagName;
|
|
84
|
+
switch (name_2) {
|
|
85
|
+
case 'v:background':
|
|
86
|
+
// vml 的背景色,不支持
|
|
87
|
+
break;
|
|
88
|
+
default:
|
|
89
|
+
console.log('unknown background', background);
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
95
|
+
finally {
|
|
96
|
+
try {
|
|
97
|
+
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
98
|
+
}
|
|
99
|
+
finally { if (e_2) throw e_2.error; }
|
|
100
|
+
}
|
|
101
|
+
doc.backgroundColor = getBackgroundColor(documentBackground);
|
|
56
102
|
}
|
|
57
103
|
return doc;
|
|
58
104
|
};
|
|
@@ -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
|
var Lvl = require('./Lvl.js');
|
|
7
7
|
var OpenXML = require('../../../OpenXML.js');
|
|
8
8
|
|
|
@@ -21,7 +21,7 @@ var AbstractNum = /** @class */ (function () {
|
|
|
21
21
|
abstractNum.multiLevelType = element.getAttribute('w:multiLevelType');
|
|
22
22
|
var lvls = element.getElementsByTagName('w:lvl');
|
|
23
23
|
try {
|
|
24
|
-
for (var lvls_1 =
|
|
24
|
+
for (var lvls_1 = tslib.__values(lvls), lvls_1_1 = lvls_1.next(); !lvls_1_1.done; lvls_1_1 = lvls_1.next()) {
|
|
25
25
|
var child = lvls_1_1.value;
|
|
26
26
|
var lvlId = child.getAttribute('w:ilvl') || '';
|
|
27
27
|
abstractNum.lvls[lvlId] = Lvl.Lvl.fromXML(word, child);
|
|
@@ -34,7 +34,9 @@ var AbstractNum = /** @class */ (function () {
|
|
|
34
34
|
}
|
|
35
35
|
finally { if (e_1) throw e_1.error; }
|
|
36
36
|
}
|
|
37
|
-
var multiLevelType = element
|
|
37
|
+
var multiLevelType = element
|
|
38
|
+
.getElementsByTagName('w:multiLevelType')
|
|
39
|
+
.item(0);
|
|
38
40
|
if (multiLevelType) {
|
|
39
41
|
abstractNum.multiLevelType = OpenXML.getVal(multiLevelType);
|
|
40
42
|
}
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var tslib = require('tslib');
|
|
6
6
|
var Run = require('../Run.js');
|
|
7
7
|
var OpenXML = require('../../../OpenXML.js');
|
|
8
|
-
var Types = require('../../Types.js');
|
|
9
8
|
var Paragraph = require('../Paragraph.js');
|
|
10
9
|
|
|
11
10
|
var Lvl = /** @class */ (function () {
|
|
@@ -13,15 +12,15 @@ var Lvl = /** @class */ (function () {
|
|
|
13
12
|
this.start = 1;
|
|
14
13
|
this.lvlText = '%1.';
|
|
15
14
|
this.isLgl = false;
|
|
16
|
-
this.lvlJc =
|
|
17
|
-
this.suff =
|
|
15
|
+
this.lvlJc = 'start';
|
|
16
|
+
this.suff = 'space';
|
|
18
17
|
}
|
|
19
18
|
Lvl.fromXML = function (word, element) {
|
|
20
19
|
var e_1, _a;
|
|
21
20
|
var lvl = new Lvl();
|
|
22
21
|
lvl.ilvl = element.getAttribute('w:ilvl');
|
|
23
22
|
try {
|
|
24
|
-
for (var _b =
|
|
23
|
+
for (var _b = tslib.__values(element.children), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
25
24
|
var child = _c.value;
|
|
26
25
|
var tagName = child.tagName;
|
|
27
26
|
switch (tagName) {
|
|
@@ -37,6 +36,10 @@ var Lvl = /** @class */ (function () {
|
|
|
37
36
|
case 'w:lvlJc':
|
|
38
37
|
lvl.lvlJc = OpenXML.getVal(child);
|
|
39
38
|
break;
|
|
39
|
+
case 'w:legacy':
|
|
40
|
+
// 老的属性应该不需要支持了
|
|
41
|
+
// http://webapp.docx4java.org/OnlineDemo/ecma376/WordML/legacy.html
|
|
42
|
+
break;
|
|
40
43
|
case 'w:pPr':
|
|
41
44
|
lvl.pPr = Paragraph.Paragraph.parseParagraphPr(word, child);
|
|
42
45
|
break;
|
|
@@ -46,6 +49,9 @@ var Lvl = /** @class */ (function () {
|
|
|
46
49
|
case 'w:isLgl':
|
|
47
50
|
lvl.isLgl = OpenXML.getValBoolean(child);
|
|
48
51
|
break;
|
|
52
|
+
case 'w:pStyle':
|
|
53
|
+
// 这个在 paragraph 里处理了
|
|
54
|
+
break;
|
|
49
55
|
default:
|
|
50
56
|
console.warn("Lvl: Unknown tag ", tagName, child);
|
|
51
57
|
}
|
|
@@ -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
|
var OpenXML = require('../../../OpenXML.js');
|
|
7
7
|
var Lvl = require('./Lvl.js');
|
|
8
8
|
|
|
@@ -14,14 +14,16 @@ var Num = /** @class */ (function () {
|
|
|
14
14
|
var e_1, _a;
|
|
15
15
|
var num = new Num();
|
|
16
16
|
num.numId = element.getAttribute('w:numId') || '';
|
|
17
|
-
var abstractNumId = element
|
|
17
|
+
var abstractNumId = element
|
|
18
|
+
.getElementsByTagName('w:abstractNumId')
|
|
19
|
+
.item(0);
|
|
18
20
|
if (abstractNumId) {
|
|
19
21
|
num.abstractNumId = OpenXML.getVal(abstractNumId);
|
|
20
22
|
}
|
|
21
|
-
var lvlOverride = element.
|
|
23
|
+
var lvlOverride = element.getElementsByTagName('w:lvlOverride').item(0);
|
|
22
24
|
if (lvlOverride) {
|
|
23
25
|
try {
|
|
24
|
-
for (var _b =
|
|
26
|
+
for (var _b = tslib.__values(lvlOverride.children), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
25
27
|
var child = _c.value;
|
|
26
28
|
var tagName = child.tagName;
|
|
27
29
|
switch (tagName) {
|
|
@@ -29,6 +31,12 @@ var Num = /** @class */ (function () {
|
|
|
29
31
|
var lvlId = child.getAttribute('w:lvlId') || '';
|
|
30
32
|
num.lvlOverride.lvls[lvlId] = Lvl.Lvl.fromXML(word, child);
|
|
31
33
|
break;
|
|
34
|
+
case 'w:startOverride':
|
|
35
|
+
var id = child.getAttribute('w:lvlId') || '';
|
|
36
|
+
if (num.lvlOverride.lvls[id]) {
|
|
37
|
+
num.lvlOverride.lvls[id].start = OpenXML.getValNumber(child);
|
|
38
|
+
}
|
|
39
|
+
break;
|
|
32
40
|
default:
|
|
33
41
|
console.warn("Num: Unknown tag ", tagName, child);
|
|
34
42
|
}
|
|
@@ -9,11 +9,11 @@ var NumberPr = /** @class */ (function () {
|
|
|
9
9
|
}
|
|
10
10
|
NumberPr.fromXML = function (word, element) {
|
|
11
11
|
var numPr = new NumberPr();
|
|
12
|
-
var ilvl = element.
|
|
12
|
+
var ilvl = element.getElementsByTagName('w:ilvl').item(0);
|
|
13
13
|
if (ilvl) {
|
|
14
14
|
numPr.ilvl = OpenXML.getVal(ilvl);
|
|
15
15
|
}
|
|
16
|
-
var numId = element.
|
|
16
|
+
var numId = element.getElementsByTagName('w:numId').item(0);
|
|
17
17
|
if (numId) {
|
|
18
18
|
numPr.numId = OpenXML.getVal(numId);
|
|
19
19
|
}
|
|
@@ -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
|
var AbstractNum = require('./AbstractNum.js');
|
|
7
7
|
var Num = require('./Num.js');
|
|
8
8
|
|
|
@@ -18,7 +18,7 @@ var Numbering = /** @class */ (function () {
|
|
|
18
18
|
var e_1, _a, e_2, _b;
|
|
19
19
|
var numbering = new Numbering();
|
|
20
20
|
try {
|
|
21
|
-
for (var _c =
|
|
21
|
+
for (var _c = tslib.__values(element.getElementsByTagName('w:abstractNum')), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
22
22
|
var abstractNumElement = _d.value;
|
|
23
23
|
var abstractNum = AbstractNum.AbstractNum.fromXML(word, abstractNumElement);
|
|
24
24
|
numbering.abstractNums[abstractNum.abstractNumId] = abstractNum;
|
|
@@ -32,7 +32,7 @@ var Numbering = /** @class */ (function () {
|
|
|
32
32
|
finally { if (e_1) throw e_1.error; }
|
|
33
33
|
}
|
|
34
34
|
try {
|
|
35
|
-
for (var _e =
|
|
35
|
+
for (var _e = tslib.__values(element.getElementsByTagName('w:num')), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
36
36
|
var numElement = _f.value;
|
|
37
37
|
var num = Num.Num.fromXML(word, numElement);
|
|
38
38
|
numbering.nums[num.numId] = num;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import Word from '../../../Word';
|
|
2
1
|
import { CSSStyle } from '../../Style';
|
|
3
2
|
import { Paragraph } from '../Paragraph';
|
|
4
3
|
import { Table } from '../Table';
|
|
5
4
|
import { ST_Merge } from '../../Types';
|
|
6
5
|
export interface TcPr {
|
|
7
6
|
cssStyle?: CSSStyle;
|
|
8
|
-
hideMark?:
|
|
7
|
+
hideMark?: boolean;
|
|
9
8
|
vMerge?: ST_Merge;
|
|
10
9
|
gridSpan?: number;
|
|
11
10
|
rowSpan?: number;
|
|
@@ -18,29 +17,9 @@ export interface TcPr {
|
|
|
18
17
|
};
|
|
19
18
|
}
|
|
20
19
|
type TcChild = Paragraph | Table;
|
|
21
|
-
export declare function parseCellMargin(element: Element, style: CSSStyle): void;
|
|
22
|
-
export declare function parseTblCellSpacing(element: Element, style: CSSStyle): void;
|
|
23
|
-
/**
|
|
24
|
-
* parseBorders 不支持 insideH 和 insideV,所以单独支持一下
|
|
25
|
-
* 实际显示时需要过滤掉第一列
|
|
26
|
-
*/
|
|
27
|
-
export declare function parseInsideBorders(word: Word, element: Element): {
|
|
28
|
-
H: string | undefined;
|
|
29
|
-
V: string | undefined;
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* http://officeopenxml.com/WPtableWidth.php
|
|
33
|
-
*/
|
|
34
|
-
export declare function parseTblWidth(element: Element): string;
|
|
35
20
|
export declare class Tc {
|
|
36
21
|
properties: TcPr;
|
|
37
22
|
children: TcChild[];
|
|
38
23
|
add(child: TcChild): void;
|
|
39
|
-
static parseTcPr(word: Word, element: Element): TcPr;
|
|
40
|
-
static fromXML(word: Word, element: Element, currentCol: {
|
|
41
|
-
index: number;
|
|
42
|
-
}, rowSpanMap: {
|
|
43
|
-
[key: string]: Tc;
|
|
44
|
-
}): Tc | null;
|
|
45
24
|
}
|
|
46
25
|
export {};
|