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
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* footnote 和 endnote 的结构几乎是一样的,所以统一叫 Note 了
|
|
3
|
+
*/
|
|
4
|
+
import Word from '../../Word';
|
|
5
|
+
import { Paragraph } from './Paragraph';
|
|
6
|
+
import { Table } from './Table';
|
|
7
|
+
export type NoteChild = Paragraph | Table;
|
|
8
|
+
export declare class Note {
|
|
9
|
+
children: NoteChild[];
|
|
10
|
+
addChild(child: NoteChild): void;
|
|
11
|
+
static fromXML(word: Word, element: Element): Note;
|
|
12
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { __values } from 'tslib';
|
|
2
|
+
import { parseTable } from '../../parse/parseTable.js';
|
|
3
|
+
import { Paragraph } from './Paragraph.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* footnote 和 endnote 的结构几乎是一样的,所以统一叫 Note 了
|
|
7
|
+
*/
|
|
8
|
+
var Note = /** @class */ (function () {
|
|
9
|
+
function Note() {
|
|
10
|
+
this.children = [];
|
|
11
|
+
}
|
|
12
|
+
Note.prototype.addChild = function (child) {
|
|
13
|
+
this.children.push(child);
|
|
14
|
+
};
|
|
15
|
+
Note.fromXML = function (word, element) {
|
|
16
|
+
var e_1, _a;
|
|
17
|
+
var note = new Note();
|
|
18
|
+
try {
|
|
19
|
+
for (var _b = __values(element.children), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
20
|
+
var child = _c.value;
|
|
21
|
+
var tagName = child.tagName;
|
|
22
|
+
switch (tagName) {
|
|
23
|
+
case 'w:p':
|
|
24
|
+
var paragraph = Paragraph.fromXML(word, child);
|
|
25
|
+
note.addChild(paragraph);
|
|
26
|
+
break;
|
|
27
|
+
case 'w:tbl':
|
|
28
|
+
var table = parseTable(word, child);
|
|
29
|
+
note.addChild(table);
|
|
30
|
+
break;
|
|
31
|
+
default:
|
|
32
|
+
console.warn('Note.fromXML unknown tag', tagName, child);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
37
|
+
finally {
|
|
38
|
+
try {
|
|
39
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
40
|
+
}
|
|
41
|
+
finally { if (e_1) throw e_1.error; }
|
|
42
|
+
}
|
|
43
|
+
return note;
|
|
44
|
+
};
|
|
45
|
+
return Note;
|
|
46
|
+
}());
|
|
47
|
+
|
|
48
|
+
export { Note };
|
|
@@ -8,8 +8,8 @@ import { NumberPr } from './numbering/NumberProperties';
|
|
|
8
8
|
import { Properties } from './properties/Properties';
|
|
9
9
|
import { Run, RunPr } from './Run';
|
|
10
10
|
import { Tab } from './Tab';
|
|
11
|
-
import { SmartTag } from './SmartTag';
|
|
12
11
|
import { FldSimple } from './FldSimple';
|
|
12
|
+
import { OMath } from '../math/OMath';
|
|
13
13
|
/**
|
|
14
14
|
* 这里简化了很多,如果能用 CSS 表示就直接用 CSS 表示
|
|
15
15
|
*/
|
|
@@ -22,7 +22,7 @@ export interface ParagraphPr extends Properties {
|
|
|
22
22
|
*/
|
|
23
23
|
autoSpace?: boolean;
|
|
24
24
|
}
|
|
25
|
-
export type ParagraphChild = Run | BookmarkStart | Hyperlink |
|
|
25
|
+
export type ParagraphChild = Run | BookmarkStart | Hyperlink | FldSimple | OMath;
|
|
26
26
|
export declare class Paragraph {
|
|
27
27
|
paraId?: string;
|
|
28
28
|
properties: ParagraphPr;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __values } from '
|
|
1
|
+
import { __values } from 'tslib';
|
|
2
2
|
import { getVal } from '../../OpenXML.js';
|
|
3
3
|
import { parsePr } from '../../parse/parsePr.js';
|
|
4
4
|
import { BookmarkStart } from './Bookmark.js';
|
|
@@ -6,8 +6,9 @@ import { Hyperlink } from './Hyperlink.js';
|
|
|
6
6
|
import { NumberPr } from './numbering/NumberProperties.js';
|
|
7
7
|
import { Run } from './Run.js';
|
|
8
8
|
import { Tab } from './Tab.js';
|
|
9
|
-
import { SmartTag } from './SmartTag.js';
|
|
10
9
|
import { FldSimple } from './FldSimple.js';
|
|
10
|
+
import { OMath } from '../math/OMath.js';
|
|
11
|
+
import { mergeSdt } from '../../parse/mergeSdt.js';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* 段落的定义和解析
|
|
@@ -45,12 +46,12 @@ var Paragraph = /** @class */ (function () {
|
|
|
45
46
|
var e_1, _a;
|
|
46
47
|
var cssStyle = parsePr(word, element);
|
|
47
48
|
var pStyle;
|
|
48
|
-
var pStyleTag = element.
|
|
49
|
+
var pStyleTag = element.getElementsByTagName('w:pStyle').item(0);
|
|
49
50
|
if (pStyleTag) {
|
|
50
51
|
pStyle = getVal(pStyleTag);
|
|
51
52
|
}
|
|
52
53
|
var numPr;
|
|
53
|
-
var numPrTag = element.
|
|
54
|
+
var numPrTag = element.getElementsByTagName('w:numPr').item(0);
|
|
54
55
|
if (numPrTag) {
|
|
55
56
|
numPr = NumberPr.fromXML(word, numPrTag);
|
|
56
57
|
}
|
|
@@ -78,7 +79,7 @@ var Paragraph = /** @class */ (function () {
|
|
|
78
79
|
paragraph.fldSimples = [];
|
|
79
80
|
paragraph.paraId = element.getAttribute('w14:paraId') || '';
|
|
80
81
|
try {
|
|
81
|
-
for (var _b = __values(element
|
|
82
|
+
for (var _b = __values(mergeSdt(element)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
82
83
|
var child = _c.value;
|
|
83
84
|
var tagName = child.tagName;
|
|
84
85
|
switch (tagName) {
|
|
@@ -105,14 +106,14 @@ var Paragraph = /** @class */ (function () {
|
|
|
105
106
|
case 'w:moveFrom':
|
|
106
107
|
// del 看起来主要是用于跟踪历史的,先不支持
|
|
107
108
|
break;
|
|
108
|
-
case 'w:smartTag':
|
|
109
|
-
case 'w:customXml':
|
|
110
|
-
paragraph.addChild(SmartTag.fromXML(word, child));
|
|
111
|
-
break;
|
|
112
109
|
case 'w:fldSimple':
|
|
113
110
|
// 这个目前还不想支持
|
|
114
111
|
paragraph.fldSimples.push(FldSimple.fromXML(word, child));
|
|
115
112
|
break;
|
|
113
|
+
case 'm:oMathPara':
|
|
114
|
+
case 'm:oMath':
|
|
115
|
+
paragraph.addChild(OMath.fromXML(word, child));
|
|
116
|
+
break;
|
|
116
117
|
default:
|
|
117
118
|
console.warn('parse Paragraph: Unknown key', tagName, child);
|
|
118
119
|
}
|
package/esm/openxml/word/Pict.js
CHANGED
|
@@ -3,12 +3,14 @@ var Pict = /** @class */ (function () {
|
|
|
3
3
|
}
|
|
4
4
|
Pict.fromXML = function (word, element) {
|
|
5
5
|
var pict = new Pict();
|
|
6
|
-
var imagedataElement = element
|
|
6
|
+
var imagedataElement = element
|
|
7
|
+
.getElementsByTagName('v:imagedata')
|
|
8
|
+
.item(0);
|
|
7
9
|
if (imagedataElement) {
|
|
8
10
|
var rId = imagedataElement.getAttribute('r:id') || '';
|
|
9
|
-
var rel = word.
|
|
11
|
+
var rel = word.getDocumentRels(rId);
|
|
10
12
|
if (rel) {
|
|
11
|
-
pict.
|
|
13
|
+
pict.src = word.loadImage(rel);
|
|
12
14
|
}
|
|
13
15
|
}
|
|
14
16
|
return pict;
|
package/esm/openxml/word/Ruby.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import Word from '../../Word';
|
|
2
|
-
import { ST_VerticalAlignRun } from '../Types';
|
|
2
|
+
import { ST_FldCharType, ST_VerticalAlignRun } from '../Types';
|
|
3
3
|
import { Break } from './Break';
|
|
4
|
-
import { Drawing } from '
|
|
4
|
+
import { Drawing } from '../drawing/Drawing';
|
|
5
5
|
import { InstrText } from './InstrText';
|
|
6
|
+
import { NoBreakHyphen } from './NoBreakHyphen';
|
|
6
7
|
import { Pict } from './Pict';
|
|
7
8
|
import { Properties } from './properties/Properties';
|
|
8
9
|
import { Ruby } from './Ruby';
|
|
10
|
+
import { Separator } from './Separator';
|
|
11
|
+
import { SoftHyphen } from './SoftHyphen';
|
|
9
12
|
import { Sym } from './Sym';
|
|
10
13
|
import { Tab } from './Tab';
|
|
11
14
|
/**
|
|
@@ -20,10 +23,11 @@ export declare class Text {
|
|
|
20
23
|
text: string;
|
|
21
24
|
constructor(text: string | number);
|
|
22
25
|
}
|
|
23
|
-
type RunChild = Break | Drawing | Text | Tab | Pict | Ruby | InstrText | Sym;
|
|
26
|
+
type RunChild = Break | Drawing | Text | Tab | Pict | Ruby | InstrText | Sym | SoftHyphen | Separator | NoBreakHyphen;
|
|
24
27
|
export declare class Run {
|
|
25
28
|
properties: RunPr;
|
|
26
29
|
children: RunChild[];
|
|
30
|
+
fldChar?: ST_FldCharType;
|
|
27
31
|
addChild(child: RunChild | null): void;
|
|
28
32
|
static parseRunPr(word: Word, element: Element): RunPr;
|
|
29
33
|
static fromXML(word: Word, element: Element): Run;
|
package/esm/openxml/word/Run.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { __values } from '
|
|
1
|
+
import { __values } from 'tslib';
|
|
2
2
|
import { getVal } from '../../OpenXML.js';
|
|
3
3
|
import { parsePr } from '../../parse/parsePr.js';
|
|
4
4
|
import { Break } from './Break.js';
|
|
5
|
-
import { Drawing } from '
|
|
5
|
+
import { Drawing } from '../drawing/Drawing.js';
|
|
6
6
|
import { InstrText } from './InstrText.js';
|
|
7
|
+
import { NoBreakHyphen } from './NoBreakHyphen.js';
|
|
7
8
|
import { Pict } from './Pict.js';
|
|
8
9
|
import { Ruby } from './Ruby.js';
|
|
10
|
+
import { Separator } from './Separator.js';
|
|
11
|
+
import { SoftHyphen } from './SoftHyphen.js';
|
|
9
12
|
import { Sym } from './Sym.js';
|
|
10
13
|
import { Tab } from './Tab.js';
|
|
11
14
|
|
|
@@ -52,6 +55,7 @@ var Run = /** @class */ (function () {
|
|
|
52
55
|
run.properties = Run.parseRunPr(word, child);
|
|
53
56
|
break;
|
|
54
57
|
case 'w:br':
|
|
58
|
+
case 'w:cr':
|
|
55
59
|
run.addChild(Break.fromXML(word, child));
|
|
56
60
|
break;
|
|
57
61
|
case 'w:drawing':
|
|
@@ -61,13 +65,15 @@ var Run = /** @class */ (function () {
|
|
|
61
65
|
run.addChild(Tab.fromXML(word, child));
|
|
62
66
|
break;
|
|
63
67
|
case 'w:fldChar':
|
|
64
|
-
|
|
68
|
+
run.fldChar = child.getAttribute('w:fldCharType');
|
|
65
69
|
break;
|
|
66
70
|
case 'w:instrText':
|
|
67
71
|
run.addChild(new InstrText(child.textContent || ''));
|
|
68
72
|
break;
|
|
69
73
|
case 'w:lastRenderedPageBreak':
|
|
70
|
-
|
|
74
|
+
var pageBreak = new Break();
|
|
75
|
+
pageBreak.type = 'page';
|
|
76
|
+
run.addChild(pageBreak);
|
|
71
77
|
break;
|
|
72
78
|
case 'w:pict':
|
|
73
79
|
run.addChild(Pict.fromXML(word, child));
|
|
@@ -78,6 +84,24 @@ var Run = /** @class */ (function () {
|
|
|
78
84
|
case 'w:sym':
|
|
79
85
|
run.addChild(Sym.parseXML(child));
|
|
80
86
|
break;
|
|
87
|
+
case 'mc:AlternateContent':
|
|
88
|
+
var drawingChild = child.getElementsByTagName('w:drawing').item(0);
|
|
89
|
+
if (drawingChild) {
|
|
90
|
+
run.addChild(Drawing.fromXML(word, drawingChild));
|
|
91
|
+
}
|
|
92
|
+
break;
|
|
93
|
+
case 'w:softHyphen':
|
|
94
|
+
run.addChild(new SoftHyphen());
|
|
95
|
+
break;
|
|
96
|
+
case 'w:noBreakHyphen':
|
|
97
|
+
run.addChild(new NoBreakHyphen());
|
|
98
|
+
break;
|
|
99
|
+
case 'w:separator':
|
|
100
|
+
run.addChild(new Separator());
|
|
101
|
+
break;
|
|
102
|
+
case 'w:continuationSeparator':
|
|
103
|
+
// TODO: 还不知道是啥
|
|
104
|
+
break;
|
|
81
105
|
default:
|
|
82
106
|
console.warn('parse Run: Unknown key', tagName, child);
|
|
83
107
|
}
|
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
* word 文档是按 section 组织的
|
|
4
4
|
* 参考了 docx 里的类型定义
|
|
5
5
|
*/
|
|
6
|
+
import Word from '../../Word';
|
|
6
7
|
import { ST_PageOrientation } from '../Types';
|
|
7
|
-
import { Hyperlink } from './Hyperlink';
|
|
8
8
|
import { Paragraph } from './Paragraph';
|
|
9
9
|
import { Table } from './Table';
|
|
10
|
+
import { Body } from './Body';
|
|
11
|
+
import { Header } from './Header';
|
|
10
12
|
export type PageSize = {
|
|
11
13
|
width: string;
|
|
12
14
|
height: string;
|
|
@@ -21,18 +23,29 @@ export type PageMargin = {
|
|
|
21
23
|
footer?: string;
|
|
22
24
|
gutter?: string;
|
|
23
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* 列设置,其实这里支持
|
|
28
|
+
*/
|
|
24
29
|
export interface Column {
|
|
25
|
-
|
|
26
|
-
space?:
|
|
30
|
+
num?: number;
|
|
31
|
+
space?: string;
|
|
27
32
|
}
|
|
28
|
-
export type SectionChild = Paragraph | Table
|
|
33
|
+
export type SectionChild = Paragraph | Table;
|
|
29
34
|
export interface SectionPr {
|
|
30
35
|
pageSize?: PageSize;
|
|
31
36
|
pageMargin?: PageMargin;
|
|
37
|
+
cols?: Column;
|
|
38
|
+
headers?: {
|
|
39
|
+
[key in HeaderType]?: Header;
|
|
40
|
+
};
|
|
41
|
+
footers?: {
|
|
42
|
+
[key in HeaderType]?: Header;
|
|
43
|
+
};
|
|
32
44
|
}
|
|
45
|
+
export type HeaderType = 'default' | 'first' | 'even';
|
|
33
46
|
export declare class Section {
|
|
34
47
|
properties: SectionPr;
|
|
35
48
|
children: SectionChild[];
|
|
36
49
|
addChild(child: SectionChild): void;
|
|
37
|
-
static parsePr(element: Element): SectionPr;
|
|
50
|
+
static parsePr(word: Word, element: Element, body: Body): SectionPr;
|
|
38
51
|
}
|
|
@@ -1,11 +1,31 @@
|
|
|
1
|
-
import { __values } from '
|
|
1
|
+
import { __values } from 'tslib';
|
|
2
2
|
import { parseSize } from '../../parse/parseSize.js';
|
|
3
|
+
import { getAttrNumber } from '../../OpenXML.js';
|
|
4
|
+
import { Header } from './Header.js';
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* section 属性
|
|
6
8
|
* word 文档是按 section 组织的
|
|
7
9
|
* 参考了 docx 里的类型定义
|
|
8
10
|
*/
|
|
11
|
+
function parseHeader(word, element, type) {
|
|
12
|
+
var headerType = element.getAttribute('w:type');
|
|
13
|
+
var headerId = element.getAttribute('r:id');
|
|
14
|
+
if (headerType && headerId) {
|
|
15
|
+
var headerRel = word.getDocumentRels(headerId);
|
|
16
|
+
if (headerRel) {
|
|
17
|
+
var headerDoc = word.getXML('/word/' + headerRel.target);
|
|
18
|
+
if (headerDoc) {
|
|
19
|
+
var header = Header.fromXML(word, headerDoc);
|
|
20
|
+
return {
|
|
21
|
+
headerType: headerType,
|
|
22
|
+
header: header
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
9
29
|
var Section = /** @class */ (function () {
|
|
10
30
|
function Section() {
|
|
11
31
|
this.properties = {};
|
|
@@ -14,9 +34,11 @@ var Section = /** @class */ (function () {
|
|
|
14
34
|
Section.prototype.addChild = function (child) {
|
|
15
35
|
this.children.push(child);
|
|
16
36
|
};
|
|
17
|
-
Section.parsePr = function (element) {
|
|
37
|
+
Section.parsePr = function (word, element, body) {
|
|
18
38
|
var e_1, _a;
|
|
19
39
|
var properties = {};
|
|
40
|
+
properties.headers = {};
|
|
41
|
+
properties.footers = {};
|
|
20
42
|
try {
|
|
21
43
|
for (var _b = __values(element.children), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
22
44
|
var child = _c.value;
|
|
@@ -39,6 +61,28 @@ var Section = /** @class */ (function () {
|
|
|
39
61
|
gutter: parseSize(child, 'w:gutter')
|
|
40
62
|
};
|
|
41
63
|
break;
|
|
64
|
+
case 'w:headerReference':
|
|
65
|
+
var header = parseHeader(word, child, 'header');
|
|
66
|
+
if (header) {
|
|
67
|
+
properties.headers[header.headerType] = header.header;
|
|
68
|
+
}
|
|
69
|
+
break;
|
|
70
|
+
case 'w:footerReference':
|
|
71
|
+
var footer = parseHeader(word, child, 'footer');
|
|
72
|
+
if (footer) {
|
|
73
|
+
properties.footers[footer.headerType] = footer.header;
|
|
74
|
+
}
|
|
75
|
+
break;
|
|
76
|
+
case 'w:cols':
|
|
77
|
+
var cols = {};
|
|
78
|
+
var num = getAttrNumber(child, 'w:num', 1);
|
|
79
|
+
cols.num = num;
|
|
80
|
+
var space = parseSize(child, 'w:space');
|
|
81
|
+
if (space) {
|
|
82
|
+
cols.space = space;
|
|
83
|
+
}
|
|
84
|
+
properties.cols = cols;
|
|
85
|
+
break;
|
|
42
86
|
default:
|
|
43
87
|
break;
|
|
44
88
|
}
|
|
@@ -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 {};
|