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
|
@@ -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 dom = require('../util/dom.js');
|
|
7
7
|
var Run = require('../openxml/word/Run.js');
|
|
8
8
|
var Bookmark = require('../openxml/word/Bookmark.js');
|
|
@@ -13,45 +13,82 @@ var renderBookmark = require('./renderBookmark.js');
|
|
|
13
13
|
var renderNumbering = require('./renderNumbering.js');
|
|
14
14
|
var setElementStyle = require('./setElementStyle.js');
|
|
15
15
|
var renderTab = require('./renderTab.js');
|
|
16
|
-
var
|
|
17
|
-
var
|
|
16
|
+
var OMath = require('../openxml/math/OMath.js');
|
|
17
|
+
var renderMath = require('./renderMath.js');
|
|
18
|
+
var Tab = require('../openxml/word/Tab.js');
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* 渲染段落
|
|
21
22
|
* @param renderEmptySpace 如果是 true 的话,当内容为空时会自动加上
|
|
22
23
|
*/
|
|
23
|
-
function renderParagraph(word, paragraph, renderEmptySpace) {
|
|
24
|
-
var e_1, _a, e_2, _b;
|
|
24
|
+
function renderParagraph(word, paragraph, renderEmptySpace, inHeader) {
|
|
25
|
+
var e_1, _a, e_2, _b, e_3, _c;
|
|
25
26
|
if (renderEmptySpace === void 0) { renderEmptySpace = true; }
|
|
27
|
+
if (inHeader === void 0) { inHeader = false; }
|
|
26
28
|
word.currentParagraph = paragraph;
|
|
27
29
|
var p = dom.createElement('p');
|
|
28
30
|
word.addClass(p, 'p');
|
|
29
31
|
var properties = paragraph.properties;
|
|
30
32
|
setElementStyle.setElementStyle(word, p, properties);
|
|
33
|
+
// 默认情况下 drawing 是相对段落的
|
|
34
|
+
p.style.position = 'relative';
|
|
31
35
|
// 渲染列表前缀
|
|
32
36
|
if (properties.numPr) {
|
|
33
37
|
dom.appendChild(p, renderNumbering.renderNumbering(p, word, properties.numPr));
|
|
34
38
|
}
|
|
35
|
-
|
|
39
|
+
var inFldChar = false;
|
|
40
|
+
if (properties.tabs && properties.tabs.length) {
|
|
41
|
+
// 目前只支持渲染第一个,因为第二个位置取决于前面内容位置,挺麻烦
|
|
42
|
+
// 虽然目前这个实现很 hack,但可以支持常见情况
|
|
43
|
+
dom.appendChild(p, renderTab.renderTab(word, properties.tabs[0], true));
|
|
44
|
+
// 同时删掉第一个 run 中的 tab
|
|
45
|
+
var done = false;
|
|
36
46
|
try {
|
|
37
|
-
for (var
|
|
38
|
-
var
|
|
39
|
-
|
|
47
|
+
for (var _d = tslib.__values(paragraph.children), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
48
|
+
var child = _e.value;
|
|
49
|
+
if (done) {
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
if (child instanceof Run.Run) {
|
|
53
|
+
try {
|
|
54
|
+
for (var _f = (e_2 = void 0, tslib.__values(child.children)), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
55
|
+
var runChild = _g.value;
|
|
56
|
+
if (runChild instanceof Tab.Tab) {
|
|
57
|
+
child.children.splice(child.children.indexOf(runChild), 1);
|
|
58
|
+
done = true;
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
64
|
+
finally {
|
|
65
|
+
try {
|
|
66
|
+
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
67
|
+
}
|
|
68
|
+
finally { if (e_2) throw e_2.error; }
|
|
69
|
+
}
|
|
70
|
+
}
|
|
40
71
|
}
|
|
41
72
|
}
|
|
42
73
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
43
74
|
finally {
|
|
44
75
|
try {
|
|
45
|
-
if (
|
|
76
|
+
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
46
77
|
}
|
|
47
78
|
finally { if (e_1) throw e_1.error; }
|
|
48
79
|
}
|
|
49
80
|
}
|
|
50
81
|
try {
|
|
51
|
-
for (var
|
|
52
|
-
var child =
|
|
82
|
+
for (var _h = tslib.__values(paragraph.children), _j = _h.next(); !_j.done; _j = _h.next()) {
|
|
83
|
+
var child = _j.value;
|
|
53
84
|
if (child instanceof Run.Run) {
|
|
54
|
-
|
|
85
|
+
if (child.fldChar === 'begin') {
|
|
86
|
+
inFldChar = true;
|
|
87
|
+
}
|
|
88
|
+
else if (child) {
|
|
89
|
+
inFldChar = false;
|
|
90
|
+
}
|
|
91
|
+
dom.appendChild(p, renderRun["default"](word, child, paragraph, inFldChar, inHeader));
|
|
55
92
|
}
|
|
56
93
|
else if (child instanceof Bookmark.BookmarkStart) {
|
|
57
94
|
dom.appendChild(p, renderBookmark.renderBookmarkStart(word, child));
|
|
@@ -60,17 +97,20 @@ function renderParagraph(word, paragraph, renderEmptySpace) {
|
|
|
60
97
|
var hyperlink = renderHyperLink.renderHyperLink(word, child, paragraph);
|
|
61
98
|
dom.appendChild(p, hyperlink);
|
|
62
99
|
}
|
|
63
|
-
else if (child instanceof
|
|
64
|
-
|
|
100
|
+
else if (child instanceof OMath.OMath) {
|
|
101
|
+
dom.appendChild(p, renderMath.renderOMath(word, child));
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
console.warn('unknow pargraph type', child);
|
|
65
105
|
}
|
|
66
106
|
}
|
|
67
107
|
}
|
|
68
|
-
catch (
|
|
108
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
69
109
|
finally {
|
|
70
110
|
try {
|
|
71
|
-
if (
|
|
111
|
+
if (_j && !_j.done && (_c = _h.return)) _c.call(_h);
|
|
72
112
|
}
|
|
73
|
-
finally { if (
|
|
113
|
+
finally { if (e_3) throw e_3.error; }
|
|
74
114
|
}
|
|
75
115
|
// 空行自动加个空格,不然会没高度
|
|
76
116
|
if (p.innerHTML === '' && renderEmptySpace) {
|
package/lib/render/renderPict.js
CHANGED
|
@@ -6,16 +6,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
* 老的 vml 格式,目前只支持图片
|
|
7
7
|
*/
|
|
8
8
|
function renderPict(word, pict) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (url) {
|
|
15
|
-
img_1.src = url;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
return img_1;
|
|
9
|
+
if (pict.src) {
|
|
10
|
+
var img = document.createElement('img');
|
|
11
|
+
img.style.position = 'relative';
|
|
12
|
+
img.src = pict.src;
|
|
13
|
+
return img;
|
|
19
14
|
}
|
|
20
15
|
return null;
|
|
21
16
|
}
|
package/lib/render/renderRuby.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var tslib = require('tslib');
|
|
6
6
|
var dom = require('../util/dom.js');
|
|
7
7
|
var renderRun = require('./renderRun.js');
|
|
8
8
|
|
|
@@ -14,7 +14,7 @@ function renderRuby(word, ruby) {
|
|
|
14
14
|
var rubyElement = dom.createElement('ruby');
|
|
15
15
|
if (ruby.rubyBase) {
|
|
16
16
|
try {
|
|
17
|
-
for (var _c =
|
|
17
|
+
for (var _c = tslib.__values(ruby.rubyBase.children), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
18
18
|
var text = _d.value;
|
|
19
19
|
rubyElement.appendChild(renderRun["default"](word, text));
|
|
20
20
|
}
|
|
@@ -33,7 +33,7 @@ function renderRuby(word, ruby) {
|
|
|
33
33
|
rubyElement.appendChild(rpStart);
|
|
34
34
|
var rtElement = dom.createElement('rt');
|
|
35
35
|
try {
|
|
36
|
-
for (var _e =
|
|
36
|
+
for (var _e = tslib.__values(ruby.rt.children), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
37
37
|
var text = _f.value;
|
|
38
38
|
rtElement.appendChild(renderRun["default"](word, text));
|
|
39
39
|
}
|
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import Word from '../Word';
|
|
5
5
|
import { Run } from '../openxml/word/Run';
|
|
6
|
-
import type { Paragraph } from '
|
|
6
|
+
import type { Paragraph } from '../openxml/word/Paragraph';
|
|
7
7
|
/**
|
|
8
8
|
* 更新文档里的所有变量
|
|
9
9
|
*/
|
|
10
10
|
export declare function updateVariableText(word: Word): void;
|
|
11
11
|
/**
|
|
12
12
|
* 渲染 run 节点
|
|
13
|
+
*
|
|
14
|
+
* @param inFldChar 是否在 complex field 里,预留功能,目前还不支持
|
|
13
15
|
*/
|
|
14
|
-
export default function renderRun(word: Word, run: Run, paragraph?: Paragraph): HTMLElement;
|
|
16
|
+
export default function renderRun(word: Word, run: Run, paragraph?: Paragraph, inFldChar?: boolean, inHeader?: boolean): HTMLElement;
|
package/lib/render/renderRun.js
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var tslib = require('tslib');
|
|
6
6
|
var renderBr = require('./renderBr.js');
|
|
7
7
|
var dom = require('../util/dom.js');
|
|
8
8
|
var Run = require('../openxml/word/Run.js');
|
|
9
9
|
var Break = require('../openxml/word/Break.js');
|
|
10
|
-
var Drawing = require('../openxml/
|
|
10
|
+
var Drawing = require('../openxml/drawing/Drawing.js');
|
|
11
11
|
var renderDrawing = require('./renderDrawing.js');
|
|
12
12
|
var setElementStyle = require('./setElementStyle.js');
|
|
13
13
|
var Tab = require('../openxml/word/Tab.js');
|
|
@@ -21,6 +21,12 @@ var renderInstrText = require('./renderInstrText.js');
|
|
|
21
21
|
var Sym = require('../openxml/word/Sym.js');
|
|
22
22
|
var renderSym = require('./renderSym.js');
|
|
23
23
|
var autoSpace = require('../util/autoSpace.js');
|
|
24
|
+
var renderSoftHyphen = require('./renderSoftHyphen.js');
|
|
25
|
+
var SoftHyphen = require('../openxml/word/SoftHyphen.js');
|
|
26
|
+
var NoBreakHyphen = require('../openxml/word/NoBreakHyphen.js');
|
|
27
|
+
var renderNoBreakHyphen = require('./renderNoBreakHyphen.js');
|
|
28
|
+
var Separator = require('../openxml/word/Separator.js');
|
|
29
|
+
var renderSeparator = require('./renderSeparator.js');
|
|
24
30
|
|
|
25
31
|
/**
|
|
26
32
|
* run 相关的 http://webapp.docx4java.org/OnlineDemo/ecma376/WordML/Run_1.html
|
|
@@ -33,12 +39,14 @@ function renderText(span, word, text, paragraph) {
|
|
|
33
39
|
var _a;
|
|
34
40
|
// 简单过滤一下提升性能
|
|
35
41
|
if (text.indexOf('{{') === -1) {
|
|
42
|
+
var finalText = void 0;
|
|
36
43
|
if ((_a = paragraph === null || paragraph === void 0 ? void 0 : paragraph.properties) === null || _a === void 0 ? void 0 : _a.autoSpace) {
|
|
37
|
-
|
|
44
|
+
finalText = autoSpace.cjkspace(text.split(''));
|
|
38
45
|
}
|
|
39
46
|
else {
|
|
40
|
-
|
|
47
|
+
finalText = text;
|
|
41
48
|
}
|
|
49
|
+
span.textContent = finalText;
|
|
42
50
|
}
|
|
43
51
|
else {
|
|
44
52
|
span.dataset.originText = text;
|
|
@@ -46,6 +54,9 @@ function renderText(span, word, text, paragraph) {
|
|
|
46
54
|
span.classList.add(VARIABLE_CLASS_NAME);
|
|
47
55
|
span.textContent = word.replaceText(text);
|
|
48
56
|
}
|
|
57
|
+
// 大于两个空格才转成 nbsp
|
|
58
|
+
var html = span.innerHTML.split(' ').join(' ');
|
|
59
|
+
span.innerHTML = html;
|
|
49
60
|
}
|
|
50
61
|
/**
|
|
51
62
|
* 更新文档里的所有变量
|
|
@@ -60,31 +71,41 @@ function updateVariableText(word) {
|
|
|
60
71
|
}
|
|
61
72
|
/**
|
|
62
73
|
* 渲染 run 节点
|
|
74
|
+
*
|
|
75
|
+
* @param inFldChar 是否在 complex field 里,预留功能,目前还不支持
|
|
63
76
|
*/
|
|
64
|
-
function renderRun(word, run, paragraph) {
|
|
77
|
+
function renderRun(word, run, paragraph, inFldChar, inHeader) {
|
|
65
78
|
var e_1, _a;
|
|
79
|
+
var _b, _c;
|
|
66
80
|
var span = dom.createElement('span');
|
|
67
81
|
word.addClass(span, 'r');
|
|
68
82
|
setElementStyle.setElementStyle(word, span, run.properties);
|
|
83
|
+
// run 不好通过 class 来设置 rStyle,所以单独支持一下
|
|
84
|
+
if ((_b = run.properties) === null || _b === void 0 ? void 0 : _b.rStyle) {
|
|
85
|
+
var style = word.getStyle(run.properties.rStyle);
|
|
86
|
+
if ((_c = style === null || style === void 0 ? void 0 : style.rPr) === null || _c === void 0 ? void 0 : _c.cssStyle) {
|
|
87
|
+
dom.applyStyle(span, style.rPr.cssStyle);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
69
90
|
if (run.children.length === 1 && run.children[0] instanceof Run.Text) {
|
|
70
91
|
var text = run.children[0];
|
|
71
92
|
renderText(span, word, text.text, paragraph);
|
|
72
93
|
}
|
|
73
94
|
else {
|
|
74
95
|
try {
|
|
75
|
-
for (var
|
|
76
|
-
var child =
|
|
96
|
+
for (var _d = tslib.__values(run.children), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
97
|
+
var child = _e.value;
|
|
77
98
|
if (child instanceof Run.Text) {
|
|
78
99
|
var newSpan = dom.createElement('span');
|
|
79
|
-
renderText(
|
|
100
|
+
renderText(newSpan, word, child.text, paragraph);
|
|
80
101
|
dom.appendChild(span, newSpan);
|
|
81
102
|
}
|
|
82
103
|
else if (child instanceof Break.Break) {
|
|
83
|
-
var br = renderBr.renderBr(child);
|
|
104
|
+
var br = renderBr.renderBr(word, child);
|
|
84
105
|
dom.appendChild(span, br);
|
|
85
106
|
}
|
|
86
107
|
else if (child instanceof Drawing.Drawing) {
|
|
87
|
-
dom.appendChild(span, renderDrawing.renderDrawing(word, child));
|
|
108
|
+
dom.appendChild(span, renderDrawing.renderDrawing(word, child, inHeader));
|
|
88
109
|
}
|
|
89
110
|
else if (child instanceof Tab.Tab) {
|
|
90
111
|
dom.appendChild(span, renderTab.renderTab(word, child));
|
|
@@ -101,6 +122,15 @@ function renderRun(word, run, paragraph) {
|
|
|
101
122
|
else if (child instanceof Sym.Sym) {
|
|
102
123
|
dom.appendChild(span, renderSym.renderSym(word, child));
|
|
103
124
|
}
|
|
125
|
+
else if (child instanceof SoftHyphen.SoftHyphen) {
|
|
126
|
+
dom.appendChild(span, renderSoftHyphen.renderSoftHyphen());
|
|
127
|
+
}
|
|
128
|
+
else if (child instanceof NoBreakHyphen.NoBreakHyphen) {
|
|
129
|
+
dom.appendChild(span, renderNoBreakHyphen.renderNoBreakHyphen());
|
|
130
|
+
}
|
|
131
|
+
else if (child instanceof Separator.Separator) {
|
|
132
|
+
dom.appendChild(span, renderSeparator.renderSeparator());
|
|
133
|
+
}
|
|
104
134
|
else {
|
|
105
135
|
console.warn('unknown child', child);
|
|
106
136
|
}
|
|
@@ -109,7 +139,7 @@ function renderRun(word, run, paragraph) {
|
|
|
109
139
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
110
140
|
finally {
|
|
111
141
|
try {
|
|
112
|
-
if (
|
|
142
|
+
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
113
143
|
}
|
|
114
144
|
finally { if (e_1) throw e_1.error; }
|
|
115
145
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { WDocument } from '../openxml/word/WDocument';
|
|
1
2
|
import { Section } from '../openxml/word/Section';
|
|
2
|
-
import Word from '../Word';
|
|
3
|
+
import Word, { WordRenderOptions } from '../Word';
|
|
3
4
|
/**
|
|
4
5
|
* 渲染「节」,在 word 中每个节都可以有自己的页边距和页面大小设置,但目前其实并没有实现分页展现,等后续再考虑
|
|
5
6
|
*/
|
|
6
|
-
export declare function renderSection(word: Word, section: Section): HTMLElement;
|
|
7
|
+
export declare function renderSection(word: Word, wDocument: WDocument, section: Section, renderOptions: WordRenderOptions): HTMLElement;
|
|
@@ -3,27 +3,42 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var dom = require('../util/dom.js');
|
|
6
|
+
var renderHeader = require('./renderHeader.js');
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* 渲染「节」,在 word 中每个节都可以有自己的页边距和页面大小设置,但目前其实并没有实现分页展现,等后续再考虑
|
|
9
10
|
*/
|
|
10
|
-
function renderSection(word, section) {
|
|
11
|
+
function renderSection(word, wDocument, section, renderOptions) {
|
|
11
12
|
var sectionEl = dom.createElement('section');
|
|
12
13
|
// 用于后续绝对定位
|
|
13
14
|
sectionEl.style.position = 'relative';
|
|
15
|
+
if (wDocument.backgroundColor) {
|
|
16
|
+
sectionEl.style.background = wDocument.backgroundColor;
|
|
17
|
+
}
|
|
18
|
+
if (renderOptions.page) {
|
|
19
|
+
if (renderOptions.pageMarginBottom) {
|
|
20
|
+
sectionEl.style.marginBottom = renderOptions.pageMarginBottom + 'px';
|
|
21
|
+
}
|
|
22
|
+
if (renderOptions.pageShadow) {
|
|
23
|
+
sectionEl.style.boxShadow = '0 0 8px rgba(0, 0, 0, 0.5)';
|
|
24
|
+
}
|
|
25
|
+
if (renderOptions.pageBackground) {
|
|
26
|
+
sectionEl.style.background = renderOptions.pageBackground;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
14
29
|
var props = section.properties;
|
|
15
30
|
var pageSize = props.pageSize;
|
|
16
31
|
if (pageSize) {
|
|
17
|
-
if (!
|
|
32
|
+
if (!renderOptions.ignoreWidth) {
|
|
18
33
|
sectionEl.style.width = pageSize.width;
|
|
19
34
|
}
|
|
20
|
-
if (!
|
|
35
|
+
if (!renderOptions.ignoreHeight) {
|
|
21
36
|
sectionEl.style.height = pageSize.height;
|
|
22
37
|
}
|
|
23
38
|
}
|
|
24
39
|
// 强制控制 padding
|
|
25
|
-
if (
|
|
26
|
-
sectionEl.style.padding =
|
|
40
|
+
if (renderOptions.padding) {
|
|
41
|
+
sectionEl.style.padding = renderOptions.padding;
|
|
27
42
|
}
|
|
28
43
|
else {
|
|
29
44
|
var pageMargin = props.pageMargin;
|
|
@@ -34,6 +49,65 @@ function renderSection(word, section) {
|
|
|
34
49
|
sectionEl.style.paddingBottom = pageMargin.bottom || '0';
|
|
35
50
|
}
|
|
36
51
|
}
|
|
52
|
+
if (props.cols) {
|
|
53
|
+
if (props.cols.num && props.cols.num > 1) {
|
|
54
|
+
sectionEl.style.columnCount = '' + props.cols.num;
|
|
55
|
+
if (props.cols.space) {
|
|
56
|
+
sectionEl.style.columnGap = props.cols.space;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
word.currentPage++;
|
|
61
|
+
var width = 'auto';
|
|
62
|
+
if (props.pageSize && props.pageSize.width) {
|
|
63
|
+
width = props.pageSize.width;
|
|
64
|
+
}
|
|
65
|
+
// 只有在分页模式下才渲染页眉
|
|
66
|
+
if (props.headers && renderOptions.page && renderOptions.renderHeader) {
|
|
67
|
+
var headers = props.headers;
|
|
68
|
+
var headerEl = null;
|
|
69
|
+
if (headers.even && word.currentPage % 2 === 0) {
|
|
70
|
+
headerEl = renderHeader.renderHeader(word, headers.even);
|
|
71
|
+
}
|
|
72
|
+
else if (headers.default) {
|
|
73
|
+
headerEl = renderHeader.renderHeader(word, headers.default);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
console.warn('can not find header', word.currentPage, props.headers);
|
|
77
|
+
}
|
|
78
|
+
if (headerEl) {
|
|
79
|
+
headerEl.style.position = 'absolute';
|
|
80
|
+
var pageMargin = props.pageMargin;
|
|
81
|
+
// todo: 在 word 里如果 header 内容较多会将内容区也撑开,但目前实现不了
|
|
82
|
+
if (pageMargin && pageMargin.header) {
|
|
83
|
+
headerEl.style.top = pageMargin.header;
|
|
84
|
+
headerEl.style.width = width;
|
|
85
|
+
}
|
|
86
|
+
sectionEl.appendChild(headerEl);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (props.footers && renderOptions.page && renderOptions.renderFooter) {
|
|
90
|
+
var footers = props.footers;
|
|
91
|
+
var footerEl = null;
|
|
92
|
+
if (footers.even && word.currentPage % 2 === 0) {
|
|
93
|
+
footerEl = renderHeader.renderHeader(word, footers.even);
|
|
94
|
+
}
|
|
95
|
+
else if (footers.default) {
|
|
96
|
+
footerEl = renderHeader.renderHeader(word, footers.default);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
console.warn('can not find footer', word.currentPage, props.footers);
|
|
100
|
+
}
|
|
101
|
+
if (footerEl) {
|
|
102
|
+
footerEl.style.position = 'absolute';
|
|
103
|
+
var pageMargin = props.pageMargin;
|
|
104
|
+
if (pageMargin && pageMargin.footer) {
|
|
105
|
+
footerEl.style.bottom = pageMargin.footer;
|
|
106
|
+
footerEl.style.width = width;
|
|
107
|
+
}
|
|
108
|
+
sectionEl.appendChild(footerEl);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
37
111
|
return sectionEl;
|
|
38
112
|
}
|
|
39
113
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function renderSeparator(): HTMLElement;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var dom = require('../util/dom.js');
|
|
6
|
+
|
|
7
|
+
function renderSeparator() {
|
|
8
|
+
var sep = dom.createElement('hr');
|
|
9
|
+
sep.style.borderTop = '1pt solid #bbb';
|
|
10
|
+
return sep;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
exports.renderSeparator = renderSeparator;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function renderSoftHyphen(): HTMLElement;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var dom = require('../util/dom.js');
|
|
6
|
+
|
|
7
|
+
function renderSoftHyphen() {
|
|
8
|
+
var softHyphen = dom.createElement('span');
|
|
9
|
+
softHyphen.innerHTML = '­';
|
|
10
|
+
return softHyphen;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
exports.renderSoftHyphen = renderSoftHyphen;
|