office-viewer 0.1.0
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 +23 -0
- package/esm/OpenXML.d.ts +21 -0
- package/esm/OpenXML.js +60 -0
- package/esm/Word.d.ts +208 -0
- package/esm/Word.js +370 -0
- package/esm/index.d.ts +6 -0
- package/esm/index.js +6 -0
- package/esm/node_modules/tslib/tslib.es6.js +120 -0
- package/esm/openxml/ContentType.d.ts +12 -0
- package/esm/openxml/ContentType.js +15 -0
- package/esm/openxml/Style.d.ts +41 -0
- package/esm/openxml/Style.js +156 -0
- package/esm/openxml/Theme.d.ts +26 -0
- package/esm/openxml/Theme.js +69 -0
- package/esm/openxml/Types.d.ts +2512 -0
- package/esm/openxml/Types.js +1003 -0
- package/esm/openxml/word/Background.d.ts +11 -0
- package/esm/openxml/word/Body.d.ts +18 -0
- package/esm/openxml/word/Body.js +67 -0
- package/esm/openxml/word/Bookmark.d.ts +6 -0
- package/esm/openxml/word/Bookmark.js +18 -0
- package/esm/openxml/word/Border.d.ts +10 -0
- package/esm/openxml/word/Break.d.ts +13 -0
- package/esm/openxml/word/Break.js +19 -0
- package/esm/openxml/word/CustomXml.d.ts +8 -0
- package/esm/openxml/word/FldSimple.d.ts +7 -0
- package/esm/openxml/word/FldSimple.js +15 -0
- package/esm/openxml/word/FrameProperties.d.ts +18 -0
- package/esm/openxml/word/Hyperlink.d.ts +13 -0
- package/esm/openxml/word/Hyperlink.js +53 -0
- package/esm/openxml/word/Indent.d.ts +8 -0
- package/esm/openxml/word/InlineText.d.ts +14 -0
- package/esm/openxml/word/InlineText.js +62 -0
- package/esm/openxml/word/InstrText.d.ts +4 -0
- package/esm/openxml/word/InstrText.js +8 -0
- package/esm/openxml/word/Paragraph.d.ts +34 -0
- package/esm/openxml/word/Paragraph.js +133 -0
- package/esm/openxml/word/Pict.d.ts +6 -0
- package/esm/openxml/word/Pict.js +19 -0
- package/esm/openxml/word/Ruby.d.ts +20 -0
- package/esm/openxml/word/Ruby.js +87 -0
- package/esm/openxml/word/Run.d.ts +31 -0
- package/esm/openxml/word/Run.js +98 -0
- package/esm/openxml/word/Section.d.ts +38 -0
- package/esm/openxml/word/Section.js +59 -0
- package/esm/openxml/word/Shading.d.ts +9 -0
- package/esm/openxml/word/SmartTag.d.ts +8 -0
- package/esm/openxml/word/SmartTag.js +18 -0
- package/esm/openxml/word/Spacing.d.ts +9 -0
- package/esm/openxml/word/Sym.d.ts +8 -0
- package/esm/openxml/word/Sym.js +16 -0
- package/esm/openxml/word/Tab.d.ts +8 -0
- package/esm/openxml/word/Tab.js +17 -0
- package/esm/openxml/word/Table.d.ts +49 -0
- package/esm/openxml/word/Table.js +248 -0
- package/esm/openxml/word/VerticalAlign.d.ts +6 -0
- package/esm/openxml/word/WDocument.d.ts +13 -0
- package/esm/openxml/word/WDocument.js +58 -0
- package/esm/openxml/word/drawing/Blip.d.ts +6 -0
- package/esm/openxml/word/drawing/Blip.js +17 -0
- package/esm/openxml/word/drawing/BlipFill.d.ts +9 -0
- package/esm/openxml/word/drawing/BlipFill.js +20 -0
- package/esm/openxml/word/drawing/Drawing.d.ts +6 -0
- package/esm/openxml/word/drawing/Drawing.js +15 -0
- package/esm/openxml/word/drawing/Pic.d.ts +8 -0
- package/esm/openxml/word/drawing/Pic.js +16 -0
- package/esm/openxml/word/drawing/ShapeProperties.d.ts +9 -0
- package/esm/openxml/word/drawing/ShapeProperties.js +20 -0
- package/esm/openxml/word/drawing/Transform.d.ts +17 -0
- package/esm/openxml/word/drawing/Transform.js +30 -0
- package/esm/openxml/word/numbering/AbstractNum.d.ts +13 -0
- package/esm/openxml/word/numbering/AbstractNum.js +42 -0
- package/esm/openxml/word/numbering/Lvl.d.ts +16 -0
- package/esm/openxml/word/numbering/Lvl.js +62 -0
- package/esm/openxml/word/numbering/Num.d.ts +10 -0
- package/esm/openxml/word/numbering/Num.js +46 -0
- package/esm/openxml/word/numbering/NumberProperties.d.ts +6 -0
- package/esm/openxml/word/numbering/NumberProperties.js +21 -0
- package/esm/openxml/word/numbering/Numbering.d.ts +9 -0
- package/esm/openxml/word/numbering/Numbering.js +50 -0
- package/esm/openxml/word/properties/Properties.d.ts +12 -0
- package/esm/openxml/word/table/Tc.d.ts +46 -0
- package/esm/openxml/word/table/Tc.js +234 -0
- package/esm/openxml/word/table/Tr.d.ts +18 -0
- package/esm/openxml/word/table/Tr.js +106 -0
- package/esm/package/PackageParser.d.ts +26 -0
- package/esm/package/XMLPackageParser.d.ts +31 -0
- package/esm/package/ZipPackageParser.d.ts +29 -0
- package/esm/package/ZipPackageParser.js +70 -0
- package/esm/parse/jcToTextAlign.d.ts +5 -0
- package/esm/parse/jcToTextAlign.js +21 -0
- package/esm/parse/parseBorder.d.ts +13 -0
- package/esm/parse/parseBorder.js +78 -0
- package/esm/parse/parseColor.d.ts +22 -0
- package/esm/parse/parseColor.js +131 -0
- package/esm/parse/parseFont.d.ts +7 -0
- package/esm/parse/parseFont.js +54 -0
- package/esm/parse/parseInd.d.ts +5 -0
- package/esm/parse/parseInd.js +27 -0
- package/esm/parse/parsePr.d.ts +8 -0
- package/esm/parse/parsePr.js +325 -0
- package/esm/parse/parseRelationship.d.ts +12 -0
- package/esm/parse/parseRelationship.js +40 -0
- package/esm/parse/parseSize.d.ts +27 -0
- package/esm/parse/parseSize.js +38 -0
- package/esm/parse/parseSpacing.d.ts +7 -0
- package/esm/parse/parseSpacing.js +43 -0
- package/esm/parse/parseTextDirection.d.ts +2 -0
- package/esm/parse/parseTextDirection.js +25 -0
- package/esm/parse/parseTrHeight.d.ts +2 -0
- package/esm/parse/parseTrHeight.js +17 -0
- package/esm/render/renderBody.d.ts +6 -0
- package/esm/render/renderBody.js +53 -0
- package/esm/render/renderBookmark.d.ts +6 -0
- package/esm/render/renderBookmark.js +17 -0
- package/esm/render/renderBr.d.ts +7 -0
- package/esm/render/renderBr.js +13 -0
- package/esm/render/renderDocument.d.ts +7 -0
- package/esm/render/renderDocument.js +14 -0
- package/esm/render/renderDrawing.d.ts +8 -0
- package/esm/render/renderDrawing.js +38 -0
- package/esm/render/renderHyperLink.d.ts +7 -0
- package/esm/render/renderHyperLink.js +41 -0
- package/esm/render/renderInlineText.d.ts +6 -0
- package/esm/render/renderInlineText.js +39 -0
- package/esm/render/renderInstrText.d.ts +8 -0
- package/esm/render/renderInstrText.js +40 -0
- package/esm/render/renderNumbering.d.ts +7 -0
- package/esm/render/renderNumbering.js +161 -0
- package/esm/render/renderParagraph.d.ts +7 -0
- package/esm/render/renderParagraph.js +78 -0
- package/esm/render/renderPict.d.ts +6 -0
- package/esm/render/renderPict.js +19 -0
- package/esm/render/renderRuby.d.ts +6 -0
- package/esm/render/renderRuby.js +53 -0
- package/esm/render/renderRun.d.ts +14 -0
- package/esm/render/renderRun.js +116 -0
- package/esm/render/renderSection.d.ts +6 -0
- package/esm/render/renderSection.js +36 -0
- package/esm/render/renderStyle.d.ts +13 -0
- package/esm/render/renderStyle.js +194 -0
- package/esm/render/renderSym.d.ts +3 -0
- package/esm/render/renderSym.js +10 -0
- package/esm/render/renderTab.d.ts +7 -0
- package/esm/render/renderTab.js +19 -0
- package/esm/render/renderTable.d.ts +6 -0
- package/esm/render/renderTable.js +186 -0
- package/esm/render/setElementStyle.d.ts +6 -0
- package/esm/render/setElementStyle.js +21 -0
- package/esm/util/autoSpace.d.ts +5 -0
- package/esm/util/autoSpace.js +33 -0
- package/esm/util/blob.d.ts +9 -0
- package/esm/util/blob.js +39 -0
- package/esm/util/dom.d.ts +36 -0
- package/esm/util/dom.js +63 -0
- package/esm/util/mergeRun.d.ts +17 -0
- package/esm/util/mergeRun.js +134 -0
- package/esm/util/xml.d.ts +8 -0
- package/esm/util/xml.js +12 -0
- package/lib/OpenXML.d.ts +21 -0
- package/lib/OpenXML.js +69 -0
- package/lib/Word.d.ts +208 -0
- package/lib/Word.js +374 -0
- package/lib/index.d.ts +6 -0
- package/lib/index.js +10 -0
- package/lib/node_modules/tslib/tslib.es6.js +129 -0
- package/lib/openxml/ContentType.d.ts +12 -0
- package/lib/openxml/ContentType.js +19 -0
- package/lib/openxml/Style.d.ts +41 -0
- package/lib/openxml/Style.js +160 -0
- package/lib/openxml/Theme.d.ts +26 -0
- package/lib/openxml/Theme.js +73 -0
- package/lib/openxml/Types.d.ts +2512 -0
- package/lib/openxml/Types.js +1005 -0
- package/lib/openxml/word/Background.d.ts +11 -0
- package/lib/openxml/word/Body.d.ts +18 -0
- package/lib/openxml/word/Body.js +71 -0
- package/lib/openxml/word/Bookmark.d.ts +6 -0
- package/lib/openxml/word/Bookmark.js +22 -0
- package/lib/openxml/word/Border.d.ts +10 -0
- package/lib/openxml/word/Break.d.ts +13 -0
- package/lib/openxml/word/Break.js +23 -0
- package/lib/openxml/word/CustomXml.d.ts +8 -0
- package/lib/openxml/word/FldSimple.d.ts +7 -0
- package/lib/openxml/word/FldSimple.js +19 -0
- package/lib/openxml/word/FrameProperties.d.ts +18 -0
- package/lib/openxml/word/Hyperlink.d.ts +13 -0
- package/lib/openxml/word/Hyperlink.js +57 -0
- package/lib/openxml/word/Indent.d.ts +8 -0
- package/lib/openxml/word/InlineText.d.ts +14 -0
- package/lib/openxml/word/InlineText.js +66 -0
- package/lib/openxml/word/InstrText.d.ts +4 -0
- package/lib/openxml/word/InstrText.js +12 -0
- package/lib/openxml/word/Paragraph.d.ts +34 -0
- package/lib/openxml/word/Paragraph.js +137 -0
- package/lib/openxml/word/Pict.d.ts +6 -0
- package/lib/openxml/word/Pict.js +23 -0
- package/lib/openxml/word/Ruby.d.ts +20 -0
- package/lib/openxml/word/Ruby.js +91 -0
- package/lib/openxml/word/Run.d.ts +31 -0
- package/lib/openxml/word/Run.js +103 -0
- package/lib/openxml/word/Section.d.ts +38 -0
- package/lib/openxml/word/Section.js +63 -0
- package/lib/openxml/word/Shading.d.ts +9 -0
- package/lib/openxml/word/SmartTag.d.ts +8 -0
- package/lib/openxml/word/SmartTag.js +22 -0
- package/lib/openxml/word/Spacing.d.ts +9 -0
- package/lib/openxml/word/Sym.d.ts +8 -0
- package/lib/openxml/word/Sym.js +20 -0
- package/lib/openxml/word/Tab.d.ts +8 -0
- package/lib/openxml/word/Tab.js +21 -0
- package/lib/openxml/word/Table.d.ts +49 -0
- package/lib/openxml/word/Table.js +252 -0
- package/lib/openxml/word/VerticalAlign.d.ts +6 -0
- package/lib/openxml/word/WDocument.d.ts +13 -0
- package/lib/openxml/word/WDocument.js +62 -0
- package/lib/openxml/word/drawing/Blip.d.ts +6 -0
- package/lib/openxml/word/drawing/Blip.js +21 -0
- package/lib/openxml/word/drawing/BlipFill.d.ts +9 -0
- package/lib/openxml/word/drawing/BlipFill.js +24 -0
- package/lib/openxml/word/drawing/Drawing.d.ts +6 -0
- package/lib/openxml/word/drawing/Drawing.js +19 -0
- package/lib/openxml/word/drawing/Pic.d.ts +8 -0
- package/lib/openxml/word/drawing/Pic.js +20 -0
- package/lib/openxml/word/drawing/ShapeProperties.d.ts +9 -0
- package/lib/openxml/word/drawing/ShapeProperties.js +24 -0
- package/lib/openxml/word/drawing/Transform.d.ts +17 -0
- package/lib/openxml/word/drawing/Transform.js +34 -0
- package/lib/openxml/word/numbering/AbstractNum.d.ts +13 -0
- package/lib/openxml/word/numbering/AbstractNum.js +46 -0
- package/lib/openxml/word/numbering/Lvl.d.ts +16 -0
- package/lib/openxml/word/numbering/Lvl.js +66 -0
- package/lib/openxml/word/numbering/Num.d.ts +10 -0
- package/lib/openxml/word/numbering/Num.js +50 -0
- package/lib/openxml/word/numbering/NumberProperties.d.ts +6 -0
- package/lib/openxml/word/numbering/NumberProperties.js +25 -0
- package/lib/openxml/word/numbering/Numbering.d.ts +9 -0
- package/lib/openxml/word/numbering/Numbering.js +54 -0
- package/lib/openxml/word/properties/Properties.d.ts +12 -0
- package/lib/openxml/word/table/Tc.d.ts +46 -0
- package/lib/openxml/word/table/Tc.js +242 -0
- package/lib/openxml/word/table/Tr.d.ts +18 -0
- package/lib/openxml/word/table/Tr.js +110 -0
- package/lib/package/PackageParser.d.ts +26 -0
- package/lib/package/XMLPackageParser.d.ts +31 -0
- package/lib/package/ZipPackageParser.d.ts +29 -0
- package/lib/package/ZipPackageParser.js +74 -0
- package/lib/parse/jcToTextAlign.d.ts +5 -0
- package/lib/parse/jcToTextAlign.js +25 -0
- package/lib/parse/parseBorder.d.ts +13 -0
- package/lib/parse/parseBorder.js +83 -0
- package/lib/parse/parseColor.d.ts +22 -0
- package/lib/parse/parseColor.js +137 -0
- package/lib/parse/parseFont.d.ts +7 -0
- package/lib/parse/parseFont.js +58 -0
- package/lib/parse/parseInd.d.ts +5 -0
- package/lib/parse/parseInd.js +31 -0
- package/lib/parse/parsePr.d.ts +8 -0
- package/lib/parse/parsePr.js +329 -0
- package/lib/parse/parseRelationship.d.ts +12 -0
- package/lib/parse/parseRelationship.js +45 -0
- package/lib/parse/parseSize.d.ts +27 -0
- package/lib/parse/parseSize.js +44 -0
- package/lib/parse/parseSpacing.d.ts +7 -0
- package/lib/parse/parseSpacing.js +47 -0
- package/lib/parse/parseTextDirection.d.ts +2 -0
- package/lib/parse/parseTextDirection.js +29 -0
- package/lib/parse/parseTrHeight.d.ts +2 -0
- package/lib/parse/parseTrHeight.js +21 -0
- package/lib/render/renderBody.d.ts +6 -0
- package/lib/render/renderBody.js +57 -0
- package/lib/render/renderBookmark.d.ts +6 -0
- package/lib/render/renderBookmark.js +21 -0
- package/lib/render/renderBr.d.ts +7 -0
- package/lib/render/renderBr.js +17 -0
- package/lib/render/renderDocument.d.ts +7 -0
- package/lib/render/renderDocument.js +18 -0
- package/lib/render/renderDrawing.d.ts +8 -0
- package/lib/render/renderDrawing.js +42 -0
- package/lib/render/renderHyperLink.d.ts +7 -0
- package/lib/render/renderHyperLink.js +45 -0
- package/lib/render/renderInlineText.d.ts +6 -0
- package/lib/render/renderInlineText.js +43 -0
- package/lib/render/renderInstrText.d.ts +8 -0
- package/lib/render/renderInstrText.js +44 -0
- package/lib/render/renderNumbering.d.ts +7 -0
- package/lib/render/renderNumbering.js +165 -0
- package/lib/render/renderParagraph.d.ts +7 -0
- package/lib/render/renderParagraph.js +82 -0
- package/lib/render/renderPict.d.ts +6 -0
- package/lib/render/renderPict.js +23 -0
- package/lib/render/renderRuby.d.ts +6 -0
- package/lib/render/renderRuby.js +57 -0
- package/lib/render/renderRun.d.ts +14 -0
- package/lib/render/renderRun.js +121 -0
- package/lib/render/renderSection.d.ts +6 -0
- package/lib/render/renderSection.js +40 -0
- package/lib/render/renderStyle.d.ts +13 -0
- package/lib/render/renderStyle.js +199 -0
- package/lib/render/renderSym.d.ts +3 -0
- package/lib/render/renderSym.js +14 -0
- package/lib/render/renderTab.d.ts +7 -0
- package/lib/render/renderTab.js +23 -0
- package/lib/render/renderTable.d.ts +6 -0
- package/lib/render/renderTable.js +190 -0
- package/lib/render/setElementStyle.d.ts +6 -0
- package/lib/render/setElementStyle.js +25 -0
- package/lib/util/autoSpace.d.ts +5 -0
- package/lib/util/autoSpace.js +37 -0
- package/lib/util/blob.d.ts +9 -0
- package/lib/util/blob.js +44 -0
- package/lib/util/dom.d.ts +36 -0
- package/lib/util/dom.js +72 -0
- package/lib/util/mergeRun.d.ts +17 -0
- package/lib/util/mergeRun.js +140 -0
- package/lib/util/xml.d.ts +8 -0
- package/lib/util/xml.js +16 -0
- package/package.json +91 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/******************************************************************************
|
|
2
|
+
Copyright (c) Microsoft Corporation.
|
|
3
|
+
|
|
4
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
5
|
+
purpose with or without fee is hereby granted.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
8
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
9
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
10
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
11
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
12
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
14
|
+
***************************************************************************** */
|
|
15
|
+
/* global Reflect, Promise */
|
|
16
|
+
|
|
17
|
+
var extendStatics = function(d, b) {
|
|
18
|
+
extendStatics = Object.setPrototypeOf ||
|
|
19
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
20
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
21
|
+
return extendStatics(d, b);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
function __extends(d, b) {
|
|
25
|
+
if (typeof b !== "function" && b !== null)
|
|
26
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
27
|
+
extendStatics(d, b);
|
|
28
|
+
function __() { this.constructor = d; }
|
|
29
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
var __assign = function() {
|
|
33
|
+
__assign = Object.assign || function __assign(t) {
|
|
34
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
35
|
+
s = arguments[i];
|
|
36
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
37
|
+
}
|
|
38
|
+
return t;
|
|
39
|
+
};
|
|
40
|
+
return __assign.apply(this, arguments);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
44
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
45
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
46
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
47
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
48
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
49
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function __generator(thisArg, body) {
|
|
54
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
55
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
56
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
57
|
+
function step(op) {
|
|
58
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
59
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
60
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
61
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
62
|
+
switch (op[0]) {
|
|
63
|
+
case 0: case 1: t = op; break;
|
|
64
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
65
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
66
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
67
|
+
default:
|
|
68
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
69
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
70
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
71
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
72
|
+
if (t[2]) _.ops.pop();
|
|
73
|
+
_.trys.pop(); continue;
|
|
74
|
+
}
|
|
75
|
+
op = body.call(thisArg, _);
|
|
76
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
77
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function __values(o) {
|
|
82
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
83
|
+
if (m) return m.call(o);
|
|
84
|
+
if (o && typeof o.length === "number") return {
|
|
85
|
+
next: function () {
|
|
86
|
+
if (o && i >= o.length) o = void 0;
|
|
87
|
+
return { value: o && o[i++], done: !o };
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function __read(o, n) {
|
|
94
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
95
|
+
if (!m) return o;
|
|
96
|
+
var i = m.call(o), r, ar = [], e;
|
|
97
|
+
try {
|
|
98
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
99
|
+
}
|
|
100
|
+
catch (error) { e = { error: error }; }
|
|
101
|
+
finally {
|
|
102
|
+
try {
|
|
103
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
104
|
+
}
|
|
105
|
+
finally { if (e) throw e.error; }
|
|
106
|
+
}
|
|
107
|
+
return ar;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function __spreadArray(to, from, pack) {
|
|
111
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
112
|
+
if (ar || !(i in from)) {
|
|
113
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
114
|
+
ar[i] = from[i];
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export { __assign, __awaiter, __extends, __generator, __read, __spreadArray, __values };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface Override {
|
|
2
|
+
partName: string;
|
|
3
|
+
contentType: string;
|
|
4
|
+
}
|
|
5
|
+
export interface ContentTypes {
|
|
6
|
+
overrides: Override[];
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* 解析 [Content_Types].xml
|
|
10
|
+
*/
|
|
11
|
+
export declare function parseContentType(doc: Document): ContentTypes;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 解析 [Content_Types].xml
|
|
3
|
+
*/
|
|
4
|
+
function parseContentType(doc) {
|
|
5
|
+
var types = { overrides: [] };
|
|
6
|
+
doc.querySelectorAll('Override').forEach(function (item) {
|
|
7
|
+
types.overrides.push({
|
|
8
|
+
partName: item.getAttribute('PartName'),
|
|
9
|
+
contentType: item.getAttribute('ContentType')
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
return types;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { parseContentType };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 解析共享样式 Style
|
|
3
|
+
*/
|
|
4
|
+
import Word from '../Word';
|
|
5
|
+
import { ST_StyleType, ST_TblStyleOverrideType } from './Types';
|
|
6
|
+
import { ParagraphPr } from './word/Paragraph';
|
|
7
|
+
import { RunPr } from './word/Run';
|
|
8
|
+
import { TablePr } from './word/Table';
|
|
9
|
+
import { TcPr } from './word/table/Tc';
|
|
10
|
+
import { TrPr } from './word/table/Tr';
|
|
11
|
+
export interface CSSStyle {
|
|
12
|
+
[key: string]: string;
|
|
13
|
+
}
|
|
14
|
+
export interface TblStylePrStyle {
|
|
15
|
+
rPr?: RunPr;
|
|
16
|
+
pPr?: ParagraphPr;
|
|
17
|
+
tblPr?: TablePr;
|
|
18
|
+
trPr?: TrPr;
|
|
19
|
+
tcPr?: TcPr;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 单个样式定义
|
|
23
|
+
*/
|
|
24
|
+
export interface Style extends TblStylePrStyle {
|
|
25
|
+
id?: string;
|
|
26
|
+
type?: ST_StyleType;
|
|
27
|
+
name?: string;
|
|
28
|
+
basedOn?: string;
|
|
29
|
+
tblStylePr?: Record<ST_TblStyleOverrideType, TblStylePrStyle>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* 所有样式定义及默认样式
|
|
33
|
+
*/
|
|
34
|
+
export interface Styles {
|
|
35
|
+
styleMap: Record<string, Style>;
|
|
36
|
+
defaultStyle?: Style;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* 解析 styles.xml
|
|
40
|
+
*/
|
|
41
|
+
export declare function parseStyles(word: Word, doc: Document): Styles;
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { __values } from '../node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import { getVal } from '../OpenXML.js';
|
|
3
|
+
import { Paragraph } from './word/Paragraph.js';
|
|
4
|
+
import { Run } from './word/Run.js';
|
|
5
|
+
import { Table } from './word/Table.js';
|
|
6
|
+
import { Tc } from './word/table/Tc.js';
|
|
7
|
+
import { Tr } from './word/table/Tr.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* 解析共享样式 Style
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* 解析默认样式 docDefaults
|
|
14
|
+
*/
|
|
15
|
+
function parseDefaultStyle(word, element) {
|
|
16
|
+
var defaultStyle = {};
|
|
17
|
+
if (!element) {
|
|
18
|
+
return defaultStyle;
|
|
19
|
+
}
|
|
20
|
+
var rPrDefault = element.querySelector('rPrDefault');
|
|
21
|
+
if (rPrDefault) {
|
|
22
|
+
var rPr = rPrDefault.querySelector('rPr');
|
|
23
|
+
if (rPr) {
|
|
24
|
+
defaultStyle.rPr = Run.parseRunPr(word, rPr);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
var pPrDefault = element.querySelector('pPrDefault');
|
|
28
|
+
if (pPrDefault) {
|
|
29
|
+
var pPr = pPrDefault.querySelector('pPr');
|
|
30
|
+
if (pPr) {
|
|
31
|
+
defaultStyle.pPr = Paragraph.parseParagraphPr(word, pPr);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return defaultStyle;
|
|
35
|
+
}
|
|
36
|
+
function parseTblStylePr(word, element) {
|
|
37
|
+
var e_1, _a;
|
|
38
|
+
var style = {};
|
|
39
|
+
try {
|
|
40
|
+
for (var _b = __values(element.children), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
41
|
+
var child = _c.value;
|
|
42
|
+
var tag = child.tagName;
|
|
43
|
+
switch (tag) {
|
|
44
|
+
case 'w:rPr':
|
|
45
|
+
style.rPr = Run.parseRunPr(word, child);
|
|
46
|
+
break;
|
|
47
|
+
case 'w:pPr':
|
|
48
|
+
style.pPr = Paragraph.parseParagraphPr(word, child);
|
|
49
|
+
break;
|
|
50
|
+
case 'w:tblPr':
|
|
51
|
+
style.tblPr = Table.parseTablePr(word, child);
|
|
52
|
+
break;
|
|
53
|
+
case 'w:tcPr':
|
|
54
|
+
style.tcPr = Tc.parseTcPr(word, child);
|
|
55
|
+
break;
|
|
56
|
+
case 'w:trPr':
|
|
57
|
+
style.trPr = Tr.parseTrPr(word, child);
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
63
|
+
finally {
|
|
64
|
+
try {
|
|
65
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
66
|
+
}
|
|
67
|
+
finally { if (e_1) throw e_1.error; }
|
|
68
|
+
}
|
|
69
|
+
return style;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* 解析单个样式标签
|
|
73
|
+
*/
|
|
74
|
+
function parseStyle(word, element) {
|
|
75
|
+
var e_2, _a;
|
|
76
|
+
var style = {};
|
|
77
|
+
style.id = element.getAttribute('w:styleId') || '';
|
|
78
|
+
style.type = element.getAttribute('w:type');
|
|
79
|
+
style.tblStylePr = {};
|
|
80
|
+
Object.assign(style, parseTblStylePr(word, element));
|
|
81
|
+
try {
|
|
82
|
+
for (var _b = __values(element.children), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
83
|
+
var child = _c.value;
|
|
84
|
+
var tag = child.tagName;
|
|
85
|
+
switch (tag) {
|
|
86
|
+
case 'w:name':
|
|
87
|
+
style.name = getVal(child);
|
|
88
|
+
break;
|
|
89
|
+
case 'w:basedOn':
|
|
90
|
+
style.basedOn = getVal(child);
|
|
91
|
+
break;
|
|
92
|
+
case 'w:rPr':
|
|
93
|
+
case 'w:pPr':
|
|
94
|
+
case 'w:tblPr':
|
|
95
|
+
case 'w:tcPr':
|
|
96
|
+
case 'w:trPr':
|
|
97
|
+
// 这些在 parseTblStylePr 里实现了
|
|
98
|
+
break;
|
|
99
|
+
case 'w:tblStylePr':
|
|
100
|
+
var type = child.getAttribute('w:type');
|
|
101
|
+
style.tblStylePr[type] = parseTblStylePr(word, child);
|
|
102
|
+
break;
|
|
103
|
+
case 'w:next':
|
|
104
|
+
case 'w:link':
|
|
105
|
+
case 'w:unhideWhenUsed':
|
|
106
|
+
case 'w:qFormat':
|
|
107
|
+
case 'w:rsid':
|
|
108
|
+
case 'w:uiPriority':
|
|
109
|
+
case 'w:semiHidden':
|
|
110
|
+
case 'w:autoRedefine':
|
|
111
|
+
// 看起来和展现不相关的配置
|
|
112
|
+
break;
|
|
113
|
+
default:
|
|
114
|
+
console.warn('parseStyle Unknown tag', tag, child);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
119
|
+
finally {
|
|
120
|
+
try {
|
|
121
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
122
|
+
}
|
|
123
|
+
finally { if (e_2) throw e_2.error; }
|
|
124
|
+
}
|
|
125
|
+
return style;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* 解析 styles.xml
|
|
129
|
+
*/
|
|
130
|
+
function parseStyles(word, doc) {
|
|
131
|
+
var e_3, _a;
|
|
132
|
+
var styles = {
|
|
133
|
+
styleMap: {}
|
|
134
|
+
};
|
|
135
|
+
var stylesElement = Array.from(doc.getElementsByTagName('w:style'));
|
|
136
|
+
try {
|
|
137
|
+
for (var stylesElement_1 = __values(stylesElement), stylesElement_1_1 = stylesElement_1.next(); !stylesElement_1_1.done; stylesElement_1_1 = stylesElement_1.next()) {
|
|
138
|
+
var styleElement = stylesElement_1_1.value;
|
|
139
|
+
var style = parseStyle(word, styleElement);
|
|
140
|
+
if (style.id) {
|
|
141
|
+
styles.styleMap[style.id] = style;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
146
|
+
finally {
|
|
147
|
+
try {
|
|
148
|
+
if (stylesElement_1_1 && !stylesElement_1_1.done && (_a = stylesElement_1.return)) _a.call(stylesElement_1);
|
|
149
|
+
}
|
|
150
|
+
finally { if (e_3) throw e_3.error; }
|
|
151
|
+
}
|
|
152
|
+
styles.defaultStyle = parseDefaultStyle(word, doc.querySelector('docDefaults'));
|
|
153
|
+
return styles;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export { parseStyles };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 主要参考 14.2.7 Theme Part
|
|
3
|
+
*/
|
|
4
|
+
declare class ClrScheme {
|
|
5
|
+
name?: string;
|
|
6
|
+
colors: {
|
|
7
|
+
[key: string]: string;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
interface FontScheme {
|
|
11
|
+
name?: string;
|
|
12
|
+
}
|
|
13
|
+
interface FmtScheme {
|
|
14
|
+
name?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface ThemeElements {
|
|
17
|
+
clrScheme?: ClrScheme;
|
|
18
|
+
fontScheme?: FontScheme;
|
|
19
|
+
fmtScheme?: FmtScheme;
|
|
20
|
+
}
|
|
21
|
+
export interface Theme {
|
|
22
|
+
name?: string;
|
|
23
|
+
themeElements?: ThemeElements;
|
|
24
|
+
}
|
|
25
|
+
export declare function parseTheme(doc: Document): Theme;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { __values } from '../node_modules/tslib/tslib.es6.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 主要参考 14.2.7 Theme Part
|
|
5
|
+
*/
|
|
6
|
+
// http://webapp.docx4java.org/OnlineDemo/ecma376/DrawingML/clrScheme.html
|
|
7
|
+
var ClrScheme = /** @class */ (function () {
|
|
8
|
+
function ClrScheme() {
|
|
9
|
+
this.colors = {};
|
|
10
|
+
}
|
|
11
|
+
return ClrScheme;
|
|
12
|
+
}());
|
|
13
|
+
function parseClrScheme(doc) {
|
|
14
|
+
var e_1, _a;
|
|
15
|
+
var scheme = new ClrScheme();
|
|
16
|
+
if (!doc) {
|
|
17
|
+
return scheme;
|
|
18
|
+
}
|
|
19
|
+
scheme.name = doc.getAttribute('name') || '';
|
|
20
|
+
try {
|
|
21
|
+
for (var _b = __values(doc.children), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
22
|
+
var child = _c.value;
|
|
23
|
+
var colorName = child.tagName.replace('a:', '');
|
|
24
|
+
var clr = child.firstElementChild;
|
|
25
|
+
if (clr) {
|
|
26
|
+
var clrName = clr.nodeName.replace('a:', '');
|
|
27
|
+
if (clrName === 'sysClr') {
|
|
28
|
+
scheme.colors[colorName] = clr.getAttribute('lastClr') || '';
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
scheme.colors[colorName] = clr.getAttribute('val') || '';
|
|
32
|
+
}
|
|
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 scheme;
|
|
44
|
+
}
|
|
45
|
+
// TODO: 字体解析
|
|
46
|
+
function parseFontScheme(doc) {
|
|
47
|
+
var scheme = {};
|
|
48
|
+
return scheme;
|
|
49
|
+
}
|
|
50
|
+
function parseFmtScheme(data) {
|
|
51
|
+
var scheme = {};
|
|
52
|
+
return scheme;
|
|
53
|
+
}
|
|
54
|
+
function parseThemeElements(element) {
|
|
55
|
+
var themeElements = {};
|
|
56
|
+
if (element) {
|
|
57
|
+
themeElements.clrScheme = parseClrScheme(element.querySelector('clrScheme'));
|
|
58
|
+
themeElements.fontScheme = parseFontScheme(element.querySelector('fontScheme'));
|
|
59
|
+
themeElements.fmtScheme = parseFmtScheme(element.querySelector('fmtScheme'));
|
|
60
|
+
}
|
|
61
|
+
return themeElements;
|
|
62
|
+
}
|
|
63
|
+
function parseTheme(doc) {
|
|
64
|
+
var theme = {};
|
|
65
|
+
theme.themeElements = parseThemeElements(doc.querySelector('themeElements'));
|
|
66
|
+
return theme;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export { parseTheme };
|