pptx-templates 0.3.9 → 0.5.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/AI-INSTRUCTOR.md +46 -3
- package/CHANGELOG.md +236 -1
- package/README.md +61 -168
- package/dist/automizer.d.ts +7 -0
- package/dist/automizer.js +168 -176
- package/dist/automizer.js.map +1 -1
- package/dist/classes/content-type-registry.js +23 -36
- package/dist/classes/content-type-registry.js.map +1 -1
- package/dist/classes/element-importer.js +130 -148
- package/dist/classes/element-importer.js.map +1 -1
- package/dist/classes/has-shapes.js +81 -126
- package/dist/classes/has-shapes.js.map +1 -1
- package/dist/classes/layout.js +47 -67
- package/dist/classes/layout.js.map +1 -1
- package/dist/classes/master.js +70 -89
- package/dist/classes/master.js.map +1 -1
- package/dist/classes/placeholder-normalizer.js +48 -37
- package/dist/classes/placeholder-normalizer.js.map +1 -1
- package/dist/classes/related-content-copier.js +65 -86
- package/dist/classes/related-content-copier.js.map +1 -1
- package/dist/classes/shape.js +79 -110
- package/dist/classes/shape.js.map +1 -1
- package/dist/classes/slide-master-remover.js +108 -130
- package/dist/classes/slide-master-remover.js.map +1 -1
- package/dist/classes/slide-notes-copier.js +24 -41
- package/dist/classes/slide-notes-copier.js.map +1 -1
- package/dist/classes/slide.js +112 -141
- package/dist/classes/slide.js.map +1 -1
- package/dist/classes/template.js +82 -117
- package/dist/classes/template.js.map +1 -1
- package/dist/constants/constants.js.map +1 -1
- package/dist/enums/chart-type.js.map +1 -1
- package/dist/enums/content-type-map.js.map +1 -1
- package/dist/enums/element-type.js.map +1 -1
- package/dist/errors.js +5 -5
- package/dist/errors.js.map +1 -1
- package/dist/extensions/cli/index.js +3 -13
- package/dist/extensions/cli/index.js.map +1 -1
- package/dist/extensions/hide-slide/index.js +48 -46
- package/dist/extensions/hide-slide/index.js.map +1 -1
- package/dist/extensions/index.d.ts +13 -3
- package/dist/extensions/index.js +3 -1
- package/dist/extensions/index.js.map +1 -1
- package/dist/extensions/link-scheme/index.d.ts +12 -0
- package/dist/extensions/link-scheme/index.js +40 -0
- package/dist/extensions/link-scheme/index.js.map +1 -0
- package/dist/extensions/master-parts/index.js +36 -49
- package/dist/extensions/master-parts/index.js.map +1 -1
- package/dist/extensions/pptxgenjs-compat/img-broken-png.js.map +1 -1
- package/dist/extensions/pptxgenjs-compat/index.js.map +1 -1
- package/dist/extensions/pptxgenjs-compat/svg-fallback.js +56 -70
- package/dist/extensions/pptxgenjs-compat/svg-fallback.js.map +1 -1
- package/dist/extensions/regexp-escape/index.d.ts +10 -0
- package/dist/extensions/regexp-escape/index.js +15 -0
- package/dist/extensions/regexp-escape/index.js.map +1 -0
- package/dist/extensions/run-merge/index.js +4 -5
- package/dist/extensions/run-merge/index.js.map +1 -1
- package/dist/extensions/shape-geometry/index.js +33 -11
- package/dist/extensions/shape-geometry/index.js.map +1 -1
- package/dist/extensions/shape-geometry/presets.d.ts +1 -1
- package/dist/extensions/shape-geometry/presets.js.map +1 -1
- package/dist/extensions/shape-geometry/types.js.map +1 -1
- package/dist/extensions/template-lint/cli.js +71 -49
- package/dist/extensions/template-lint/cli.js.map +1 -1
- package/dist/extensions/template-lint/config.js +29 -13
- package/dist/extensions/template-lint/config.js.map +1 -1
- package/dist/extensions/template-lint/data-model.js +17 -20
- package/dist/extensions/template-lint/data-model.js.map +1 -1
- package/dist/extensions/template-lint/hints.js.map +1 -1
- package/dist/extensions/template-lint/index.js.map +1 -1
- package/dist/extensions/template-lint/init-cli.d.ts +2 -0
- package/dist/extensions/template-lint/init-cli.js +33 -23
- package/dist/extensions/template-lint/init-cli.js.map +1 -1
- package/dist/extensions/template-lint/lint.d.ts +1 -1
- package/dist/extensions/template-lint/lint.js +83 -64
- package/dist/extensions/template-lint/lint.js.map +1 -1
- package/dist/extensions/template-lint/skeleton.js +5 -6
- package/dist/extensions/template-lint/skeleton.js.map +1 -1
- package/dist/extensions/template-lint/types.js.map +1 -1
- package/dist/extensions/template-lint/usage-cli.js +17 -18
- package/dist/extensions/template-lint/usage-cli.js.map +1 -1
- package/dist/extensions/template-lint/usage.js +8 -9
- package/dist/extensions/template-lint/usage.js.map +1 -1
- package/dist/extensions/template-lint/watch.d.ts +2 -0
- package/dist/extensions/template-lint/watch.js +52 -7
- package/dist/extensions/template-lint/watch.js.map +1 -1
- package/dist/extensions/template-logic/clone.d.ts +2 -16
- package/dist/extensions/template-logic/clone.js +15 -90
- package/dist/extensions/template-logic/clone.js.map +1 -1
- package/dist/extensions/template-logic/commands.d.ts +1 -1
- package/dist/extensions/template-logic/commands.js +12 -11
- package/dist/extensions/template-logic/commands.js.map +1 -1
- package/dist/extensions/template-logic/expression.d.ts +15 -2
- package/dist/extensions/template-logic/expression.js +143 -63
- package/dist/extensions/template-logic/expression.js.map +1 -1
- package/dist/extensions/template-logic/images.js +58 -55
- package/dist/extensions/template-logic/images.js.map +1 -1
- package/dist/extensions/template-logic/index.js +16 -24
- package/dist/extensions/template-logic/index.js.map +1 -1
- package/dist/extensions/template-logic/list-commands.js +8 -19
- package/dist/extensions/template-logic/list-commands.js.map +1 -1
- package/dist/extensions/template-logic/renderer.d.ts +9 -0
- package/dist/extensions/template-logic/renderer.js +480 -477
- package/dist/extensions/template-logic/renderer.js.map +1 -1
- package/dist/extensions/template-logic/types.d.ts +8 -1
- package/dist/extensions/template-logic/types.js.map +1 -1
- package/dist/extensions/template-render/cli.js +34 -22
- package/dist/extensions/template-render/cli.js.map +1 -1
- package/dist/extensions/template-render/index.js +152 -107
- package/dist/extensions/template-render/index.js.map +1 -1
- package/dist/extensions/template-render/prune.d.ts +14 -0
- package/dist/extensions/template-render/prune.js +131 -0
- package/dist/extensions/template-render/prune.js.map +1 -0
- package/dist/extensions/template-render/zip-text.d.ts +9 -0
- package/dist/extensions/template-render/zip-text.js +27 -0
- package/dist/extensions/template-render/zip-text.js.map +1 -0
- package/dist/extensions/template-render/zip-writer.d.ts +16 -0
- package/dist/extensions/template-render/zip-writer.js +151 -0
- package/dist/extensions/template-render/zip-writer.js.map +1 -0
- package/dist/extensions/text-flow/flow.js +183 -207
- package/dist/extensions/text-flow/flow.js.map +1 -1
- package/dist/extensions/text-flow/font-file.d.ts +9 -0
- package/dist/extensions/text-flow/font-file.js +40 -22
- package/dist/extensions/text-flow/font-file.js.map +1 -1
- package/dist/extensions/text-flow/fonts.d.ts +4 -0
- package/dist/extensions/text-flow/fonts.js +67 -23
- package/dist/extensions/text-flow/fonts.js.map +1 -1
- package/dist/extensions/text-flow/index.js.map +1 -1
- package/dist/extensions/text-flow/layout.js +8 -9
- package/dist/extensions/text-flow/layout.js.map +1 -1
- package/dist/extensions/text-flow/slide-styles.js +18 -22
- package/dist/extensions/text-flow/slide-styles.js.map +1 -1
- package/dist/extensions/text-flow/styles.d.ts +7 -1
- package/dist/extensions/text-flow/styles.js +108 -64
- package/dist/extensions/text-flow/styles.js.map +1 -1
- package/dist/helper/archive/archive-fs.d.ts +11 -0
- package/dist/helper/archive/archive-fs.js +195 -142
- package/dist/helper/archive/archive-fs.js.map +1 -1
- package/dist/helper/archive/archive-jszip.js +101 -125
- package/dist/helper/archive/archive-jszip.js.map +1 -1
- package/dist/helper/archive/archive.d.ts +6 -0
- package/dist/helper/archive/archive.js +21 -30
- package/dist/helper/archive/archive.js.map +1 -1
- package/dist/helper/archive/jszip-fast-read.d.ts +26 -0
- package/dist/helper/archive/jszip-fast-read.js +166 -0
- package/dist/helper/archive/jszip-fast-read.js.map +1 -0
- package/dist/helper/cell-id-helper.d.ts +1 -0
- package/dist/helper/cell-id-helper.js +6 -2
- package/dist/helper/cell-id-helper.js.map +1 -1
- package/dist/helper/compute-src-rect.js +4 -5
- package/dist/helper/compute-src-rect.js.map +1 -1
- package/dist/helper/content-tracker.js +86 -114
- package/dist/helper/content-tracker.js.map +1 -1
- package/dist/helper/count-helper.js +48 -78
- package/dist/helper/count-helper.js.map +1 -1
- package/dist/helper/css-style-parser.d.ts +1 -1
- package/dist/helper/css-style-parser.js +1 -2
- package/dist/helper/css-style-parser.js.map +1 -1
- package/dist/helper/file-helper.js +30 -48
- package/dist/helper/file-helper.js.map +1 -1
- package/dist/helper/general-helper.js.map +1 -1
- package/dist/helper/generate/generate-pptxgenjs.js +36 -48
- package/dist/helper/generate/generate-pptxgenjs.js.map +1 -1
- package/dist/helper/html-to-multitext-helper.d.ts +4 -4
- package/dist/helper/html-to-multitext-helper.js +46 -23
- package/dist/helper/html-to-multitext-helper.js.map +1 -1
- package/dist/helper/hyperlink-processor.js +125 -139
- package/dist/helper/hyperlink-processor.js.map +1 -1
- package/dist/helper/image-dimensions.js.map +1 -1
- package/dist/helper/jszip-helper.d.ts +1 -1
- package/dist/helper/jszip-helper.js +40 -33
- package/dist/helper/jszip-helper.js.map +1 -1
- package/dist/helper/layout-index.js +51 -71
- package/dist/helper/layout-index.js.map +1 -1
- package/dist/helper/logger.js +4 -4
- package/dist/helper/logger.js.map +1 -1
- package/dist/helper/media-deduplicator.d.ts +24 -0
- package/dist/helper/media-deduplicator.js +81 -34
- package/dist/helper/media-deduplicator.js.map +1 -1
- package/dist/helper/modify-background-helper.js +46 -46
- package/dist/helper/modify-background-helper.js.map +1 -1
- package/dist/helper/modify-chart-helper.d.ts +1 -1
- package/dist/helper/modify-chart-helper.js +597 -591
- package/dist/helper/modify-chart-helper.js.map +1 -1
- package/dist/helper/modify-cleanup-helper.js +112 -112
- package/dist/helper/modify-cleanup-helper.js.map +1 -1
- package/dist/helper/modify-color-helper.d.ts +1 -1
- package/dist/helper/modify-color-helper.js +53 -53
- package/dist/helper/modify-color-helper.js.map +1 -1
- package/dist/helper/modify-helper.js +25 -25
- package/dist/helper/modify-helper.js.map +1 -1
- package/dist/helper/modify-hyperlink-element.js.map +1 -1
- package/dist/helper/modify-hyperlink-helper.js +152 -158
- package/dist/helper/modify-hyperlink-helper.js.map +1 -1
- package/dist/helper/modify-image-helper.d.ts +1 -1
- package/dist/helper/modify-image-helper.js +121 -132
- package/dist/helper/modify-image-helper.js.map +1 -1
- package/dist/helper/modify-presentation-helper.js +137 -154
- package/dist/helper/modify-presentation-helper.js.map +1 -1
- package/dist/helper/modify-shape-helper.js +262 -262
- package/dist/helper/modify-shape-helper.js.map +1 -1
- package/dist/helper/modify-table-helper.js +95 -84
- package/dist/helper/modify-table-helper.js.map +1 -1
- package/dist/helper/modify-text-helper.d.ts +8 -0
- package/dist/helper/modify-text-helper.js +202 -190
- package/dist/helper/modify-text-helper.js.map +1 -1
- package/dist/helper/modify-xml-helper.js +36 -36
- package/dist/helper/modify-xml-helper.js.map +1 -1
- package/dist/helper/multitext-helper.js +13 -9
- package/dist/helper/multitext-helper.js.map +1 -1
- package/dist/helper/ppt-paths.js +17 -17
- package/dist/helper/ppt-paths.js.map +1 -1
- package/dist/helper/shape-type-detector.js +18 -29
- package/dist/helper/shape-type-detector.js.map +1 -1
- package/dist/helper/text-replace-helper.js +8 -8
- package/dist/helper/text-replace-helper.js.map +1 -1
- package/dist/helper/xml/lnLRTB.js.map +1 -1
- package/dist/helper/xml/prstGeom.js.map +1 -1
- package/dist/helper/xml-clone.d.ts +24 -0
- package/dist/helper/xml-clone.js +269 -0
- package/dist/helper/xml-clone.js.map +1 -0
- package/dist/helper/xml-elements.js +17 -20
- package/dist/helper/xml-elements.js.map +1 -1
- package/dist/helper/xml-find.d.ts +4 -0
- package/dist/helper/xml-find.js +48 -0
- package/dist/helper/xml-find.js.map +1 -0
- package/dist/helper/xml-helper.js +102 -135
- package/dist/helper/xml-helper.js.map +1 -1
- package/dist/helper/xml-parse-cache.d.ts +31 -0
- package/dist/helper/xml-parse-cache.js +71 -0
- package/dist/helper/xml-parse-cache.js.map +1 -0
- package/dist/helper/xml-placeholder-helper.js +10 -10
- package/dist/helper/xml-placeholder-helper.js.map +1 -1
- package/dist/helper/xml-pretty-print.js.map +1 -1
- package/dist/helper/xml-relationship-helper.js +132 -147
- package/dist/helper/xml-relationship-helper.js.map +1 -1
- package/dist/helper/xml-serializer.d.ts +2 -0
- package/dist/helper/xml-serializer.js +192 -0
- package/dist/helper/xml-serializer.js.map +1 -0
- package/dist/helper/xml-slide-helper.js +109 -129
- package/dist/helper/xml-slide-helper.js.map +1 -1
- package/dist/helper/xml-template-helper.js +120 -144
- package/dist/helper/xml-template-helper.js.map +1 -1
- package/dist/helper/xmldom-sax-patch.js +52 -2
- package/dist/helper/xmldom-sax-patch.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/interfaces/iarchive.js.map +1 -1
- package/dist/interfaces/ichart.js.map +1 -1
- package/dist/interfaces/icounter.js.map +1 -1
- package/dist/interfaces/igenerator.js.map +1 -1
- package/dist/interfaces/iimage.js.map +1 -1
- package/dist/interfaces/ilayout.js.map +1 -1
- package/dist/interfaces/imaster.js.map +1 -1
- package/dist/interfaces/imulti-text.js.map +1 -1
- package/dist/interfaces/ipptxgenjs-slide.js.map +1 -1
- package/dist/interfaces/ipresentation-props.js.map +1 -1
- package/dist/interfaces/ishape-action.js.map +1 -1
- package/dist/interfaces/ishape.js.map +1 -1
- package/dist/interfaces/islide.js.map +1 -1
- package/dist/interfaces/itemplate.js.map +1 -1
- package/dist/interfaces/pres-template.js.map +1 -1
- package/dist/interfaces/root-pres-template.js.map +1 -1
- package/dist/modify/modify-chart.d.ts +4 -4
- package/dist/modify/modify-chart.js +35 -23
- package/dist/modify/modify-chart.js.map +1 -1
- package/dist/modify/modify-table.d.ts +0 -1
- package/dist/modify/modify-table.js +19 -27
- package/dist/modify/modify-table.js.map +1 -1
- package/dist/shapes/chart.js +238 -287
- package/dist/shapes/chart.js.map +1 -1
- package/dist/shapes/diagram.d.ts +14 -0
- package/dist/shapes/diagram.js +167 -103
- package/dist/shapes/diagram.js.map +1 -1
- package/dist/shapes/generic.js +62 -83
- package/dist/shapes/generic.js.map +1 -1
- package/dist/shapes/hyperlink.d.ts +0 -1
- package/dist/shapes/hyperlink.js +84 -124
- package/dist/shapes/hyperlink.js.map +1 -1
- package/dist/shapes/image.js +118 -149
- package/dist/shapes/image.js.map +1 -1
- package/dist/shapes/ole.js +148 -188
- package/dist/shapes/ole.js.map +1 -1
- package/dist/types/chart-types.js.map +1 -1
- package/dist/types/modify-types.js.map +1 -1
- package/dist/types/shape-types.js.map +1 -1
- package/dist/types/table-types.js.map +1 -1
- package/dist/types/types.d.ts +7 -0
- package/dist/types/types.js.map +1 -1
- package/dist/types/xml-types.js.map +1 -1
- package/dist/vendor/pptxgenjs/README.md +8 -3
- package/dist/vendor/pptxgenjs/index.js +19 -2
- package/package.json +13 -16
package/dist/shapes/chart.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -45,120 +36,98 @@ class Chart extends shape_1.Shape {
|
|
|
45
36
|
this.styleRelationFiles = {};
|
|
46
37
|
this.hasWorkbook = true;
|
|
47
38
|
}
|
|
48
|
-
modify(targetTemplate, targetSlideNumber) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return this;
|
|
54
|
-
});
|
|
39
|
+
async modify(targetTemplate, targetSlideNumber) {
|
|
40
|
+
await this.prepare(targetTemplate, targetSlideNumber);
|
|
41
|
+
await this.clone();
|
|
42
|
+
await this.replaceIntoSlideTree();
|
|
43
|
+
return this;
|
|
55
44
|
}
|
|
56
|
-
append(targetTemplate, targetSlideNumber) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return this;
|
|
62
|
-
});
|
|
45
|
+
async append(targetTemplate, targetSlideNumber) {
|
|
46
|
+
await this.prepare(targetTemplate, targetSlideNumber);
|
|
47
|
+
await this.clone();
|
|
48
|
+
await this.appendToSlideTree();
|
|
49
|
+
return this;
|
|
63
50
|
}
|
|
64
|
-
remove(targetTemplate, targetSlideNumber) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return this;
|
|
69
|
-
});
|
|
51
|
+
async remove(targetTemplate, targetSlideNumber) {
|
|
52
|
+
await this.prepare(targetTemplate, targetSlideNumber);
|
|
53
|
+
await this.removeFromSlideTree();
|
|
54
|
+
return this;
|
|
70
55
|
}
|
|
71
|
-
modifyOnAddedSlide(targetTemplate, targetSlideNumber) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return this;
|
|
76
|
-
});
|
|
56
|
+
async modifyOnAddedSlide(targetTemplate, targetSlideNumber) {
|
|
57
|
+
await this.prepare(targetTemplate, targetSlideNumber);
|
|
58
|
+
await this.updateElementsRelId();
|
|
59
|
+
return this;
|
|
77
60
|
}
|
|
78
|
-
prepare(targetTemplate, targetSlideNumber) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
yield this.appendToSlideRels();
|
|
87
|
-
});
|
|
61
|
+
async prepare(targetTemplate, targetSlideNumber) {
|
|
62
|
+
await this.setTarget(targetTemplate, targetSlideNumber);
|
|
63
|
+
this.targetNumber = this.targetTemplate.incrementCounter('charts');
|
|
64
|
+
this.wbRelsPath = ppt_paths_1.PptPaths.chartPartRels(this.subtype, this.sourceNumber);
|
|
65
|
+
await this.copyFiles();
|
|
66
|
+
await this.copyChartStyleFiles();
|
|
67
|
+
await this.appendTypes();
|
|
68
|
+
await this.appendToSlideRels();
|
|
88
69
|
}
|
|
89
|
-
clone() {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
yield this.updateTargetElementRelId();
|
|
94
|
-
});
|
|
70
|
+
async clone() {
|
|
71
|
+
await this.setTargetElement();
|
|
72
|
+
await this.modifyChartData();
|
|
73
|
+
await this.updateTargetElementRelId();
|
|
95
74
|
}
|
|
96
|
-
modifyChartData() {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
yield this.writeWorkbook(workbook);
|
|
106
|
-
});
|
|
75
|
+
async modifyChartData() {
|
|
76
|
+
if (!this.hasWorkbook) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const chartXml = await xml_helper_1.XmlHelper.getXmlFromArchive(this.targetArchive, ppt_paths_1.PptPaths.chartPart(this.subtype, this.targetNumber));
|
|
80
|
+
const workbook = await this.readWorkbook();
|
|
81
|
+
this.applyChartCallbacks(this.callbacks, this.targetElement, chartXml, workbook);
|
|
82
|
+
xml_helper_1.XmlHelper.writeXmlToArchive(this.targetArchive, ppt_paths_1.PptPaths.chartPart(this.subtype, this.targetNumber), chartXml);
|
|
83
|
+
await this.writeWorkbook(workbook);
|
|
107
84
|
}
|
|
108
|
-
readWorkbook() {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
};
|
|
123
|
-
});
|
|
85
|
+
async readWorkbook() {
|
|
86
|
+
const workbookFilename = ppt_paths_1.PptPaths.embedding(`${this.worksheetFilePrefix}${this.targetWorksheet}${this.wbExtension}`);
|
|
87
|
+
const archive = await this.targetArchive.extract(workbookFilename);
|
|
88
|
+
const sheet = await xml_helper_1.XmlHelper.getXmlFromArchive(archive, 'xl/worksheets/sheet1.xml');
|
|
89
|
+
const table = file_helper_1.FileHelper.fileExistsInArchive(archive, 'xl/tables/table1.xml')
|
|
90
|
+
? await xml_helper_1.XmlHelper.getXmlFromArchive(archive, 'xl/tables/table1.xml')
|
|
91
|
+
: undefined;
|
|
92
|
+
const sharedStrings = await xml_helper_1.XmlHelper.getXmlFromArchive(archive, 'xl/sharedStrings.xml');
|
|
93
|
+
return {
|
|
94
|
+
archive,
|
|
95
|
+
sheet,
|
|
96
|
+
sharedStrings,
|
|
97
|
+
table,
|
|
98
|
+
};
|
|
124
99
|
}
|
|
125
|
-
writeWorkbook(workbook) {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
yield this.targetArchive.write(ppt_paths_1.PptPaths.embedding(`${this.worksheetFilePrefix}${this.targetWorksheet}${this.wbExtension}`), worksheet);
|
|
134
|
-
});
|
|
100
|
+
async writeWorkbook(workbook) {
|
|
101
|
+
xml_helper_1.XmlHelper.writeXmlToArchive(workbook.archive, 'xl/worksheets/sheet1.xml', workbook.sheet);
|
|
102
|
+
if (workbook.table) {
|
|
103
|
+
xml_helper_1.XmlHelper.writeXmlToArchive(workbook.archive, 'xl/tables/table1.xml', workbook.table);
|
|
104
|
+
}
|
|
105
|
+
xml_helper_1.XmlHelper.writeXmlToArchive(workbook.archive, 'xl/sharedStrings.xml', workbook.sharedStrings);
|
|
106
|
+
const worksheet = await workbook.archive.getContent({});
|
|
107
|
+
await this.targetArchive.write(ppt_paths_1.PptPaths.embedding(`${this.worksheetFilePrefix}${this.targetWorksheet}${this.wbExtension}`), worksheet);
|
|
135
108
|
}
|
|
136
|
-
copyFiles() {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
yield this.editTargetWorksheetRel();
|
|
151
|
-
});
|
|
109
|
+
async copyFiles() {
|
|
110
|
+
await this.copyChartFiles();
|
|
111
|
+
this.worksheetFilePrefix = await this.getWorksheetFilePrefix(this.wbRelsPath);
|
|
112
|
+
if (this.hasWorkbook) {
|
|
113
|
+
const worksheets = await xml_relationship_helper_1.XmlRelationshipHelper.getRelationshipTargetsByPrefix(this.sourceArchive, this.wbRelsPath, `${this.wbEmbeddingsPath}${this.worksheetFilePrefix}`);
|
|
114
|
+
const worksheet = worksheets[0];
|
|
115
|
+
this.sourceWorksheet = worksheet.number === 0 ? '' : worksheet.number;
|
|
116
|
+
this.targetWorksheet = '-created-' + this.targetNumber;
|
|
117
|
+
await this.copyWorksheetFile();
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
logger_1.log.info('Chart has no worksheet: ' + this.wbRelsPath);
|
|
121
|
+
}
|
|
122
|
+
await this.editTargetWorksheetRel();
|
|
152
123
|
}
|
|
153
|
-
getWorksheetFilePrefix(targetRelFile) {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
return relationTargets[0].filenameBase;
|
|
161
|
-
});
|
|
124
|
+
async getWorksheetFilePrefix(targetRelFile) {
|
|
125
|
+
const relationTargets = await xml_relationship_helper_1.XmlRelationshipHelper.getRelationshipTargetsByPrefix(this.sourceArchive, targetRelFile, this.wbEmbeddingsPath);
|
|
126
|
+
if (!relationTargets[0]) {
|
|
127
|
+
this.hasWorkbook = false;
|
|
128
|
+
return '';
|
|
129
|
+
}
|
|
130
|
+
return relationTargets[0].filenameBase;
|
|
162
131
|
}
|
|
163
132
|
/**
|
|
164
133
|
* Registers the copied chart parts in `[Content_Types].xml`.
|
|
@@ -170,65 +139,57 @@ class Chart extends shape_1.Shape {
|
|
|
170
139
|
* orphan. `prepare` runs `copyChartStyleFiles` first, so the relations are
|
|
171
140
|
* known here.
|
|
172
141
|
*/
|
|
173
|
-
appendTypes() {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
}
|
|
191
|
-
});
|
|
142
|
+
async appendTypes() {
|
|
143
|
+
if (this.hasWorkbook) {
|
|
144
|
+
await this.appendChartExtensionToContentType();
|
|
145
|
+
}
|
|
146
|
+
await this.appendChartToContentType();
|
|
147
|
+
if (this.hasStyleRelation('relTypeChartUserShapes')) {
|
|
148
|
+
await this.appendChartUserShapesToContentType();
|
|
149
|
+
}
|
|
150
|
+
if (this.hasStyleRelation('relTypeChartColorStyle')) {
|
|
151
|
+
await this.appendColorToContentType();
|
|
152
|
+
}
|
|
153
|
+
if (this.hasStyleRelation('relTypeChartStyle')) {
|
|
154
|
+
await this.appendStyleToContentType();
|
|
155
|
+
}
|
|
156
|
+
if (this.hasStyleRelation('relTypeChartThemeOverride')) {
|
|
157
|
+
await this.appendThemeOverrideToContentType();
|
|
158
|
+
}
|
|
192
159
|
}
|
|
193
160
|
hasStyleRelation(styleType) {
|
|
194
|
-
|
|
195
|
-
return ((_a = this.styleRelationFiles[styleType]) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
161
|
+
return this.styleRelationFiles[styleType]?.length > 0;
|
|
196
162
|
}
|
|
197
|
-
copyChartFiles() {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
yield file_helper_1.FileHelper.zipCopy(this.sourceArchive, ppt_paths_1.PptPaths.chartPartRels(this.subtype, this.sourceNumber), this.targetArchive, ppt_paths_1.PptPaths.chartPartRels(this.subtype, this.targetNumber));
|
|
201
|
-
});
|
|
163
|
+
async copyChartFiles() {
|
|
164
|
+
await file_helper_1.FileHelper.zipCopy(this.sourceArchive, ppt_paths_1.PptPaths.chartPart(this.subtype, this.sourceNumber), this.targetArchive, ppt_paths_1.PptPaths.chartPart(this.subtype, this.targetNumber));
|
|
165
|
+
await file_helper_1.FileHelper.zipCopy(this.sourceArchive, ppt_paths_1.PptPaths.chartPartRels(this.subtype, this.sourceNumber), this.targetArchive, ppt_paths_1.PptPaths.chartPartRels(this.subtype, this.targetNumber));
|
|
202
166
|
}
|
|
203
|
-
copyChartStyleFiles() {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
yield this.appendImageExtensionToContentType(imageInfo.extension);
|
|
218
|
-
yield file_helper_1.FileHelper.zipCopy(this.sourceArchive, imageInfo.source, this.targetArchive, imageInfo.target);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
if ((_c = this.styleRelationFiles.relTypeChartUserShapes) === null || _c === void 0 ? void 0 : _c.length) {
|
|
222
|
-
const sourceFile = this.styleRelationFiles.relTypeChartUserShapes[0].replace('../drawings/', '');
|
|
223
|
-
const sourceDrawing = `${ppt_paths_1.PptPaths.drawingsDir}/${sourceFile}`;
|
|
224
|
-
yield file_helper_1.FileHelper.zipCopy(this.sourceArchive, sourceDrawing, this.targetArchive, ppt_paths_1.PptPaths.drawing(this.targetNumber));
|
|
225
|
-
yield this.copyChartUserShapesRels(sourceDrawing);
|
|
167
|
+
async copyChartStyleFiles() {
|
|
168
|
+
await this.getChartStyles();
|
|
169
|
+
if (this.styleRelationFiles.relTypeChartStyle?.length) {
|
|
170
|
+
await file_helper_1.FileHelper.zipCopy(this.sourceArchive, `ppt/charts/${this.styleRelationFiles.relTypeChartStyle[0]}`, this.targetArchive, ppt_paths_1.PptPaths.chartPart('style', this.targetNumber));
|
|
171
|
+
}
|
|
172
|
+
if (this.styleRelationFiles.relTypeChartColorStyle?.length) {
|
|
173
|
+
await file_helper_1.FileHelper.zipCopy(this.sourceArchive, `ppt/charts/${this.styleRelationFiles.relTypeChartColorStyle[0]}`, this.targetArchive, ppt_paths_1.PptPaths.chartPart('colors', this.targetNumber));
|
|
174
|
+
}
|
|
175
|
+
if (this.styleRelationFiles.relTypeChartImage) {
|
|
176
|
+
for (const relTypeChartImage of this.styleRelationFiles
|
|
177
|
+
.relTypeChartImage) {
|
|
178
|
+
const imageInfo = this.getTargetChartImageUri(relTypeChartImage);
|
|
179
|
+
await this.appendImageExtensionToContentType(imageInfo.extension);
|
|
180
|
+
await file_helper_1.FileHelper.zipCopy(this.sourceArchive, imageInfo.source, this.targetArchive, imageInfo.target);
|
|
226
181
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}
|
|
231
|
-
|
|
182
|
+
}
|
|
183
|
+
if (this.styleRelationFiles.relTypeChartUserShapes?.length) {
|
|
184
|
+
const sourceFile = this.styleRelationFiles.relTypeChartUserShapes[0].replace('../drawings/', '');
|
|
185
|
+
const sourceDrawing = `${ppt_paths_1.PptPaths.drawingsDir}/${sourceFile}`;
|
|
186
|
+
await file_helper_1.FileHelper.zipCopy(this.sourceArchive, sourceDrawing, this.targetArchive, ppt_paths_1.PptPaths.drawing(this.targetNumber));
|
|
187
|
+
await this.copyChartUserShapesRels(sourceDrawing);
|
|
188
|
+
}
|
|
189
|
+
if (this.styleRelationFiles.relTypeChartThemeOverride?.length) {
|
|
190
|
+
const sourceFile = this.styleRelationFiles.relTypeChartThemeOverride[0].replace('../theme/', '');
|
|
191
|
+
await file_helper_1.FileHelper.zipCopy(this.sourceArchive, `ppt/theme/${sourceFile}`, this.targetArchive, `ppt/theme/themeOverride${this.targetNumber}.xml`);
|
|
192
|
+
}
|
|
232
193
|
}
|
|
233
194
|
/**
|
|
234
195
|
* Copies the `_rels` file of a chart's `chartUserShapes` drawing, if it has
|
|
@@ -250,116 +211,106 @@ class Chart extends shape_1.Shape {
|
|
|
250
211
|
*
|
|
251
212
|
* @param sourceDrawing Path of the drawing part inside the source archive
|
|
252
213
|
*/
|
|
253
|
-
copyChartUserShapesRels(sourceDrawing) {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
214
|
+
async copyChartUserShapesRels(sourceDrawing) {
|
|
215
|
+
const sourceRels = ppt_paths_1.PptPaths.relsOf(sourceDrawing);
|
|
216
|
+
if (!file_helper_1.FileHelper.fileExistsInArchive(this.sourceArchive, sourceRels)) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
const targetRels = ppt_paths_1.PptPaths.drawingRels(this.targetNumber);
|
|
220
|
+
await file_helper_1.FileHelper.zipCopy(this.sourceArchive, sourceRels, this.targetArchive, targetRels);
|
|
221
|
+
const relsXml = await xml_helper_1.XmlHelper.getXmlFromArchive(this.targetArchive, targetRels);
|
|
222
|
+
const relationships = relsXml.getElementsByTagName('Relationship');
|
|
223
|
+
for (let i = 0; i < relationships.length; i++) {
|
|
224
|
+
const relationship = relationships[i];
|
|
225
|
+
const type = relationship.getAttribute('Type');
|
|
226
|
+
const isExternal = relationship.getAttribute('TargetMode') === 'External';
|
|
227
|
+
if (!isExternal && type === this.relTypeChartImage) {
|
|
228
|
+
const imageInfo = this.getTargetChartImageUri(relationship.getAttribute('Target'));
|
|
229
|
+
await this.appendImageExtensionToContentType(imageInfo.extension);
|
|
230
|
+
await file_helper_1.FileHelper.zipCopy(this.sourceArchive, imageInfo.source, this.targetArchive, imageInfo.target);
|
|
231
|
+
relationship.setAttribute('Target', imageInfo.rel);
|
|
259
232
|
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
for (let i = 0; i < relationships.length; i++) {
|
|
265
|
-
const relationship = relationships[i];
|
|
266
|
-
const type = relationship.getAttribute('Type');
|
|
267
|
-
const isExternal = relationship.getAttribute('TargetMode') === 'External';
|
|
268
|
-
if (!isExternal && type === this.relTypeChartImage) {
|
|
269
|
-
const imageInfo = this.getTargetChartImageUri(relationship.getAttribute('Target'));
|
|
270
|
-
yield this.appendImageExtensionToContentType(imageInfo.extension);
|
|
271
|
-
yield file_helper_1.FileHelper.zipCopy(this.sourceArchive, imageInfo.source, this.targetArchive, imageInfo.target);
|
|
272
|
-
relationship.setAttribute('Target', imageInfo.rel);
|
|
273
|
-
}
|
|
274
|
-
else if (!isExternal) {
|
|
275
|
-
logger_1.log.warn(`Chart user shapes drawing ${sourceDrawing} relates to ` +
|
|
276
|
-
`${relationship.getAttribute('Target')} (${type}); this ` +
|
|
277
|
-
`relationship type is copied unchanged and may not resolve in the output.`);
|
|
278
|
-
}
|
|
279
|
-
(_a = this.targetArchive.contentTracker) === null || _a === void 0 ? void 0 : _a.trackRelation(targetRels, {
|
|
280
|
-
Id: relationship.getAttribute('Id'),
|
|
281
|
-
Target: relationship.getAttribute('Target'),
|
|
282
|
-
Type: type,
|
|
283
|
-
});
|
|
233
|
+
else if (!isExternal) {
|
|
234
|
+
logger_1.log.warn(`Chart user shapes drawing ${sourceDrawing} relates to ` +
|
|
235
|
+
`${relationship.getAttribute('Target')} (${type}); this ` +
|
|
236
|
+
`relationship type is copied unchanged and may not resolve in the output.`);
|
|
284
237
|
}
|
|
285
|
-
|
|
286
|
-
|
|
238
|
+
this.targetArchive.contentTracker?.trackRelation(targetRels, {
|
|
239
|
+
Id: relationship.getAttribute('Id'),
|
|
240
|
+
Target: relationship.getAttribute('Target'),
|
|
241
|
+
Type: type,
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
xml_helper_1.XmlHelper.writeXmlToArchive(this.targetArchive, targetRels, relsXml);
|
|
287
245
|
}
|
|
288
|
-
getChartStyles() {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
this.styleRelationFiles[styleType]
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
});
|
|
306
|
-
}
|
|
246
|
+
async getChartStyles() {
|
|
247
|
+
const styleTypes = [
|
|
248
|
+
'relTypeChartStyle',
|
|
249
|
+
'relTypeChartColorStyle',
|
|
250
|
+
'relTypeChartImage',
|
|
251
|
+
'relTypeChartThemeOverride',
|
|
252
|
+
'relTypeChartUserShapes',
|
|
253
|
+
];
|
|
254
|
+
for (const i in styleTypes) {
|
|
255
|
+
const styleType = styleTypes[i];
|
|
256
|
+
const styleRelation = await xml_relationship_helper_1.XmlRelationshipHelper.getTargetsByRelationshipType(this.sourceArchive, this.wbRelsPath, this[styleType]);
|
|
257
|
+
this.styleRelationFiles[styleType] =
|
|
258
|
+
this.styleRelationFiles[styleType] || [];
|
|
259
|
+
if (styleRelation.length) {
|
|
260
|
+
styleRelation.forEach((styleRelation) => {
|
|
261
|
+
this.styleRelationFiles[styleType].push(styleRelation.file);
|
|
262
|
+
});
|
|
307
263
|
}
|
|
308
|
-
}
|
|
264
|
+
}
|
|
309
265
|
}
|
|
310
|
-
appendToSlideRels() {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
return xml_helper_1.XmlHelper.append(xml_relationship_helper_1.XmlRelationshipHelper.createRelationshipChild(this.targetArchive, this.targetSlideRelFile, attributes));
|
|
322
|
-
});
|
|
266
|
+
async appendToSlideRels() {
|
|
267
|
+
this.createdRid = await xml_relationship_helper_1.XmlRelationshipHelper.getNextRelId(this.targetArchive, this.targetSlideRelFile);
|
|
268
|
+
const type = this.subtype === 'chart'
|
|
269
|
+
? 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart'
|
|
270
|
+
: 'http://schemas.microsoft.com/office/2014/relationships/chartEx';
|
|
271
|
+
const attributes = {
|
|
272
|
+
Id: this.createdRid,
|
|
273
|
+
Type: type,
|
|
274
|
+
Target: `../charts/${this.subtype}${this.targetNumber}.xml`,
|
|
275
|
+
};
|
|
276
|
+
return xml_helper_1.XmlHelper.append(xml_relationship_helper_1.XmlRelationshipHelper.createRelationshipChild(this.targetArchive, this.targetSlideRelFile, attributes));
|
|
323
277
|
}
|
|
324
|
-
editTargetWorksheetRel() {
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
Target: element.getAttribute('Target'),
|
|
358
|
-
Type: element.getAttribute('Type'),
|
|
359
|
-
});
|
|
278
|
+
async editTargetWorksheetRel() {
|
|
279
|
+
const targetRelFile = ppt_paths_1.PptPaths.chartPartRels(this.subtype, this.targetNumber);
|
|
280
|
+
const relXml = await xml_helper_1.XmlHelper.getXmlFromArchive(this.targetArchive, targetRelFile);
|
|
281
|
+
const relations = relXml.getElementsByTagName('Relationship');
|
|
282
|
+
Object.keys(relations)
|
|
283
|
+
.map((key) => relations[Number(key)])
|
|
284
|
+
.filter((element) => element && element.getAttribute)
|
|
285
|
+
.forEach((element) => {
|
|
286
|
+
const type = element.getAttribute('Type');
|
|
287
|
+
switch (type) {
|
|
288
|
+
case 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/package':
|
|
289
|
+
this.updateTargetWorksheetRelation(targetRelFile, element, 'Target', `${this.wbEmbeddingsPath}${this.worksheetFilePrefix}${this.targetWorksheet}${this.wbExtension}`);
|
|
290
|
+
break;
|
|
291
|
+
case this.relTypeChartColorStyle:
|
|
292
|
+
this.updateTargetWorksheetRelation(targetRelFile, element, 'Target', `colors${this.targetNumber}.xml`);
|
|
293
|
+
break;
|
|
294
|
+
case this.relTypeChartStyle:
|
|
295
|
+
this.updateTargetWorksheetRelation(targetRelFile, element, 'Target', `style${this.targetNumber}.xml`);
|
|
296
|
+
break;
|
|
297
|
+
case this.relTypeChartImage:
|
|
298
|
+
this.updateTargetWorksheetRelation(targetRelFile, element, 'Target', this.getTargetChartImageUri(element.getAttribute('Target')).rel);
|
|
299
|
+
break;
|
|
300
|
+
case this.relTypeChartThemeOverride:
|
|
301
|
+
this.updateTargetWorksheetRelation(targetRelFile, element, 'Target', `../theme/themeOverride${this.targetNumber}.xml`);
|
|
302
|
+
break;
|
|
303
|
+
case this.relTypeChartUserShapes:
|
|
304
|
+
this.updateTargetWorksheetRelation(targetRelFile, element, 'Target', ppt_paths_1.PptPaths.relative.drawing(this.targetNumber));
|
|
305
|
+
break;
|
|
306
|
+
}
|
|
307
|
+
this.targetArchive.contentTracker?.trackRelation(targetRelFile, {
|
|
308
|
+
Id: element.getAttribute('Id'),
|
|
309
|
+
Target: element.getAttribute('Target'),
|
|
310
|
+
Type: element.getAttribute('Type'),
|
|
360
311
|
});
|
|
361
|
-
xml_helper_1.XmlHelper.writeXmlToArchive(this.targetArchive, targetRelFile, relXml);
|
|
362
312
|
});
|
|
313
|
+
xml_helper_1.XmlHelper.writeXmlToArchive(this.targetArchive, targetRelFile, relXml);
|
|
363
314
|
}
|
|
364
315
|
updateTargetWorksheetRelation(targetRelFile, element, attribute, value) {
|
|
365
316
|
element.setAttribute(attribute, value);
|
|
@@ -376,20 +327,22 @@ class Chart extends shape_1.Shape {
|
|
|
376
327
|
extension: extension,
|
|
377
328
|
};
|
|
378
329
|
}
|
|
379
|
-
copyWorksheetFile() {
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
logger_1.log.warn(e);
|
|
385
|
-
});
|
|
330
|
+
async copyWorksheetFile() {
|
|
331
|
+
const sourceFile = ppt_paths_1.PptPaths.embedding(`${this.worksheetFilePrefix}${this.sourceWorksheet}${this.wbExtension}`);
|
|
332
|
+
const targetFile = ppt_paths_1.PptPaths.embedding(`${this.worksheetFilePrefix}${this.targetWorksheet}${this.wbExtension}`);
|
|
333
|
+
await file_helper_1.FileHelper.zipCopy(this.sourceArchive, sourceFile, this.targetArchive, targetFile).catch((e) => {
|
|
334
|
+
logger_1.log.warn(e);
|
|
386
335
|
});
|
|
387
336
|
}
|
|
388
337
|
appendChartExtensionToContentType() {
|
|
389
|
-
return xml_helper_1.XmlHelper.appendIf(
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
338
|
+
return xml_helper_1.XmlHelper.appendIf({
|
|
339
|
+
...xml_helper_1.XmlHelper.createContentTypeChild(this.targetArchive, {
|
|
340
|
+
Extension: `xlsx`,
|
|
341
|
+
ContentType: `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,
|
|
342
|
+
}),
|
|
343
|
+
tag: 'Default',
|
|
344
|
+
clause: (xml) => !xml_helper_1.XmlHelper.findByAttribute(xml, 'Default', 'Extension', 'xlsx'),
|
|
345
|
+
});
|
|
393
346
|
}
|
|
394
347
|
appendChartToContentType() {
|
|
395
348
|
const contentType = this.subtype === 'chart'
|
|
@@ -424,13 +377,11 @@ class Chart extends shape_1.Shape {
|
|
|
424
377
|
ContentType: `application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml`,
|
|
425
378
|
}));
|
|
426
379
|
}
|
|
427
|
-
static getAllOnSlide(archive, relsPath) {
|
|
428
|
-
return
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
]);
|
|
433
|
-
});
|
|
380
|
+
static async getAllOnSlide(archive, relsPath) {
|
|
381
|
+
return await xml_relationship_helper_1.XmlRelationshipHelper.getRelationshipTargetsByPrefix(archive, relsPath, [
|
|
382
|
+
'../charts/chart',
|
|
383
|
+
'../charts/chartEx',
|
|
384
|
+
]);
|
|
434
385
|
}
|
|
435
386
|
}
|
|
436
387
|
exports.Chart = Chart;
|