documents.js 1.41.0 → 1.43.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/dist/index.cjs +1166 -124
- package/dist/index.d.cts +200 -3
- package/dist/index.d.ts +200 -3
- package/dist/index.js +1112 -127
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,21 +1,30 @@
|
|
|
1
1
|
import { AttributeSchema, BinaryPartSchema, CommentSchema, CompactPackageSchema, CompactPartSchema, CompactXmlNodeSchema, DefinedNameSchema, PackageSchema, PartSchema, XmlCdataSchema, XmlCommentSchema, XmlDeclarationSchema, XmlElementSchema, XmlNodeSchema, XmlPartSchema, XmlPiSchema, XmlTextSchema, attr, attr as attr$1, base64ToBytes, base64ToBytes as base64ToBytes$1, buildXml, bytesToBase64, bytesToBase64 as bytesToBase64$1, childrenWithTag, compactCodec, compactPackageCodec, decodeCompactPackage, decodeEntities, decodePackage, decodePackage as decodePackage$1, elementsWithTag, elementsWithTag as elementsWithTag$1, encodeCompactPackage, encodePackage, encodePackage as encodePackage$1, fromCompact, isCompactXmlNode, isXmlNode, packageCodec, parsePackage, parseXml, readDocx, readPptx, resolveRelationships, resolveRelationships as resolveRelationships$1, rootElement, rootElement as rootElement$1, serializePackage, textContent, textContent as textContent$1, toCompact, unzipPackage, walk, xmlCodec, zipPackage } from "ooxml.js";
|
|
2
|
-
import { COLOR_BLACK, ContentBlockSchema, ContentImageBlockSchema, ContentPageBreakSchema, ContentParagraphSchema, ContentRunSchema, ContentSectionSchema, ContentSectionSchema as ContentSectionSchema$1, ContentShapeSchema, ContentSlideSchema, ContentSlideSchema as ContentSlideSchema$1, ContentTableCellSchema, ContentTableRowSchema, ContentTableSchema, DEFAULT_LAYOUT_FONT, LAYOUT_FORMAT_VERSION, LAYOUT_FORMAT_VERSION as LAYOUT_FORMAT_VERSION$1, LayoutDocumentSchema, LayoutMetadataSchema, PAGE_SIZE_A4, PAGE_SIZE_LETTER, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, colorToRgbHex, isContentBlock, rgbHexToColor } from "document-content-model";
|
|
2
|
+
import { COLOR_BLACK, ContentBlockSchema, ContentCellValueSchema, ContentImageBlockSchema, ContentPageBreakSchema, ContentParagraphSchema, ContentRunSchema, ContentSectionSchema, ContentSectionSchema as ContentSectionSchema$1, ContentShapeSchema, ContentSheetCellSchema, ContentSheetColumnSchema, ContentSheetPrintRangeSchema, ContentSheetPrintSettingsSchema, ContentSheetRepeatRangeSchema, ContentSheetRowSchema, ContentSheetSchema, ContentSheetSchema as ContentSheetSchema$1, ContentSlideSchema, ContentSlideSchema as ContentSlideSchema$1, ContentTableCellSchema, ContentTableRowSchema, ContentTableSchema, DEFAULT_LAYOUT_FONT, LAYOUT_FORMAT_VERSION, LAYOUT_FORMAT_VERSION as LAYOUT_FORMAT_VERSION$1, LayoutDocumentSchema, LayoutMetadataSchema, PAGE_SIZE_A4, PAGE_SIZE_LETTER, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, colorToRgbHex, isContentBlock, rgbHexToColor } from "document-content-model";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
import { ODF_MEDIA_TYPES, StyleRegistry, applyOdfTransform, base64ToBytes as base64ToBytes$2, bytesToBase64 as bytesToBase64$2, decodeOdfText, decodePackage as decodePackage$2, encodePackage as encodePackage$2, formatOdfLength, parseOdfLength, readOdp, readOdt, resolveOdfShapeGeometry, resolveStyle, setDocumentMediaType, syncManifest, syncManifest as syncManifest$1, xmlnsAttributes } from "odf.js";
|
|
4
|
+
import { ODF_MEDIA_TYPES, StyleRegistry, applyOdfTransform, base64ToBytes as base64ToBytes$2, bytesToBase64 as bytesToBase64$2, decodeOdfText, decodePackage as decodePackage$2, encodePackage as encodePackage$2, formatOdfLength, parseCellReference, parseOdfLength, readOdp, readOds, readOdt, resolveOdfShapeGeometry, resolveStyle, setDocumentMediaType, syncManifest, syncManifest as syncManifest$1, xmlnsAttributes } from "odf.js";
|
|
5
5
|
import { Unzlib, inflateSync, unzlibSync, zlibSync } from "fflate";
|
|
6
6
|
//#region src/model/content.ts
|
|
7
7
|
const CONTENT_FORMAT_VERSION = 1;
|
|
8
|
-
const ContentDocumentSchema = z.discriminatedUnion("kind", [
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
const ContentDocumentSchema = z.discriminatedUnion("kind", [
|
|
9
|
+
z.object({
|
|
10
|
+
kind: z.literal("wordprocessing"),
|
|
11
|
+
formatVersion: z.literal(1),
|
|
12
|
+
metadata: LayoutMetadataSchema,
|
|
13
|
+
sections: z.array(ContentSectionSchema$1)
|
|
14
|
+
}),
|
|
15
|
+
z.object({
|
|
16
|
+
kind: z.literal("presentation"),
|
|
17
|
+
formatVersion: z.literal(1),
|
|
18
|
+
metadata: LayoutMetadataSchema,
|
|
19
|
+
slides: z.array(ContentSlideSchema$1)
|
|
20
|
+
}),
|
|
21
|
+
z.object({
|
|
22
|
+
kind: z.literal("spreadsheet"),
|
|
23
|
+
formatVersion: z.literal(1),
|
|
24
|
+
metadata: LayoutMetadataSchema,
|
|
25
|
+
sheets: z.array(ContentSheetSchema$1)
|
|
26
|
+
})
|
|
27
|
+
]);
|
|
19
28
|
//#endregion
|
|
20
29
|
//#region src/model/geometry.ts
|
|
21
30
|
function flipY(box, containerHeightPt) {
|
|
@@ -520,7 +529,7 @@ function needsSpacePreserve(text) {
|
|
|
520
529
|
}
|
|
521
530
|
//#endregion
|
|
522
531
|
//#region src/edit/docx/run.ts
|
|
523
|
-
function directChild$
|
|
532
|
+
function directChild$9(parent, tag) {
|
|
524
533
|
for (const child of parent.children) if (child.type === "element" && child.tag === tag) return child;
|
|
525
534
|
}
|
|
526
535
|
function appendUElement(rPr, value) {
|
|
@@ -529,7 +538,7 @@ function appendUElement(rPr, value) {
|
|
|
529
538
|
return created;
|
|
530
539
|
}
|
|
531
540
|
function findOrCreateT(run) {
|
|
532
|
-
const existing = directChild$
|
|
541
|
+
const existing = directChild$9(run, "w:t");
|
|
533
542
|
if (existing !== void 0) return existing;
|
|
534
543
|
const created = el("w:t");
|
|
535
544
|
run.children.push(created);
|
|
@@ -549,7 +558,7 @@ var DocxRun = class {
|
|
|
549
558
|
}
|
|
550
559
|
rPr(create) {
|
|
551
560
|
const node = this.live();
|
|
552
|
-
return create ? ensureFirstChild(node, "w:rPr") : directChild$
|
|
561
|
+
return create ? ensureFirstChild(node, "w:rPr") : directChild$9(node, "w:rPr");
|
|
553
562
|
}
|
|
554
563
|
get text() {
|
|
555
564
|
return textContent$1(this.live());
|
|
@@ -573,14 +582,14 @@ var DocxRun = class {
|
|
|
573
582
|
}
|
|
574
583
|
get underline() {
|
|
575
584
|
const rPr = this.rPr(false);
|
|
576
|
-
const uElement = rPr === void 0 ? void 0 : directChild$
|
|
585
|
+
const uElement = rPr === void 0 ? void 0 : directChild$9(rPr, "w:u");
|
|
577
586
|
if (uElement === void 0) return false;
|
|
578
587
|
for (const a of uElement.attributes) if (a.name === "w:val") return a.value !== "none";
|
|
579
588
|
return true;
|
|
580
589
|
}
|
|
581
590
|
set underline(value) {
|
|
582
591
|
const rPr = this.rPr(true);
|
|
583
|
-
const existing = directChild$
|
|
592
|
+
const existing = directChild$9(rPr, "w:u");
|
|
584
593
|
if (existing === void 0) {
|
|
585
594
|
appendUElement(rPr, value);
|
|
586
595
|
return;
|
|
@@ -654,7 +663,7 @@ function buildRun$1(init = {}) {
|
|
|
654
663
|
}
|
|
655
664
|
//#endregion
|
|
656
665
|
//#region src/edit/docx/paragraph.ts
|
|
657
|
-
function directChild$
|
|
666
|
+
function directChild$8(parent, tag) {
|
|
658
667
|
for (const child of parent.children) if (child.type === "element" && child.tag === tag) return child;
|
|
659
668
|
}
|
|
660
669
|
var DocxParagraph = class {
|
|
@@ -673,7 +682,7 @@ var DocxParagraph = class {
|
|
|
673
682
|
}
|
|
674
683
|
pPr(create) {
|
|
675
684
|
const node = this.live();
|
|
676
|
-
return create ? ensureFirstChild(node, "w:pPr") : directChild$
|
|
685
|
+
return create ? ensureFirstChild(node, "w:pPr") : directChild$8(node, "w:pPr");
|
|
677
686
|
}
|
|
678
687
|
get text() {
|
|
679
688
|
return textContent$1(this.live());
|
|
@@ -710,7 +719,7 @@ var DocxParagraph = class {
|
|
|
710
719
|
set styleId(value) {
|
|
711
720
|
if (value === void 0) {
|
|
712
721
|
const pPr = this.pPr(false);
|
|
713
|
-
const existing = pPr === void 0 ? void 0 : directChild$
|
|
722
|
+
const existing = pPr === void 0 ? void 0 : directChild$8(pPr, "w:pStyle");
|
|
714
723
|
if (existing !== void 0 && pPr !== void 0) removeChild(pPr.children, existing);
|
|
715
724
|
return;
|
|
716
725
|
}
|
|
@@ -722,7 +731,7 @@ var DocxParagraph = class {
|
|
|
722
731
|
set alignment(value) {
|
|
723
732
|
if (value === void 0) {
|
|
724
733
|
const pPr = this.pPr(false);
|
|
725
|
-
const existing = pPr === void 0 ? void 0 : directChild$
|
|
734
|
+
const existing = pPr === void 0 ? void 0 : directChild$8(pPr, "w:jc");
|
|
726
735
|
if (existing !== void 0 && pPr !== void 0) removeChild(pPr.children, existing);
|
|
727
736
|
return;
|
|
728
737
|
}
|
|
@@ -730,12 +739,12 @@ var DocxParagraph = class {
|
|
|
730
739
|
}
|
|
731
740
|
get list() {
|
|
732
741
|
const pPr = this.pPr(false);
|
|
733
|
-
const numPr = pPr === void 0 ? void 0 : directChild$
|
|
742
|
+
const numPr = pPr === void 0 ? void 0 : directChild$8(pPr, "w:numPr");
|
|
734
743
|
if (numPr === void 0) return;
|
|
735
|
-
const numIdElement = directChild$
|
|
744
|
+
const numIdElement = directChild$8(numPr, "w:numId");
|
|
736
745
|
const numId = numIdElement === void 0 ? void 0 : attr$1(numIdElement, "w:val");
|
|
737
746
|
if (numId === void 0) return;
|
|
738
|
-
const ilvlElement = directChild$
|
|
747
|
+
const ilvlElement = directChild$8(numPr, "w:ilvl");
|
|
739
748
|
const ilvl = ilvlElement === void 0 ? void 0 : attr$1(ilvlElement, "w:val");
|
|
740
749
|
return {
|
|
741
750
|
numId,
|
|
@@ -745,7 +754,7 @@ var DocxParagraph = class {
|
|
|
745
754
|
set list(value) {
|
|
746
755
|
const pPr = this.pPr(true);
|
|
747
756
|
if (value === void 0) {
|
|
748
|
-
const existing = directChild$
|
|
757
|
+
const existing = directChild$8(pPr, "w:numPr");
|
|
749
758
|
if (existing !== void 0) removeChild(pPr.children, existing);
|
|
750
759
|
return;
|
|
751
760
|
}
|
|
@@ -779,7 +788,7 @@ function buildParagraph$1(init = {}) {
|
|
|
779
788
|
const CONTENT_TYPES_NS$1 = "http://schemas.openxmlformats.org/package/2006/content-types";
|
|
780
789
|
const RELS_NS$1 = "http://schemas.openxmlformats.org/package/2006/relationships";
|
|
781
790
|
const WORDML_NS = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
782
|
-
function declaration$
|
|
791
|
+
function declaration$4() {
|
|
783
792
|
return {
|
|
784
793
|
type: "declaration",
|
|
785
794
|
attributes: [
|
|
@@ -848,23 +857,23 @@ function createEmptyDocxPackage() {
|
|
|
848
857
|
return { parts: {
|
|
849
858
|
"[Content_Types].xml": {
|
|
850
859
|
kind: "xml",
|
|
851
|
-
nodes: [declaration$
|
|
860
|
+
nodes: [declaration$4(), contentTypes]
|
|
852
861
|
},
|
|
853
862
|
"_rels/.rels": {
|
|
854
863
|
kind: "xml",
|
|
855
|
-
nodes: [declaration$
|
|
864
|
+
nodes: [declaration$4(), rootRels]
|
|
856
865
|
},
|
|
857
866
|
"word/document.xml": {
|
|
858
867
|
kind: "xml",
|
|
859
|
-
nodes: [declaration$
|
|
868
|
+
nodes: [declaration$4(), document]
|
|
860
869
|
},
|
|
861
870
|
"word/_rels/document.xml.rels": {
|
|
862
871
|
kind: "xml",
|
|
863
|
-
nodes: [declaration$
|
|
872
|
+
nodes: [declaration$4(), documentRels]
|
|
864
873
|
},
|
|
865
874
|
"word/styles.xml": {
|
|
866
875
|
kind: "xml",
|
|
867
|
-
nodes: [declaration$
|
|
876
|
+
nodes: [declaration$4(), styles]
|
|
868
877
|
}
|
|
869
878
|
} };
|
|
870
879
|
}
|
|
@@ -1155,7 +1164,7 @@ const SLIDE_LAYOUT_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/
|
|
|
1155
1164
|
const THEME_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme";
|
|
1156
1165
|
const NOTES_MASTER_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster";
|
|
1157
1166
|
const MIN_MASTER_OR_LAYOUT_ID = 2147483648;
|
|
1158
|
-
function declaration$
|
|
1167
|
+
function declaration$3() {
|
|
1159
1168
|
return {
|
|
1160
1169
|
type: "declaration",
|
|
1161
1170
|
attributes: [
|
|
@@ -1305,7 +1314,7 @@ function ensureNotesMaster(pkg) {
|
|
|
1305
1314
|
});
|
|
1306
1315
|
pkg.parts[NOTES_MASTER_PART_PATH] = {
|
|
1307
1316
|
kind: "xml",
|
|
1308
|
-
nodes: [declaration$
|
|
1317
|
+
nodes: [declaration$3(), buildNotesMaster()]
|
|
1309
1318
|
};
|
|
1310
1319
|
ensureContentTypeOverride(pkg, NOTES_MASTER_PART_PATH, NOTES_MASTER_CONTENT_TYPE);
|
|
1311
1320
|
const presentationToNotesMasterTarget = buildRelativeTarget(PRESENTATION_PART_PATH$1, NOTES_MASTER_PART_PATH);
|
|
@@ -1344,15 +1353,15 @@ function createEmptyPptxPackage() {
|
|
|
1344
1353
|
const pkg = { parts: {
|
|
1345
1354
|
"[Content_Types].xml": {
|
|
1346
1355
|
kind: "xml",
|
|
1347
|
-
nodes: [declaration$
|
|
1356
|
+
nodes: [declaration$3(), contentTypes]
|
|
1348
1357
|
},
|
|
1349
1358
|
"_rels/.rels": {
|
|
1350
1359
|
kind: "xml",
|
|
1351
|
-
nodes: [declaration$
|
|
1360
|
+
nodes: [declaration$3(), rootRels]
|
|
1352
1361
|
},
|
|
1353
1362
|
[PRESENTATION_PART_PATH$1]: {
|
|
1354
1363
|
kind: "xml",
|
|
1355
|
-
nodes: [declaration$
|
|
1364
|
+
nodes: [declaration$3(), el("p:presentation", {
|
|
1356
1365
|
"xmlns:p": PML_NS,
|
|
1357
1366
|
"xmlns:r": R_NS
|
|
1358
1367
|
})]
|
|
@@ -1365,7 +1374,7 @@ function createEmptyPptxPackage() {
|
|
|
1365
1374
|
});
|
|
1366
1375
|
pkg.parts[SLIDE_LAYOUT_PART_PATH] = {
|
|
1367
1376
|
kind: "xml",
|
|
1368
|
-
nodes: [declaration$
|
|
1377
|
+
nodes: [declaration$3(), buildSlideLayout()]
|
|
1369
1378
|
};
|
|
1370
1379
|
ensureContentTypeOverride(pkg, SLIDE_LAYOUT_PART_PATH, SLIDE_LAYOUT_CONTENT_TYPE);
|
|
1371
1380
|
const masterToLayoutTarget = buildRelativeTarget(SLIDE_MASTER_PART_PATH, SLIDE_LAYOUT_PART_PATH);
|
|
@@ -1380,12 +1389,12 @@ function createEmptyPptxPackage() {
|
|
|
1380
1389
|
});
|
|
1381
1390
|
pkg.parts[SLIDE_MASTER_PART_PATH] = {
|
|
1382
1391
|
kind: "xml",
|
|
1383
|
-
nodes: [declaration$
|
|
1392
|
+
nodes: [declaration$3(), buildSlideMaster(masterToLayoutRelId)]
|
|
1384
1393
|
};
|
|
1385
1394
|
ensureContentTypeOverride(pkg, SLIDE_MASTER_PART_PATH, SLIDE_MASTER_CONTENT_TYPE);
|
|
1386
1395
|
pkg.parts[THEME_PART_PATH] = {
|
|
1387
1396
|
kind: "xml",
|
|
1388
|
-
nodes: [declaration$
|
|
1397
|
+
nodes: [declaration$3(), buildTheme()]
|
|
1389
1398
|
};
|
|
1390
1399
|
ensureContentTypeOverride(pkg, THEME_PART_PATH, THEME_CONTENT_TYPE);
|
|
1391
1400
|
const presentationToMasterTarget = buildRelativeTarget(PRESENTATION_PART_PATH$1, SLIDE_MASTER_PART_PATH);
|
|
@@ -1410,7 +1419,7 @@ function createEmptyPptxPackage() {
|
|
|
1410
1419
|
}
|
|
1411
1420
|
//#endregion
|
|
1412
1421
|
//#region src/edit/pptx/shape.ts
|
|
1413
|
-
function directChild$
|
|
1422
|
+
function directChild$7(parent, tag) {
|
|
1414
1423
|
for (const child of parent.children) if (child.type === "element" && child.tag === tag) return child;
|
|
1415
1424
|
}
|
|
1416
1425
|
function parseEmuAttr(element, name) {
|
|
@@ -1431,7 +1440,7 @@ var PptxShape = class {
|
|
|
1431
1440
|
}
|
|
1432
1441
|
spPrElement(create) {
|
|
1433
1442
|
const node = this.live();
|
|
1434
|
-
const existing = directChild$
|
|
1443
|
+
const existing = directChild$7(node, "p:spPr");
|
|
1435
1444
|
if (existing !== void 0 || !create) return existing;
|
|
1436
1445
|
const created = el("p:spPr");
|
|
1437
1446
|
node.children.push(created);
|
|
@@ -1439,10 +1448,10 @@ var PptxShape = class {
|
|
|
1439
1448
|
}
|
|
1440
1449
|
get frame() {
|
|
1441
1450
|
const spPr = this.spPrElement(false);
|
|
1442
|
-
const xfrm = spPr === void 0 ? void 0 : directChild$
|
|
1451
|
+
const xfrm = spPr === void 0 ? void 0 : directChild$7(spPr, "a:xfrm");
|
|
1443
1452
|
if (xfrm === void 0) return;
|
|
1444
|
-
const off = directChild$
|
|
1445
|
-
const ext = directChild$
|
|
1453
|
+
const off = directChild$7(xfrm, "a:off");
|
|
1454
|
+
const ext = directChild$7(xfrm, "a:ext");
|
|
1446
1455
|
if (off === void 0 || ext === void 0) return;
|
|
1447
1456
|
const x = parseEmuAttr(off, "x");
|
|
1448
1457
|
const y = parseEmuAttr(off, "y");
|
|
@@ -1458,7 +1467,7 @@ var PptxShape = class {
|
|
|
1458
1467
|
}
|
|
1459
1468
|
set frame(value) {
|
|
1460
1469
|
const spPr = this.spPrElement(true);
|
|
1461
|
-
let xfrm = directChild$
|
|
1470
|
+
let xfrm = directChild$7(spPr, "a:xfrm");
|
|
1462
1471
|
if (xfrm === void 0) {
|
|
1463
1472
|
xfrm = el("a:xfrm");
|
|
1464
1473
|
spPr.children.unshift(xfrm);
|
|
@@ -1472,12 +1481,12 @@ var PptxShape = class {
|
|
|
1472
1481
|
})];
|
|
1473
1482
|
}
|
|
1474
1483
|
get text() {
|
|
1475
|
-
const txBody = directChild$
|
|
1484
|
+
const txBody = directChild$7(this.live(), "p:txBody");
|
|
1476
1485
|
return txBody === void 0 ? "" : textContent$1(txBody);
|
|
1477
1486
|
}
|
|
1478
1487
|
set text(value) {
|
|
1479
1488
|
const node = this.live();
|
|
1480
|
-
let txBody = directChild$
|
|
1489
|
+
let txBody = directChild$7(node, "p:txBody");
|
|
1481
1490
|
if (txBody === void 0) {
|
|
1482
1491
|
txBody = el("p:txBody", {}, [el("a:bodyPr"), el("a:lstStyle")]);
|
|
1483
1492
|
node.children.push(txBody);
|
|
@@ -1488,7 +1497,7 @@ var PptxShape = class {
|
|
|
1488
1497
|
}
|
|
1489
1498
|
setParagraphs(paragraphs) {
|
|
1490
1499
|
const node = this.live();
|
|
1491
|
-
let txBody = directChild$
|
|
1500
|
+
let txBody = directChild$7(node, "p:txBody");
|
|
1492
1501
|
if (txBody === void 0) {
|
|
1493
1502
|
txBody = el("p:txBody", {}, [el("a:bodyPr"), el("a:lstStyle")]);
|
|
1494
1503
|
node.children.push(txBody);
|
|
@@ -1599,12 +1608,12 @@ function insertPictureShapeMedia(context, slideRoot, frame, image) {
|
|
|
1599
1608
|
}
|
|
1600
1609
|
//#endregion
|
|
1601
1610
|
//#region src/edit/pptx/slide.ts
|
|
1602
|
-
function directChild$
|
|
1611
|
+
function directChild$6(parent, tag) {
|
|
1603
1612
|
for (const child of parent.children) if (child.type === "element" && child.tag === tag) return child;
|
|
1604
1613
|
}
|
|
1605
1614
|
function findSpTree(slideRoot) {
|
|
1606
|
-
const cSld = directChild$
|
|
1607
|
-
const spTree = cSld === void 0 ? void 0 : directChild$
|
|
1615
|
+
const cSld = directChild$6(slideRoot, "p:cSld");
|
|
1616
|
+
const spTree = cSld === void 0 ? void 0 : directChild$6(cSld, "p:spTree");
|
|
1608
1617
|
if (spTree === void 0) throw new Error("slide has no p:cSld/p:spTree element");
|
|
1609
1618
|
return spTree;
|
|
1610
1619
|
}
|
|
@@ -1736,7 +1745,7 @@ const PRESENTATION_PART_PATH = "ppt/presentation.xml";
|
|
|
1736
1745
|
const MEDIA_DIR = "ppt/media";
|
|
1737
1746
|
const SLIDE_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.slide+xml";
|
|
1738
1747
|
const SLIDE_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide";
|
|
1739
|
-
function directChild$
|
|
1748
|
+
function directChild$5(parent, tag) {
|
|
1740
1749
|
for (const child of parent.children) if (child.type === "element" && child.tag === tag) return child;
|
|
1741
1750
|
}
|
|
1742
1751
|
function attrValue(element, name) {
|
|
@@ -1748,12 +1757,12 @@ function findPresentationRoot(pkg) {
|
|
|
1748
1757
|
return root;
|
|
1749
1758
|
}
|
|
1750
1759
|
function findSldIdLst(presentationRoot) {
|
|
1751
|
-
const sldIdLst = directChild$
|
|
1760
|
+
const sldIdLst = directChild$5(presentationRoot, "p:sldIdLst");
|
|
1752
1761
|
if (sldIdLst === void 0) throw new Error(`${PRESENTATION_PART_PATH} has no p:sldIdLst element`);
|
|
1753
1762
|
return sldIdLst;
|
|
1754
1763
|
}
|
|
1755
1764
|
function findSldSz(presentationRoot) {
|
|
1756
|
-
const sldSz = directChild$
|
|
1765
|
+
const sldSz = directChild$5(presentationRoot, "p:sldSz");
|
|
1757
1766
|
if (sldSz === void 0) throw new Error(`${PRESENTATION_PART_PATH} has no p:sldSz element`);
|
|
1758
1767
|
return sldSz;
|
|
1759
1768
|
}
|
|
@@ -1952,12 +1961,12 @@ function appendShape$1(slide, shape) {
|
|
|
1952
1961
|
}
|
|
1953
1962
|
//#endregion
|
|
1954
1963
|
//#region src/edit/odt/automatic-styles.ts
|
|
1955
|
-
const CONTENT_PART_PATH$
|
|
1964
|
+
const CONTENT_PART_PATH$3 = "content.xml";
|
|
1956
1965
|
function ensureAutomaticStyles(pkg) {
|
|
1957
|
-
const part = pkg.parts[CONTENT_PART_PATH$
|
|
1958
|
-
if (part?.kind !== "xml") throw new Error(`ensureAutomaticStyles: package has no ${CONTENT_PART_PATH$
|
|
1966
|
+
const part = pkg.parts[CONTENT_PART_PATH$3];
|
|
1967
|
+
if (part?.kind !== "xml") throw new Error(`ensureAutomaticStyles: package has no ${CONTENT_PART_PATH$3} part`);
|
|
1959
1968
|
const root = part.nodes.find((n) => n.type === "element");
|
|
1960
|
-
if (root === void 0) throw new Error(`ensureAutomaticStyles: ${CONTENT_PART_PATH$
|
|
1969
|
+
if (root === void 0) throw new Error(`ensureAutomaticStyles: ${CONTENT_PART_PATH$3} has no root element`);
|
|
1961
1970
|
for (const child of root.children) if (child.type === "element" && child.tag === "office:automatic-styles") return child;
|
|
1962
1971
|
const created = el("office:automatic-styles");
|
|
1963
1972
|
const insertBeforeTags = /* @__PURE__ */ new Set([
|
|
@@ -2051,7 +2060,7 @@ function applyStyleChange(pkg, element, family, change) {
|
|
|
2051
2060
|
...readCurrentStyleProperties(pkg, element, family),
|
|
2052
2061
|
...change
|
|
2053
2062
|
};
|
|
2054
|
-
const name = StyleRegistry.forPart(pkg, CONTENT_PART_PATH$
|
|
2063
|
+
const name = StyleRegistry.forPart(pkg, CONTENT_PART_PATH$3).intern({
|
|
2055
2064
|
family,
|
|
2056
2065
|
properties: merged
|
|
2057
2066
|
});
|
|
@@ -2282,7 +2291,7 @@ function buildList(pkg) {
|
|
|
2282
2291
|
}
|
|
2283
2292
|
//#endregion
|
|
2284
2293
|
//#region src/edit/odt/scaffold.ts
|
|
2285
|
-
const CONTENT_NS_PREFIXES$
|
|
2294
|
+
const CONTENT_NS_PREFIXES$2 = [
|
|
2286
2295
|
"office",
|
|
2287
2296
|
"style",
|
|
2288
2297
|
"text",
|
|
@@ -2292,7 +2301,7 @@ const CONTENT_NS_PREFIXES$1 = [
|
|
|
2292
2301
|
"svg",
|
|
2293
2302
|
"xlink"
|
|
2294
2303
|
];
|
|
2295
|
-
const STYLES_NS_PREFIXES$
|
|
2304
|
+
const STYLES_NS_PREFIXES$2 = [
|
|
2296
2305
|
"office",
|
|
2297
2306
|
"style",
|
|
2298
2307
|
"text",
|
|
@@ -2302,16 +2311,16 @@ const STYLES_NS_PREFIXES$1 = [
|
|
|
2302
2311
|
"svg",
|
|
2303
2312
|
"xlink"
|
|
2304
2313
|
];
|
|
2305
|
-
const META_NS_PREFIXES$
|
|
2314
|
+
const META_NS_PREFIXES$2 = [
|
|
2306
2315
|
"office",
|
|
2307
2316
|
"meta",
|
|
2308
2317
|
"dc"
|
|
2309
2318
|
];
|
|
2310
|
-
const ODF_VERSION$
|
|
2311
|
-
const PAGE_LAYOUT_NAME$
|
|
2312
|
-
const MASTER_PAGE_NAME$
|
|
2319
|
+
const ODF_VERSION$2 = "1.3";
|
|
2320
|
+
const PAGE_LAYOUT_NAME$2 = "PM1";
|
|
2321
|
+
const MASTER_PAGE_NAME$2 = "Standard";
|
|
2313
2322
|
const DEFAULT_MARGIN_PT = 72;
|
|
2314
|
-
function declaration$
|
|
2323
|
+
function declaration$2() {
|
|
2315
2324
|
return {
|
|
2316
2325
|
type: "declaration",
|
|
2317
2326
|
attributes: [
|
|
@@ -2330,8 +2339,8 @@ function declaration$1() {
|
|
|
2330
2339
|
]
|
|
2331
2340
|
};
|
|
2332
2341
|
}
|
|
2333
|
-
function buildPageLayout$
|
|
2334
|
-
return el("style:page-layout", { "style:name": PAGE_LAYOUT_NAME$
|
|
2342
|
+
function buildPageLayout$2() {
|
|
2343
|
+
return el("style:page-layout", { "style:name": PAGE_LAYOUT_NAME$2 }, [el("style:page-layout-properties", {
|
|
2335
2344
|
"fo:page-width": `${PAGE_SIZE_LETTER.widthPt}pt`,
|
|
2336
2345
|
"fo:page-height": `${PAGE_SIZE_LETTER.heightPt}pt`,
|
|
2337
2346
|
"fo:margin-top": `${DEFAULT_MARGIN_PT}pt`,
|
|
@@ -2340,44 +2349,44 @@ function buildPageLayout$1() {
|
|
|
2340
2349
|
"fo:margin-left": `${DEFAULT_MARGIN_PT}pt`
|
|
2341
2350
|
})]);
|
|
2342
2351
|
}
|
|
2343
|
-
function buildStylesXml$
|
|
2352
|
+
function buildStylesXml$2() {
|
|
2344
2353
|
return el("office:document-styles", {
|
|
2345
|
-
...xmlnsAttributes([...STYLES_NS_PREFIXES$
|
|
2346
|
-
"office:version": ODF_VERSION$
|
|
2354
|
+
...xmlnsAttributes([...STYLES_NS_PREFIXES$2]),
|
|
2355
|
+
"office:version": ODF_VERSION$2
|
|
2347
2356
|
}, [
|
|
2348
2357
|
el("office:styles"),
|
|
2349
|
-
el("office:automatic-styles", {}, [buildPageLayout$
|
|
2358
|
+
el("office:automatic-styles", {}, [buildPageLayout$2()]),
|
|
2350
2359
|
el("office:master-styles", {}, [el("style:master-page", {
|
|
2351
|
-
"style:name": MASTER_PAGE_NAME$
|
|
2352
|
-
"style:page-layout-name": PAGE_LAYOUT_NAME$
|
|
2360
|
+
"style:name": MASTER_PAGE_NAME$2,
|
|
2361
|
+
"style:page-layout-name": PAGE_LAYOUT_NAME$2
|
|
2353
2362
|
})])
|
|
2354
2363
|
]);
|
|
2355
2364
|
}
|
|
2356
|
-
function buildContentXml$
|
|
2365
|
+
function buildContentXml$2() {
|
|
2357
2366
|
return el("office:document-content", {
|
|
2358
|
-
...xmlnsAttributes([...CONTENT_NS_PREFIXES$
|
|
2359
|
-
"office:version": ODF_VERSION$
|
|
2367
|
+
...xmlnsAttributes([...CONTENT_NS_PREFIXES$2]),
|
|
2368
|
+
"office:version": ODF_VERSION$2
|
|
2360
2369
|
}, [el("office:automatic-styles"), el("office:body", {}, [el("office:text")])]);
|
|
2361
2370
|
}
|
|
2362
|
-
function buildMetaXml$
|
|
2371
|
+
function buildMetaXml$2() {
|
|
2363
2372
|
return el("office:document-meta", {
|
|
2364
|
-
...xmlnsAttributes([...META_NS_PREFIXES$
|
|
2365
|
-
"office:version": ODF_VERSION$
|
|
2373
|
+
...xmlnsAttributes([...META_NS_PREFIXES$2]),
|
|
2374
|
+
"office:version": ODF_VERSION$2
|
|
2366
2375
|
}, [el("office:meta")]);
|
|
2367
2376
|
}
|
|
2368
2377
|
function createEmptyOdtPackage() {
|
|
2369
2378
|
const pkg = { parts: {
|
|
2370
2379
|
"content.xml": {
|
|
2371
2380
|
kind: "xml",
|
|
2372
|
-
nodes: [declaration$
|
|
2381
|
+
nodes: [declaration$2(), buildContentXml$2()]
|
|
2373
2382
|
},
|
|
2374
2383
|
"styles.xml": {
|
|
2375
2384
|
kind: "xml",
|
|
2376
|
-
nodes: [declaration$
|
|
2385
|
+
nodes: [declaration$2(), buildStylesXml$2()]
|
|
2377
2386
|
},
|
|
2378
2387
|
"meta.xml": {
|
|
2379
2388
|
kind: "xml",
|
|
2380
|
-
nodes: [declaration$
|
|
2389
|
+
nodes: [declaration$2(), buildMetaXml$2()]
|
|
2381
2390
|
}
|
|
2382
2391
|
} };
|
|
2383
2392
|
setDocumentMediaType(pkg, ODF_MEDIA_TYPES.odt);
|
|
@@ -2498,20 +2507,20 @@ function buildTable(pkg, init) {
|
|
|
2498
2507
|
}
|
|
2499
2508
|
//#endregion
|
|
2500
2509
|
//#region src/edit/odt/editor.ts
|
|
2501
|
-
const CONTENT_PART_PATH$
|
|
2510
|
+
const CONTENT_PART_PATH$2 = "content.xml";
|
|
2502
2511
|
function findContentRoot(pkg) {
|
|
2503
|
-
const part = pkg.parts[CONTENT_PART_PATH$
|
|
2512
|
+
const part = pkg.parts[CONTENT_PART_PATH$2];
|
|
2504
2513
|
const root = part?.kind === "xml" ? part.nodes.find((n) => n.type === "element") : void 0;
|
|
2505
|
-
if (root === void 0) throw new Error(`package has no root element at ${CONTENT_PART_PATH$
|
|
2514
|
+
if (root === void 0) throw new Error(`package has no root element at ${CONTENT_PART_PATH$2}`);
|
|
2506
2515
|
return root;
|
|
2507
2516
|
}
|
|
2508
|
-
function directChild$
|
|
2517
|
+
function directChild$4(parent, tag) {
|
|
2509
2518
|
for (const child of parent.children) if (child.type === "element" && child.tag === tag) return child;
|
|
2510
2519
|
}
|
|
2511
2520
|
function findOfficeText(contentRoot) {
|
|
2512
|
-
const body = directChild$
|
|
2513
|
-
const text = body === void 0 ? void 0 : directChild$
|
|
2514
|
-
if (text === void 0) throw new Error(`${CONTENT_PART_PATH$
|
|
2521
|
+
const body = directChild$4(contentRoot, "office:body");
|
|
2522
|
+
const text = body === void 0 ? void 0 : directChild$4(body, "office:text");
|
|
2523
|
+
if (text === void 0) throw new Error(`${CONTENT_PART_PATH$2} has no office:body/office:text element`);
|
|
2515
2524
|
return text;
|
|
2516
2525
|
}
|
|
2517
2526
|
var OdtBodyImpl = class {
|
|
@@ -2643,7 +2652,7 @@ function appendBlock(body, block) {
|
|
|
2643
2652
|
}
|
|
2644
2653
|
//#endregion
|
|
2645
2654
|
//#region src/edit/odp/scaffold.ts
|
|
2646
|
-
const CONTENT_NS_PREFIXES = [
|
|
2655
|
+
const CONTENT_NS_PREFIXES$1 = [
|
|
2647
2656
|
"office",
|
|
2648
2657
|
"style",
|
|
2649
2658
|
"text",
|
|
@@ -2654,7 +2663,7 @@ const CONTENT_NS_PREFIXES = [
|
|
|
2654
2663
|
"svg",
|
|
2655
2664
|
"xlink"
|
|
2656
2665
|
];
|
|
2657
|
-
const STYLES_NS_PREFIXES = [
|
|
2666
|
+
const STYLES_NS_PREFIXES$1 = [
|
|
2658
2667
|
"office",
|
|
2659
2668
|
"style",
|
|
2660
2669
|
"text",
|
|
@@ -2665,14 +2674,14 @@ const STYLES_NS_PREFIXES = [
|
|
|
2665
2674
|
"svg",
|
|
2666
2675
|
"xlink"
|
|
2667
2676
|
];
|
|
2668
|
-
const META_NS_PREFIXES = [
|
|
2677
|
+
const META_NS_PREFIXES$1 = [
|
|
2669
2678
|
"office",
|
|
2670
2679
|
"meta",
|
|
2671
2680
|
"dc"
|
|
2672
2681
|
];
|
|
2673
|
-
const ODF_VERSION = "1.3";
|
|
2674
|
-
const MASTER_PAGE_NAME = "Standard";
|
|
2675
|
-
function declaration() {
|
|
2682
|
+
const ODF_VERSION$1 = "1.3";
|
|
2683
|
+
const MASTER_PAGE_NAME$1 = "Standard";
|
|
2684
|
+
function declaration$1() {
|
|
2676
2685
|
return {
|
|
2677
2686
|
type: "declaration",
|
|
2678
2687
|
attributes: [
|
|
@@ -2691,50 +2700,50 @@ function declaration() {
|
|
|
2691
2700
|
]
|
|
2692
2701
|
};
|
|
2693
2702
|
}
|
|
2694
|
-
function buildPageLayout() {
|
|
2703
|
+
function buildPageLayout$1() {
|
|
2695
2704
|
return el("style:page-layout", { "style:name": "PM1" }, [el("style:page-layout-properties", {
|
|
2696
2705
|
"fo:page-width": `${SLIDE_SIZE_WIDESCREEN.widthPt}pt`,
|
|
2697
2706
|
"fo:page-height": `${SLIDE_SIZE_WIDESCREEN.heightPt}pt`
|
|
2698
2707
|
})]);
|
|
2699
2708
|
}
|
|
2700
|
-
function buildStylesXml() {
|
|
2709
|
+
function buildStylesXml$1() {
|
|
2701
2710
|
return el("office:document-styles", {
|
|
2702
|
-
...xmlnsAttributes([...STYLES_NS_PREFIXES]),
|
|
2703
|
-
"office:version": ODF_VERSION
|
|
2711
|
+
...xmlnsAttributes([...STYLES_NS_PREFIXES$1]),
|
|
2712
|
+
"office:version": ODF_VERSION$1
|
|
2704
2713
|
}, [
|
|
2705
2714
|
el("office:styles"),
|
|
2706
|
-
el("office:automatic-styles", {}, [buildPageLayout()]),
|
|
2715
|
+
el("office:automatic-styles", {}, [buildPageLayout$1()]),
|
|
2707
2716
|
el("office:master-styles", {}, [el("style:master-page", {
|
|
2708
|
-
"style:name": MASTER_PAGE_NAME,
|
|
2717
|
+
"style:name": MASTER_PAGE_NAME$1,
|
|
2709
2718
|
"style:page-layout-name": "PM1"
|
|
2710
2719
|
})])
|
|
2711
2720
|
]);
|
|
2712
2721
|
}
|
|
2713
|
-
function buildContentXml() {
|
|
2722
|
+
function buildContentXml$1() {
|
|
2714
2723
|
return el("office:document-content", {
|
|
2715
|
-
...xmlnsAttributes([...CONTENT_NS_PREFIXES]),
|
|
2716
|
-
"office:version": ODF_VERSION
|
|
2724
|
+
...xmlnsAttributes([...CONTENT_NS_PREFIXES$1]),
|
|
2725
|
+
"office:version": ODF_VERSION$1
|
|
2717
2726
|
}, [el("office:automatic-styles"), el("office:body", {}, [el("office:presentation")])]);
|
|
2718
2727
|
}
|
|
2719
|
-
function buildMetaXml() {
|
|
2728
|
+
function buildMetaXml$1() {
|
|
2720
2729
|
return el("office:document-meta", {
|
|
2721
|
-
...xmlnsAttributes([...META_NS_PREFIXES]),
|
|
2722
|
-
"office:version": ODF_VERSION
|
|
2730
|
+
...xmlnsAttributes([...META_NS_PREFIXES$1]),
|
|
2731
|
+
"office:version": ODF_VERSION$1
|
|
2723
2732
|
}, [el("office:meta")]);
|
|
2724
2733
|
}
|
|
2725
2734
|
function createEmptyOdpPackage() {
|
|
2726
2735
|
const pkg = { parts: {
|
|
2727
2736
|
"content.xml": {
|
|
2728
2737
|
kind: "xml",
|
|
2729
|
-
nodes: [declaration(), buildContentXml()]
|
|
2738
|
+
nodes: [declaration$1(), buildContentXml$1()]
|
|
2730
2739
|
},
|
|
2731
2740
|
"styles.xml": {
|
|
2732
2741
|
kind: "xml",
|
|
2733
|
-
nodes: [declaration(), buildStylesXml()]
|
|
2742
|
+
nodes: [declaration$1(), buildStylesXml$1()]
|
|
2734
2743
|
},
|
|
2735
2744
|
"meta.xml": {
|
|
2736
2745
|
kind: "xml",
|
|
2737
|
-
nodes: [declaration(), buildMetaXml()]
|
|
2746
|
+
nodes: [declaration$1(), buildMetaXml$1()]
|
|
2738
2747
|
}
|
|
2739
2748
|
} };
|
|
2740
2749
|
setDocumentMediaType(pkg, ODF_MEDIA_TYPES.odp);
|
|
@@ -2774,7 +2783,7 @@ function addImageMedia(pkg, imageBytes, format) {
|
|
|
2774
2783
|
}
|
|
2775
2784
|
//#endregion
|
|
2776
2785
|
//#region src/edit/odp/shape.ts
|
|
2777
|
-
function directChild$
|
|
2786
|
+
function directChild$3(parent, tag) {
|
|
2778
2787
|
for (const child of parent.children) if (child.type === "element" && child.tag === tag) return child;
|
|
2779
2788
|
}
|
|
2780
2789
|
function buildTransformAttr(frame, rotationDeg) {
|
|
@@ -2842,7 +2851,7 @@ var OdpShape = class {
|
|
|
2842
2851
|
}
|
|
2843
2852
|
textBox(create) {
|
|
2844
2853
|
const node = this.live();
|
|
2845
|
-
const existing = directChild$
|
|
2854
|
+
const existing = directChild$3(node, "draw:text-box");
|
|
2846
2855
|
if (existing !== void 0 || !create) return existing;
|
|
2847
2856
|
const created = el("draw:text-box");
|
|
2848
2857
|
node.children.push(created);
|
|
@@ -2903,7 +2912,7 @@ function insertImageFrameMedia(context, frame, image) {
|
|
|
2903
2912
|
}
|
|
2904
2913
|
//#endregion
|
|
2905
2914
|
//#region src/edit/odp/slide.ts
|
|
2906
|
-
function directChild$
|
|
2915
|
+
function directChild$2(parent, tag) {
|
|
2907
2916
|
for (const child of parent.children) if (child.type === "element" && child.tag === tag) return child;
|
|
2908
2917
|
}
|
|
2909
2918
|
const NOTES_FRAME_X_PT = 20;
|
|
@@ -2952,13 +2961,13 @@ var OdpSlide = class {
|
|
|
2952
2961
|
return new OdpShape(node.children, frameElement, this.context.pkg);
|
|
2953
2962
|
}
|
|
2954
2963
|
get notes() {
|
|
2955
|
-
const notesElement = directChild$
|
|
2964
|
+
const notesElement = directChild$2(this.live(), "presentation:notes");
|
|
2956
2965
|
if (notesElement === void 0) return "";
|
|
2957
2966
|
return elementsWithTag$1(notesElement.children, "text:p").map((p) => decodeOdfText$1(p.children)).join("\n");
|
|
2958
2967
|
}
|
|
2959
2968
|
set notes(value) {
|
|
2960
2969
|
const node = this.live();
|
|
2961
|
-
const existing = directChild$
|
|
2970
|
+
const existing = directChild$2(node, "presentation:notes");
|
|
2962
2971
|
const notesElement = buildNotesElement(this.context.pkg, value);
|
|
2963
2972
|
if (existing === void 0) node.children.push(notesElement);
|
|
2964
2973
|
else existing.children = notesElement.children;
|
|
@@ -2970,26 +2979,26 @@ var OdpSlide = class {
|
|
|
2970
2979
|
};
|
|
2971
2980
|
//#endregion
|
|
2972
2981
|
//#region src/edit/odp/editor.ts
|
|
2973
|
-
const CONTENT_PART_PATH = "content.xml";
|
|
2982
|
+
const CONTENT_PART_PATH$1 = "content.xml";
|
|
2974
2983
|
const STYLES_PART_PATH = "styles.xml";
|
|
2975
|
-
function directChild(parent, tag) {
|
|
2984
|
+
function directChild$1(parent, tag) {
|
|
2976
2985
|
for (const child of parent.children) if (child.type === "element" && child.tag === tag) return child;
|
|
2977
2986
|
}
|
|
2978
|
-
function findRoot(pkg, partPath) {
|
|
2987
|
+
function findRoot$1(pkg, partPath) {
|
|
2979
2988
|
const part = pkg.parts[partPath];
|
|
2980
2989
|
const root = part?.kind === "xml" ? part.nodes.find((n) => n.type === "element") : void 0;
|
|
2981
2990
|
if (root === void 0) throw new Error(`package has no root element at ${partPath}`);
|
|
2982
2991
|
return root;
|
|
2983
2992
|
}
|
|
2984
2993
|
function findOfficePresentation(pkg) {
|
|
2985
|
-
const body = directChild(findRoot(pkg, CONTENT_PART_PATH), "office:body");
|
|
2986
|
-
const presentation = body === void 0 ? void 0 : directChild(body, "office:presentation");
|
|
2987
|
-
if (presentation === void 0) throw new Error(`${CONTENT_PART_PATH} has no office:body/office:presentation element`);
|
|
2994
|
+
const body = directChild$1(findRoot$1(pkg, CONTENT_PART_PATH$1), "office:body");
|
|
2995
|
+
const presentation = body === void 0 ? void 0 : directChild$1(body, "office:presentation");
|
|
2996
|
+
if (presentation === void 0) throw new Error(`${CONTENT_PART_PATH$1} has no office:body/office:presentation element`);
|
|
2988
2997
|
return presentation;
|
|
2989
2998
|
}
|
|
2990
2999
|
function findPageLayoutProperties(pkg) {
|
|
2991
|
-
const pageLayout = directChild(findRoot(pkg, STYLES_PART_PATH), "office:automatic-styles")?.children.find((c) => c.type === "element" && c.tag === "style:page-layout" && attr$1(c, "style:name") === "PM1");
|
|
2992
|
-
const properties = pageLayout === void 0 ? void 0 : directChild(pageLayout, "style:page-layout-properties");
|
|
3000
|
+
const pageLayout = directChild$1(findRoot$1(pkg, STYLES_PART_PATH), "office:automatic-styles")?.children.find((c) => c.type === "element" && c.tag === "style:page-layout" && attr$1(c, "style:name") === "PM1");
|
|
3001
|
+
const properties = pageLayout === void 0 ? void 0 : directChild$1(pageLayout, "style:page-layout-properties");
|
|
2993
3002
|
if (properties === void 0) throw new Error(`${STYLES_PART_PATH} has no style:page-layout[style:name="PM1"]/style:page-layout-properties element`);
|
|
2994
3003
|
return properties;
|
|
2995
3004
|
}
|
|
@@ -3009,7 +3018,7 @@ var OdpEditor = class {
|
|
|
3009
3018
|
}
|
|
3010
3019
|
addSlide() {
|
|
3011
3020
|
const presentation = findOfficePresentation(this.pkg);
|
|
3012
|
-
const pageElement = el("draw:page", { "draw:master-page-name": MASTER_PAGE_NAME });
|
|
3021
|
+
const pageElement = el("draw:page", { "draw:master-page-name": MASTER_PAGE_NAME$1 });
|
|
3013
3022
|
presentation.children.push(pageElement);
|
|
3014
3023
|
const context = { pkg: this.pkg };
|
|
3015
3024
|
return new OdpSlide(presentation.children, pageElement, context);
|
|
@@ -3110,6 +3119,539 @@ function appendShape(slide, shape) {
|
|
|
3110
3119
|
}
|
|
3111
3120
|
}
|
|
3112
3121
|
//#endregion
|
|
3122
|
+
//#region src/edit/ods/scaffold.ts
|
|
3123
|
+
const CONTENT_NS_PREFIXES = [
|
|
3124
|
+
"office",
|
|
3125
|
+
"style",
|
|
3126
|
+
"text",
|
|
3127
|
+
"table",
|
|
3128
|
+
"fo"
|
|
3129
|
+
];
|
|
3130
|
+
const STYLES_NS_PREFIXES = [
|
|
3131
|
+
"office",
|
|
3132
|
+
"style",
|
|
3133
|
+
"table",
|
|
3134
|
+
"fo"
|
|
3135
|
+
];
|
|
3136
|
+
const META_NS_PREFIXES = [
|
|
3137
|
+
"office",
|
|
3138
|
+
"meta",
|
|
3139
|
+
"dc"
|
|
3140
|
+
];
|
|
3141
|
+
const OF_NAMESPACE_ATTR = { "xmlns:of": "urn:oasis:names:tc:opendocument:xmlns:of:1.2" };
|
|
3142
|
+
const ODF_VERSION = "1.3";
|
|
3143
|
+
const MASTER_PAGE_NAME = "Standard";
|
|
3144
|
+
const SHEET_TABLE_STYLE_NAME = "OdsTable";
|
|
3145
|
+
const DEFAULT_SHEET_NAME = "Sheet1";
|
|
3146
|
+
const DEFAULT_MARGIN = "2cm";
|
|
3147
|
+
function declaration() {
|
|
3148
|
+
return {
|
|
3149
|
+
type: "declaration",
|
|
3150
|
+
attributes: [
|
|
3151
|
+
{
|
|
3152
|
+
name: "version",
|
|
3153
|
+
value: "1.0"
|
|
3154
|
+
},
|
|
3155
|
+
{
|
|
3156
|
+
name: "encoding",
|
|
3157
|
+
value: "UTF-8"
|
|
3158
|
+
},
|
|
3159
|
+
{
|
|
3160
|
+
name: "standalone",
|
|
3161
|
+
value: "yes"
|
|
3162
|
+
}
|
|
3163
|
+
]
|
|
3164
|
+
};
|
|
3165
|
+
}
|
|
3166
|
+
function buildPageLayout() {
|
|
3167
|
+
return el("style:page-layout", { "style:name": "PM1" }, [el("style:page-layout-properties", {
|
|
3168
|
+
"fo:page-width": `${PAGE_SIZE_A4.widthPt}pt`,
|
|
3169
|
+
"fo:page-height": `${PAGE_SIZE_A4.heightPt}pt`,
|
|
3170
|
+
"fo:margin-top": DEFAULT_MARGIN,
|
|
3171
|
+
"fo:margin-right": DEFAULT_MARGIN,
|
|
3172
|
+
"fo:margin-bottom": DEFAULT_MARGIN,
|
|
3173
|
+
"fo:margin-left": DEFAULT_MARGIN
|
|
3174
|
+
})]);
|
|
3175
|
+
}
|
|
3176
|
+
function buildStylesXml() {
|
|
3177
|
+
return el("office:document-styles", {
|
|
3178
|
+
...xmlnsAttributes([...STYLES_NS_PREFIXES]),
|
|
3179
|
+
"office:version": ODF_VERSION
|
|
3180
|
+
}, [
|
|
3181
|
+
el("office:styles"),
|
|
3182
|
+
el("office:automatic-styles", {}, [buildPageLayout()]),
|
|
3183
|
+
el("office:master-styles", {}, [el("style:master-page", {
|
|
3184
|
+
"style:name": MASTER_PAGE_NAME,
|
|
3185
|
+
"style:page-layout-name": "PM1"
|
|
3186
|
+
})])
|
|
3187
|
+
]);
|
|
3188
|
+
}
|
|
3189
|
+
function buildSheetTableStyle() {
|
|
3190
|
+
return el("style:style", {
|
|
3191
|
+
"style:name": SHEET_TABLE_STYLE_NAME,
|
|
3192
|
+
"style:family": "table",
|
|
3193
|
+
"style:master-page-name": MASTER_PAGE_NAME
|
|
3194
|
+
});
|
|
3195
|
+
}
|
|
3196
|
+
function buildCalculationSettings() {
|
|
3197
|
+
return el("table:calculation-settings", {
|
|
3198
|
+
"table:automatic-find-labels": "false",
|
|
3199
|
+
"table:use-regular-expressions": "false",
|
|
3200
|
+
"table:use-wildcards": "true",
|
|
3201
|
+
"table:null-year": "1950"
|
|
3202
|
+
});
|
|
3203
|
+
}
|
|
3204
|
+
function buildContentXml() {
|
|
3205
|
+
const table = el("table:table", {
|
|
3206
|
+
"table:name": DEFAULT_SHEET_NAME,
|
|
3207
|
+
"table:style-name": SHEET_TABLE_STYLE_NAME
|
|
3208
|
+
});
|
|
3209
|
+
return el("office:document-content", {
|
|
3210
|
+
...xmlnsAttributes([...CONTENT_NS_PREFIXES]),
|
|
3211
|
+
...OF_NAMESPACE_ATTR,
|
|
3212
|
+
"office:version": ODF_VERSION
|
|
3213
|
+
}, [el("office:automatic-styles", {}, [buildSheetTableStyle()]), el("office:body", {}, [el("office:spreadsheet", {}, [buildCalculationSettings(), table])])]);
|
|
3214
|
+
}
|
|
3215
|
+
function buildMetaXml() {
|
|
3216
|
+
return el("office:document-meta", {
|
|
3217
|
+
...xmlnsAttributes([...META_NS_PREFIXES]),
|
|
3218
|
+
"office:version": ODF_VERSION
|
|
3219
|
+
}, [el("office:meta")]);
|
|
3220
|
+
}
|
|
3221
|
+
function createEmptyOdsPackage() {
|
|
3222
|
+
const pkg = { parts: {
|
|
3223
|
+
"content.xml": {
|
|
3224
|
+
kind: "xml",
|
|
3225
|
+
nodes: [declaration(), buildContentXml()]
|
|
3226
|
+
},
|
|
3227
|
+
"styles.xml": {
|
|
3228
|
+
kind: "xml",
|
|
3229
|
+
nodes: [declaration(), buildStylesXml()]
|
|
3230
|
+
},
|
|
3231
|
+
"meta.xml": {
|
|
3232
|
+
kind: "xml",
|
|
3233
|
+
nodes: [declaration(), buildMetaXml()]
|
|
3234
|
+
}
|
|
3235
|
+
} };
|
|
3236
|
+
setDocumentMediaType(pkg, ODF_MEDIA_TYPES.ods);
|
|
3237
|
+
syncManifest(pkg);
|
|
3238
|
+
return pkg;
|
|
3239
|
+
}
|
|
3240
|
+
//#endregion
|
|
3241
|
+
//#region src/edit/ods/address.ts
|
|
3242
|
+
const ROW_TAG = "table:table-row";
|
|
3243
|
+
const COLUMN_TAG = "table:table-column";
|
|
3244
|
+
const CELL_TAG = "table:table-cell";
|
|
3245
|
+
const COVERED_CELL_TAG = "table:covered-table-cell";
|
|
3246
|
+
const ROW_REPEAT_ATTR = "table:number-rows-repeated";
|
|
3247
|
+
const COLUMN_REPEAT_ATTR = "table:number-columns-repeated";
|
|
3248
|
+
function isElementWithTag(tag) {
|
|
3249
|
+
return (node) => node.type === "element" && node.tag === tag;
|
|
3250
|
+
}
|
|
3251
|
+
function isCellOrCoveredCell(node) {
|
|
3252
|
+
return node.type === "element" && (node.tag === "table:table-cell" || node.tag === "table:covered-table-cell");
|
|
3253
|
+
}
|
|
3254
|
+
function validateIndex(value, label) {
|
|
3255
|
+
if (!Number.isInteger(value) || value < 0) throw new Error(`${label} must be a non-negative integer, got ${value}`);
|
|
3256
|
+
}
|
|
3257
|
+
function readRepeatCount(node, attrName) {
|
|
3258
|
+
const raw = node.attributes.find((attribute) => attribute.name === attrName)?.value;
|
|
3259
|
+
if (raw === void 0) return 1;
|
|
3260
|
+
const parsed = Number.parseInt(raw, 10);
|
|
3261
|
+
return Number.isInteger(parsed) && parsed > 0 ? parsed : 1;
|
|
3262
|
+
}
|
|
3263
|
+
function withRepeatCount(node, attrName, count) {
|
|
3264
|
+
const clone = structuredClone(node);
|
|
3265
|
+
clone.attributes = clone.attributes.filter((attribute) => attribute.name !== attrName);
|
|
3266
|
+
if (count > 1) clone.attributes.push({
|
|
3267
|
+
name: attrName,
|
|
3268
|
+
value: String(count)
|
|
3269
|
+
});
|
|
3270
|
+
return clone;
|
|
3271
|
+
}
|
|
3272
|
+
function replaceRun(children, isMember, targetIndex, repeatAttr, buildEmpty) {
|
|
3273
|
+
validateIndex(targetIndex, "targetIndex");
|
|
3274
|
+
const members = [];
|
|
3275
|
+
children.forEach((node, position) => {
|
|
3276
|
+
if (isMember(node)) members.push({
|
|
3277
|
+
node,
|
|
3278
|
+
position
|
|
3279
|
+
});
|
|
3280
|
+
});
|
|
3281
|
+
let cursor = 0;
|
|
3282
|
+
for (const member of members) {
|
|
3283
|
+
const count = readRepeatCount(member.node, repeatAttr);
|
|
3284
|
+
if (targetIndex < cursor + count) {
|
|
3285
|
+
const offset = targetIndex - cursor;
|
|
3286
|
+
if (count === 1) return member.node;
|
|
3287
|
+
const before = offset > 0 ? withRepeatCount(member.node, repeatAttr, offset) : void 0;
|
|
3288
|
+
const target = withRepeatCount(member.node, repeatAttr, 1);
|
|
3289
|
+
const replacement = [
|
|
3290
|
+
before,
|
|
3291
|
+
target,
|
|
3292
|
+
count - offset - 1 > 0 ? withRepeatCount(member.node, repeatAttr, count - offset - 1) : void 0
|
|
3293
|
+
].filter((candidate) => candidate !== void 0);
|
|
3294
|
+
children.splice(member.position, 1, ...replacement);
|
|
3295
|
+
return target;
|
|
3296
|
+
}
|
|
3297
|
+
cursor += count;
|
|
3298
|
+
}
|
|
3299
|
+
const gap = targetIndex - cursor;
|
|
3300
|
+
const lastMember = members[members.length - 1];
|
|
3301
|
+
const insertAt = lastMember === void 0 ? children.length : lastMember.position + 1;
|
|
3302
|
+
const toInsert = [];
|
|
3303
|
+
if (gap > 0) toInsert.push(withRepeatCount(buildEmpty(), repeatAttr, gap));
|
|
3304
|
+
const target = buildEmpty();
|
|
3305
|
+
toInsert.push(target);
|
|
3306
|
+
children.splice(insertAt, 0, ...toInsert);
|
|
3307
|
+
return target;
|
|
3308
|
+
}
|
|
3309
|
+
function ensureColumnCoverage(tableElement, minCount) {
|
|
3310
|
+
if (minCount <= 0) return;
|
|
3311
|
+
const columnMembers = [];
|
|
3312
|
+
tableElement.children.forEach((node, position) => {
|
|
3313
|
+
if (isElementWithTag("table:table-column")(node)) columnMembers.push({
|
|
3314
|
+
node,
|
|
3315
|
+
position
|
|
3316
|
+
});
|
|
3317
|
+
});
|
|
3318
|
+
const covered = columnMembers.reduce((sum, member) => sum + readRepeatCount(member.node, COLUMN_REPEAT_ATTR), 0);
|
|
3319
|
+
if (covered >= minCount) return;
|
|
3320
|
+
const additional = minCount - covered;
|
|
3321
|
+
const newColumn = withRepeatCount(el(COLUMN_TAG), COLUMN_REPEAT_ATTR, additional);
|
|
3322
|
+
const lastColumn = columnMembers[columnMembers.length - 1];
|
|
3323
|
+
if (lastColumn === void 0) {
|
|
3324
|
+
const firstRowPosition = tableElement.children.findIndex(isElementWithTag(ROW_TAG));
|
|
3325
|
+
const insertAt = firstRowPosition === -1 ? tableElement.children.length : firstRowPosition;
|
|
3326
|
+
tableElement.children.splice(insertAt, 0, newColumn);
|
|
3327
|
+
} else tableElement.children.splice(lastColumn.position + 1, 0, newColumn);
|
|
3328
|
+
}
|
|
3329
|
+
function resolveCellNode(tableElement, row, column) {
|
|
3330
|
+
validateIndex(row, "row");
|
|
3331
|
+
validateIndex(column, "column");
|
|
3332
|
+
ensureColumnCoverage(tableElement, column + 1);
|
|
3333
|
+
return replaceRun(replaceRun(tableElement.children, isElementWithTag(ROW_TAG), row, ROW_REPEAT_ATTR, () => el(ROW_TAG)).children, isCellOrCoveredCell, column, COLUMN_REPEAT_ATTR, () => el(CELL_TAG));
|
|
3334
|
+
}
|
|
3335
|
+
//#endregion
|
|
3336
|
+
//#region src/edit/ods/cell.ts
|
|
3337
|
+
const VALUE_TYPE_ATTR = "office:value-type";
|
|
3338
|
+
const VALUE_ATTR = "office:value";
|
|
3339
|
+
const BOOLEAN_VALUE_ATTR = "office:boolean-value";
|
|
3340
|
+
const DATE_VALUE_ATTR = "office:date-value";
|
|
3341
|
+
const TIME_VALUE_ATTR = "office:time-value";
|
|
3342
|
+
const STRING_VALUE_ATTR = "office:string-value";
|
|
3343
|
+
const CURRENCY_ATTR = "office:currency";
|
|
3344
|
+
const FORMULA_ATTR = "table:formula";
|
|
3345
|
+
const VALUE_ATTRS = [
|
|
3346
|
+
VALUE_TYPE_ATTR,
|
|
3347
|
+
VALUE_ATTR,
|
|
3348
|
+
BOOLEAN_VALUE_ATTR,
|
|
3349
|
+
DATE_VALUE_ATTR,
|
|
3350
|
+
TIME_VALUE_ATTR,
|
|
3351
|
+
STRING_VALUE_ATTR,
|
|
3352
|
+
CURRENCY_ATTR
|
|
3353
|
+
];
|
|
3354
|
+
function parseNumber(raw) {
|
|
3355
|
+
if (raw === void 0) return;
|
|
3356
|
+
const value = Number(raw);
|
|
3357
|
+
return Number.isNaN(value) ? void 0 : value;
|
|
3358
|
+
}
|
|
3359
|
+
var OdsCell = class {
|
|
3360
|
+
node;
|
|
3361
|
+
pkg;
|
|
3362
|
+
constructor(node, pkg) {
|
|
3363
|
+
this.node = node;
|
|
3364
|
+
this.pkg = pkg;
|
|
3365
|
+
}
|
|
3366
|
+
get value() {
|
|
3367
|
+
const valueType = attr$1(this.node, VALUE_TYPE_ATTR);
|
|
3368
|
+
const displayText = this.displayText;
|
|
3369
|
+
switch (valueType) {
|
|
3370
|
+
case "float": {
|
|
3371
|
+
const value = parseNumber(attr$1(this.node, VALUE_ATTR));
|
|
3372
|
+
return value === void 0 ? {
|
|
3373
|
+
kind: "string",
|
|
3374
|
+
value: displayText
|
|
3375
|
+
} : {
|
|
3376
|
+
kind: "number",
|
|
3377
|
+
value
|
|
3378
|
+
};
|
|
3379
|
+
}
|
|
3380
|
+
case "percentage": {
|
|
3381
|
+
const value = parseNumber(attr$1(this.node, VALUE_ATTR));
|
|
3382
|
+
return value === void 0 ? {
|
|
3383
|
+
kind: "string",
|
|
3384
|
+
value: displayText
|
|
3385
|
+
} : {
|
|
3386
|
+
kind: "percentage",
|
|
3387
|
+
value
|
|
3388
|
+
};
|
|
3389
|
+
}
|
|
3390
|
+
case "currency": {
|
|
3391
|
+
const value = parseNumber(attr$1(this.node, VALUE_ATTR));
|
|
3392
|
+
if (value === void 0) return {
|
|
3393
|
+
kind: "string",
|
|
3394
|
+
value: displayText
|
|
3395
|
+
};
|
|
3396
|
+
const currency = attr$1(this.node, CURRENCY_ATTR);
|
|
3397
|
+
return currency === void 0 ? {
|
|
3398
|
+
kind: "currency",
|
|
3399
|
+
value
|
|
3400
|
+
} : {
|
|
3401
|
+
kind: "currency",
|
|
3402
|
+
value,
|
|
3403
|
+
currency
|
|
3404
|
+
};
|
|
3405
|
+
}
|
|
3406
|
+
case "boolean": {
|
|
3407
|
+
const raw = attr$1(this.node, BOOLEAN_VALUE_ATTR);
|
|
3408
|
+
return raw === void 0 ? {
|
|
3409
|
+
kind: "string",
|
|
3410
|
+
value: displayText
|
|
3411
|
+
} : {
|
|
3412
|
+
kind: "boolean",
|
|
3413
|
+
value: raw === "true"
|
|
3414
|
+
};
|
|
3415
|
+
}
|
|
3416
|
+
case "date": return {
|
|
3417
|
+
kind: "date",
|
|
3418
|
+
value: attr$1(this.node, DATE_VALUE_ATTR) ?? displayText
|
|
3419
|
+
};
|
|
3420
|
+
case "time": return {
|
|
3421
|
+
kind: "time",
|
|
3422
|
+
value: attr$1(this.node, TIME_VALUE_ATTR) ?? displayText
|
|
3423
|
+
};
|
|
3424
|
+
case "string": return {
|
|
3425
|
+
kind: "string",
|
|
3426
|
+
value: attr$1(this.node, STRING_VALUE_ATTR) ?? displayText
|
|
3427
|
+
};
|
|
3428
|
+
default: return { kind: "empty" };
|
|
3429
|
+
}
|
|
3430
|
+
}
|
|
3431
|
+
set value(value) {
|
|
3432
|
+
for (const name of VALUE_ATTRS) removeAttr(this.node, name);
|
|
3433
|
+
switch (value.kind) {
|
|
3434
|
+
case "number":
|
|
3435
|
+
setAttr(this.node, VALUE_TYPE_ATTR, "float");
|
|
3436
|
+
setAttr(this.node, VALUE_ATTR, String(value.value));
|
|
3437
|
+
this.displayText = String(value.value);
|
|
3438
|
+
break;
|
|
3439
|
+
case "percentage":
|
|
3440
|
+
setAttr(this.node, VALUE_TYPE_ATTR, "percentage");
|
|
3441
|
+
setAttr(this.node, VALUE_ATTR, String(value.value));
|
|
3442
|
+
this.displayText = `${value.value * 100}%`;
|
|
3443
|
+
break;
|
|
3444
|
+
case "currency":
|
|
3445
|
+
setAttr(this.node, VALUE_TYPE_ATTR, "currency");
|
|
3446
|
+
setAttr(this.node, VALUE_ATTR, String(value.value));
|
|
3447
|
+
if (value.currency !== void 0) setAttr(this.node, CURRENCY_ATTR, value.currency);
|
|
3448
|
+
this.displayText = value.currency === void 0 ? String(value.value) : `${value.value} ${value.currency}`;
|
|
3449
|
+
break;
|
|
3450
|
+
case "boolean":
|
|
3451
|
+
setAttr(this.node, VALUE_TYPE_ATTR, "boolean");
|
|
3452
|
+
setAttr(this.node, BOOLEAN_VALUE_ATTR, value.value ? "true" : "false");
|
|
3453
|
+
this.displayText = value.value ? "TRUE" : "FALSE";
|
|
3454
|
+
break;
|
|
3455
|
+
case "date":
|
|
3456
|
+
setAttr(this.node, VALUE_TYPE_ATTR, "date");
|
|
3457
|
+
setAttr(this.node, DATE_VALUE_ATTR, value.value);
|
|
3458
|
+
this.displayText = value.value;
|
|
3459
|
+
break;
|
|
3460
|
+
case "time":
|
|
3461
|
+
setAttr(this.node, VALUE_TYPE_ATTR, "time");
|
|
3462
|
+
setAttr(this.node, TIME_VALUE_ATTR, value.value);
|
|
3463
|
+
this.displayText = value.value;
|
|
3464
|
+
break;
|
|
3465
|
+
case "string":
|
|
3466
|
+
setAttr(this.node, VALUE_TYPE_ATTR, "string");
|
|
3467
|
+
setAttr(this.node, STRING_VALUE_ATTR, value.value);
|
|
3468
|
+
this.displayText = value.value;
|
|
3469
|
+
break;
|
|
3470
|
+
case "error":
|
|
3471
|
+
setAttr(this.node, VALUE_TYPE_ATTR, "string");
|
|
3472
|
+
setAttr(this.node, STRING_VALUE_ATTR, value.value);
|
|
3473
|
+
this.displayText = value.value;
|
|
3474
|
+
break;
|
|
3475
|
+
case "empty": this.displayText = "";
|
|
3476
|
+
}
|
|
3477
|
+
}
|
|
3478
|
+
get formula() {
|
|
3479
|
+
return attr$1(this.node, FORMULA_ATTR);
|
|
3480
|
+
}
|
|
3481
|
+
set formula(value) {
|
|
3482
|
+
if (value === void 0) {
|
|
3483
|
+
removeAttr(this.node, FORMULA_ATTR);
|
|
3484
|
+
return;
|
|
3485
|
+
}
|
|
3486
|
+
setAttr(this.node, FORMULA_ATTR, value);
|
|
3487
|
+
}
|
|
3488
|
+
get displayText() {
|
|
3489
|
+
return this.node.children.filter((child) => child.type === "element" && child.tag === "text:p").map((paragraph) => decodeOdfText$1(paragraph.children)).join("\n");
|
|
3490
|
+
}
|
|
3491
|
+
set displayText(value) {
|
|
3492
|
+
this.node.children = [el("text:p", {}, encodeOdfText(value))];
|
|
3493
|
+
}
|
|
3494
|
+
setStyledRuns(runs) {
|
|
3495
|
+
const textParagraph = el("text:p");
|
|
3496
|
+
this.node.children = [textParagraph];
|
|
3497
|
+
populateParagraph(new OdtParagraph(this.node.children, textParagraph, this.pkg), {
|
|
3498
|
+
kind: "paragraph",
|
|
3499
|
+
runs: [...runs]
|
|
3500
|
+
});
|
|
3501
|
+
}
|
|
3502
|
+
};
|
|
3503
|
+
//#endregion
|
|
3504
|
+
//#region src/edit/ods/sheet.ts
|
|
3505
|
+
const NAME_ATTR = "table:name";
|
|
3506
|
+
var OdsSheet = class {
|
|
3507
|
+
container;
|
|
3508
|
+
node;
|
|
3509
|
+
pkg;
|
|
3510
|
+
removed = false;
|
|
3511
|
+
constructor(container, node, pkg) {
|
|
3512
|
+
this.container = container;
|
|
3513
|
+
this.node = node;
|
|
3514
|
+
this.pkg = pkg;
|
|
3515
|
+
}
|
|
3516
|
+
live() {
|
|
3517
|
+
if (this.removed) throw new Error("this OdsSheet has been removed from the spreadsheet and can no longer be used");
|
|
3518
|
+
return this.node;
|
|
3519
|
+
}
|
|
3520
|
+
get name() {
|
|
3521
|
+
const value = attr$1(this.live(), NAME_ATTR);
|
|
3522
|
+
if (value === void 0) throw new Error("this table:table element has no table:name attribute");
|
|
3523
|
+
return value;
|
|
3524
|
+
}
|
|
3525
|
+
set name(value) {
|
|
3526
|
+
setAttr(this.live(), NAME_ATTR, value);
|
|
3527
|
+
}
|
|
3528
|
+
cell(row, column) {
|
|
3529
|
+
const node = resolveCellNode(this.live(), row, column);
|
|
3530
|
+
if (node.tag === "table:covered-table-cell") throw new Error(`cell (${row}, ${column}) is covered by a merged range -- address the merge's own anchor cell instead`);
|
|
3531
|
+
return new OdsCell(node, this.pkg);
|
|
3532
|
+
}
|
|
3533
|
+
cellAt(reference) {
|
|
3534
|
+
const parsed = parseCellReference(reference);
|
|
3535
|
+
if (parsed === void 0) throw new Error(`cellAt: "${reference}" is not a valid A1-style cell reference`);
|
|
3536
|
+
return this.cell(parsed.row, parsed.column);
|
|
3537
|
+
}
|
|
3538
|
+
mergeCells(startRow, startColumn, rowSpan, colSpan) {
|
|
3539
|
+
if (!Number.isInteger(rowSpan) || rowSpan < 1 || !Number.isInteger(colSpan) || colSpan < 1) throw new Error(`mergeCells: rowSpan and colSpan must be positive integers, got rowSpan=${rowSpan}, colSpan=${colSpan}`);
|
|
3540
|
+
const tableElement = this.live();
|
|
3541
|
+
const anchorNode = resolveCellNode(tableElement, startRow, startColumn);
|
|
3542
|
+
if (anchorNode.tag === "table:covered-table-cell") throw new Error(`mergeCells: (${startRow}, ${startColumn}) is already covered by another merged range`);
|
|
3543
|
+
if (rowSpan > 1) setAttr(anchorNode, "table:number-rows-spanned", String(rowSpan));
|
|
3544
|
+
if (colSpan > 1) setAttr(anchorNode, "table:number-columns-spanned", String(colSpan));
|
|
3545
|
+
for (let rowOffset = 0; rowOffset < rowSpan; rowOffset++) for (let columnOffset = 0; columnOffset < colSpan; columnOffset++) {
|
|
3546
|
+
if (rowOffset === 0 && columnOffset === 0) continue;
|
|
3547
|
+
const coveredNode = resolveCellNode(tableElement, startRow + rowOffset, startColumn + columnOffset);
|
|
3548
|
+
coveredNode.tag = COVERED_CELL_TAG;
|
|
3549
|
+
coveredNode.attributes = [];
|
|
3550
|
+
coveredNode.children = [];
|
|
3551
|
+
}
|
|
3552
|
+
return new OdsCell(anchorNode, this.pkg);
|
|
3553
|
+
}
|
|
3554
|
+
remove() {
|
|
3555
|
+
removeChild(this.container, this.live());
|
|
3556
|
+
this.removed = true;
|
|
3557
|
+
}
|
|
3558
|
+
};
|
|
3559
|
+
//#endregion
|
|
3560
|
+
//#region src/edit/ods/editor.ts
|
|
3561
|
+
const CONTENT_PART_PATH = "content.xml";
|
|
3562
|
+
function directChild(parent, tag) {
|
|
3563
|
+
for (const child of parent.children) if (child.type === "element" && child.tag === tag) return child;
|
|
3564
|
+
}
|
|
3565
|
+
function findRoot(pkg) {
|
|
3566
|
+
const part = pkg.parts[CONTENT_PART_PATH];
|
|
3567
|
+
const root = part?.kind === "xml" ? part.nodes.find((n) => n.type === "element") : void 0;
|
|
3568
|
+
if (root === void 0) throw new Error(`package has no root element at ${CONTENT_PART_PATH}`);
|
|
3569
|
+
return root;
|
|
3570
|
+
}
|
|
3571
|
+
function findOfficeSpreadsheet(pkg) {
|
|
3572
|
+
const body = directChild(findRoot(pkg), "office:body");
|
|
3573
|
+
const spreadsheet = body === void 0 ? void 0 : directChild(body, "office:spreadsheet");
|
|
3574
|
+
if (spreadsheet === void 0) throw new Error(`${CONTENT_PART_PATH} has no office:body/office:spreadsheet element`);
|
|
3575
|
+
return spreadsheet;
|
|
3576
|
+
}
|
|
3577
|
+
function ensureSheetTableStyleName(pkg) {
|
|
3578
|
+
const automaticStyles = ensureAutomaticStyles(pkg);
|
|
3579
|
+
if (automaticStyles.children.find((child) => child.type === "element" && child.tag === "style:style" && attr$1(child, "style:name") === "OdsTable") !== void 0) return SHEET_TABLE_STYLE_NAME;
|
|
3580
|
+
automaticStyles.children.push(el("style:style", {
|
|
3581
|
+
"style:name": SHEET_TABLE_STYLE_NAME,
|
|
3582
|
+
"style:family": "table",
|
|
3583
|
+
"style:master-page-name": MASTER_PAGE_NAME
|
|
3584
|
+
}));
|
|
3585
|
+
return SHEET_TABLE_STYLE_NAME;
|
|
3586
|
+
}
|
|
3587
|
+
var OdsEditor = class {
|
|
3588
|
+
pkg;
|
|
3589
|
+
constructor(pkg) {
|
|
3590
|
+
this.pkg = pkg;
|
|
3591
|
+
}
|
|
3592
|
+
sheets() {
|
|
3593
|
+
const spreadsheet = findOfficeSpreadsheet(this.pkg);
|
|
3594
|
+
const out = [];
|
|
3595
|
+
for (const child of spreadsheet.children) if (child.type === "element" && child.tag === "table:table") out.push(new OdsSheet(spreadsheet.children, child, this.pkg));
|
|
3596
|
+
return out;
|
|
3597
|
+
}
|
|
3598
|
+
sheet(name) {
|
|
3599
|
+
const found = this.sheets().find((candidate) => candidate.name === name);
|
|
3600
|
+
if (found === void 0) throw new Error(`no sheet named "${name}" exists in this spreadsheet`);
|
|
3601
|
+
return found;
|
|
3602
|
+
}
|
|
3603
|
+
addSheet(name) {
|
|
3604
|
+
const spreadsheet = findOfficeSpreadsheet(this.pkg);
|
|
3605
|
+
const tableElement = el("table:table", {
|
|
3606
|
+
"table:name": name,
|
|
3607
|
+
"table:style-name": ensureSheetTableStyleName(this.pkg)
|
|
3608
|
+
});
|
|
3609
|
+
spreadsheet.children.push(tableElement);
|
|
3610
|
+
return new OdsSheet(spreadsheet.children, tableElement, this.pkg);
|
|
3611
|
+
}
|
|
3612
|
+
removeSheetAt(index) {
|
|
3613
|
+
const spreadsheet = findOfficeSpreadsheet(this.pkg);
|
|
3614
|
+
const target = spreadsheet.children.filter((child) => child.type === "element" && child.tag === "table:table")[index];
|
|
3615
|
+
if (target === void 0) throw new Error(`sheet index ${index} does not exist`);
|
|
3616
|
+
const listIndex = spreadsheet.children.indexOf(target);
|
|
3617
|
+
spreadsheet.children.splice(listIndex, 1);
|
|
3618
|
+
}
|
|
3619
|
+
toPackage() {
|
|
3620
|
+
return this.pkg;
|
|
3621
|
+
}
|
|
3622
|
+
toBytes() {
|
|
3623
|
+
return encodePackage$2(this.pkg);
|
|
3624
|
+
}
|
|
3625
|
+
};
|
|
3626
|
+
function openOds(bytes) {
|
|
3627
|
+
return new OdsEditor(decodePackage$2(bytes));
|
|
3628
|
+
}
|
|
3629
|
+
function createOds() {
|
|
3630
|
+
return new OdsEditor(createEmptyOdsPackage());
|
|
3631
|
+
}
|
|
3632
|
+
//#endregion
|
|
3633
|
+
//#region src/edit/ods/content.ts
|
|
3634
|
+
function buildOdsPackage(content) {
|
|
3635
|
+
if (content.kind !== "spreadsheet") throw new Error("buildOdsPackage requires a spreadsheet ContentDocument");
|
|
3636
|
+
const editor = createOds();
|
|
3637
|
+
if (content.sheets.length > 0) editor.removeSheetAt(0);
|
|
3638
|
+
for (const sheet of content.sheets) {
|
|
3639
|
+
const odsSheet = editor.addSheet(sheet.name);
|
|
3640
|
+
for (const cell of sheet.cells) appendCell(odsSheet, cell);
|
|
3641
|
+
}
|
|
3642
|
+
return editor.toPackage();
|
|
3643
|
+
}
|
|
3644
|
+
function appendCell(odsSheet, cell) {
|
|
3645
|
+
const odsCell = odsSheet.cell(cell.row, cell.column);
|
|
3646
|
+
odsCell.value = cell.value;
|
|
3647
|
+
if (cell.formula !== void 0) odsCell.formula = cell.formula;
|
|
3648
|
+
if (cell.runs !== void 0 && cell.runs.length > 0) odsCell.setStyledRuns(cell.runs);
|
|
3649
|
+
else odsCell.displayText = cell.displayText;
|
|
3650
|
+
const rowSpan = cell.rowSpan ?? 1;
|
|
3651
|
+
const colSpan = cell.colSpan ?? 1;
|
|
3652
|
+
if (rowSpan > 1 || colSpan > 1) odsSheet.mergeCells(cell.row, cell.column, rowSpan, colSpan);
|
|
3653
|
+
}
|
|
3654
|
+
//#endregion
|
|
3113
3655
|
//#region src/bytes/crc32.ts
|
|
3114
3656
|
const CRC32_POLYNOMIAL = 3988292384;
|
|
3115
3657
|
const BYTE_VALUES = 256;
|
|
@@ -7915,6 +8457,17 @@ function readOdpContent(pkg) {
|
|
|
7915
8457
|
};
|
|
7916
8458
|
}
|
|
7917
8459
|
//#endregion
|
|
8460
|
+
//#region src/odf/ods/read.ts
|
|
8461
|
+
function readOdsContent(pkg) {
|
|
8462
|
+
const odsDoc = readOds(pkg);
|
|
8463
|
+
return {
|
|
8464
|
+
kind: "spreadsheet",
|
|
8465
|
+
formatVersion: 1,
|
|
8466
|
+
metadata: { ...odsDoc.metadata },
|
|
8467
|
+
sheets: odsDoc.sheets
|
|
8468
|
+
};
|
|
8469
|
+
}
|
|
8470
|
+
//#endregion
|
|
7918
8471
|
//#region src/pdf/text-layout.ts
|
|
7919
8472
|
const WORD_OR_WHITESPACE_PATTERN = /\n|\s+|\S+/g;
|
|
7920
8473
|
function atomizeRuns(runs, measurer) {
|
|
@@ -8542,6 +9095,410 @@ function convertPresentationToLayout(doc, options) {
|
|
|
8542
9095
|
};
|
|
8543
9096
|
}
|
|
8544
9097
|
//#endregion
|
|
9098
|
+
//#region src/layout/sheets.ts
|
|
9099
|
+
const DEFAULT_COLUMN_WIDTH_PT = 64;
|
|
9100
|
+
const DEFAULT_ROW_HEIGHT_PT = 15;
|
|
9101
|
+
const NOMINAL_CELL_TEXT_SIZE_PT = 10;
|
|
9102
|
+
const HEADER_LABEL_SIZE_PT = 8;
|
|
9103
|
+
const CELL_TEXT_PADDING_PT = 2;
|
|
9104
|
+
const HEADER_LABEL_PADDING_PT = 2;
|
|
9105
|
+
const MINIMUM_SCALE = .01;
|
|
9106
|
+
const NUMERIC_OVERFLOW_TEXT = "###";
|
|
9107
|
+
const GRIDLINE_COLOR = rgbHexToColor("#D0D0D0");
|
|
9108
|
+
const GRIDLINE_WIDTH_PT = .5;
|
|
9109
|
+
const HEADER_LABEL_COLOR = rgbHexToColor("#606060");
|
|
9110
|
+
function columnLetters(index) {
|
|
9111
|
+
let n = index + 1;
|
|
9112
|
+
let letters = "";
|
|
9113
|
+
while (n > 0) {
|
|
9114
|
+
const remainder = (n - 1) % 26;
|
|
9115
|
+
letters = String.fromCharCode(65 + remainder) + letters;
|
|
9116
|
+
n = Math.floor((n - 1) / 26);
|
|
9117
|
+
}
|
|
9118
|
+
return letters;
|
|
9119
|
+
}
|
|
9120
|
+
function resolvePrintRange(sheet) {
|
|
9121
|
+
if (sheet.printSettings.printRange !== void 0) return sheet.printSettings.printRange;
|
|
9122
|
+
if (sheet.cells.length === 0) return;
|
|
9123
|
+
let startRow = Number.POSITIVE_INFINITY;
|
|
9124
|
+
let startColumn = Number.POSITIVE_INFINITY;
|
|
9125
|
+
let endRow = Number.NEGATIVE_INFINITY;
|
|
9126
|
+
let endColumn = Number.NEGATIVE_INFINITY;
|
|
9127
|
+
for (const cell of sheet.cells) {
|
|
9128
|
+
startRow = Math.min(startRow, cell.row);
|
|
9129
|
+
startColumn = Math.min(startColumn, cell.column);
|
|
9130
|
+
endRow = Math.max(endRow, cell.row + (cell.rowSpan ?? 1) - 1);
|
|
9131
|
+
endColumn = Math.max(endColumn, cell.column + (cell.colSpan ?? 1) - 1);
|
|
9132
|
+
}
|
|
9133
|
+
return {
|
|
9134
|
+
startRow,
|
|
9135
|
+
startColumn,
|
|
9136
|
+
endRow,
|
|
9137
|
+
endColumn
|
|
9138
|
+
};
|
|
9139
|
+
}
|
|
9140
|
+
function resolveAxis(entries, start, end, defaultSizePt) {
|
|
9141
|
+
const sorted = [...entries].sort((a, b) => a.index - b.index);
|
|
9142
|
+
const resolved = [];
|
|
9143
|
+
let pointer = 0;
|
|
9144
|
+
let currentSizePt = defaultSizePt;
|
|
9145
|
+
let currentHidden = false;
|
|
9146
|
+
for (let index = start; index <= end; index++) {
|
|
9147
|
+
while (pointer < sorted.length && sorted[pointer].index <= index) {
|
|
9148
|
+
currentSizePt = sorted[pointer].sizePt;
|
|
9149
|
+
currentHidden = sorted[pointer].hidden ?? false;
|
|
9150
|
+
pointer++;
|
|
9151
|
+
}
|
|
9152
|
+
resolved.push({
|
|
9153
|
+
index,
|
|
9154
|
+
sizePt: currentHidden ? 0 : currentSizePt,
|
|
9155
|
+
hidden: currentHidden
|
|
9156
|
+
});
|
|
9157
|
+
}
|
|
9158
|
+
return resolved;
|
|
9159
|
+
}
|
|
9160
|
+
function computeHeaderGutter(printSettings, range, measurer) {
|
|
9161
|
+
if (!printSettings.headers) return {
|
|
9162
|
+
widthPt: 0,
|
|
9163
|
+
heightPt: 0
|
|
9164
|
+
};
|
|
9165
|
+
const widestRowLabel = String(range.endRow + 1);
|
|
9166
|
+
return {
|
|
9167
|
+
widthPt: measurer.widthOfTextAtSize(widestRowLabel, DEFAULT_LAYOUT_FONT, HEADER_LABEL_SIZE_PT) + 4,
|
|
9168
|
+
heightPt: measurer.lineHeightAtSize(DEFAULT_LAYOUT_FONT, HEADER_LABEL_SIZE_PT)
|
|
9169
|
+
};
|
|
9170
|
+
}
|
|
9171
|
+
function resolveScale(printSettings, availableWidthPt, availableHeightPt, totalContentWidthPt, totalContentHeightPt) {
|
|
9172
|
+
if (printSettings.scale !== void 0) return Math.max(printSettings.scale / 100, MINIMUM_SCALE);
|
|
9173
|
+
if (printSettings.fitToPages !== void 0) {
|
|
9174
|
+
const budgetWidthPt = availableWidthPt * printSettings.fitToPages.width;
|
|
9175
|
+
const budgetHeightPt = availableHeightPt * printSettings.fitToPages.height;
|
|
9176
|
+
const widthRatio = totalContentWidthPt > 0 ? budgetWidthPt / totalContentWidthPt : 1;
|
|
9177
|
+
const heightRatio = totalContentHeightPt > 0 ? budgetHeightPt / totalContentHeightPt : 1;
|
|
9178
|
+
return Math.max(Math.min(widthRatio, heightRatio, 1), MINIMUM_SCALE);
|
|
9179
|
+
}
|
|
9180
|
+
return 1;
|
|
9181
|
+
}
|
|
9182
|
+
function partitionIndices(indices, sizeOf, availablePt, manualBreaks) {
|
|
9183
|
+
const bands = [];
|
|
9184
|
+
let current = [];
|
|
9185
|
+
let currentSizePt = 0;
|
|
9186
|
+
for (const index of indices) {
|
|
9187
|
+
if (manualBreaks.has(index) && current.length > 0) {
|
|
9188
|
+
bands.push(current);
|
|
9189
|
+
current = [];
|
|
9190
|
+
currentSizePt = 0;
|
|
9191
|
+
}
|
|
9192
|
+
const sizePt = sizeOf(index);
|
|
9193
|
+
if (current.length > 0 && currentSizePt + sizePt > availablePt) {
|
|
9194
|
+
bands.push(current);
|
|
9195
|
+
current = [];
|
|
9196
|
+
currentSizePt = 0;
|
|
9197
|
+
}
|
|
9198
|
+
current.push(index);
|
|
9199
|
+
currentSizePt += sizePt;
|
|
9200
|
+
}
|
|
9201
|
+
if (current.length > 0) bands.push(current);
|
|
9202
|
+
return bands;
|
|
9203
|
+
}
|
|
9204
|
+
function cellStyledRuns(cell) {
|
|
9205
|
+
if (cell.runs !== void 0 && cell.runs.length > 0) return toStyledRuns(cell.runs.map((run) => run.sizePt === void 0 ? {
|
|
9206
|
+
...run,
|
|
9207
|
+
sizePt: NOMINAL_CELL_TEXT_SIZE_PT
|
|
9208
|
+
} : run));
|
|
9209
|
+
return [{
|
|
9210
|
+
text: cell.displayText,
|
|
9211
|
+
font: DEFAULT_LAYOUT_FONT,
|
|
9212
|
+
sizePt: NOMINAL_CELL_TEXT_SIZE_PT,
|
|
9213
|
+
color: COLOR_BLACK
|
|
9214
|
+
}];
|
|
9215
|
+
}
|
|
9216
|
+
function isNumericLikeValue(kind) {
|
|
9217
|
+
return kind === "number" || kind === "percentage" || kind === "currency" || kind === "date" || kind === "time";
|
|
9218
|
+
}
|
|
9219
|
+
function defaultAlignmentForValue(kind) {
|
|
9220
|
+
if (isNumericLikeValue(kind)) return "right";
|
|
9221
|
+
if (kind === "boolean" || kind === "error") return "center";
|
|
9222
|
+
return "left";
|
|
9223
|
+
}
|
|
9224
|
+
function isCellVisuallyEmpty(cell) {
|
|
9225
|
+
return cell === void 0 || cell.value.kind === "empty" && cell.displayText.length === 0;
|
|
9226
|
+
}
|
|
9227
|
+
function truncateFragmentsToWidth(fragments, measurer, maxWidthPt) {
|
|
9228
|
+
const result = [];
|
|
9229
|
+
for (const fragment of fragments) {
|
|
9230
|
+
if (fragment.xOffsetPt >= maxWidthPt) break;
|
|
9231
|
+
const remainingWidthPt = maxWidthPt - fragment.xOffsetPt;
|
|
9232
|
+
if (measurer.widthOfTextAtSize(fragment.text, fragment.font, fragment.sizePt) <= remainingWidthPt) {
|
|
9233
|
+
result.push(fragment);
|
|
9234
|
+
continue;
|
|
9235
|
+
}
|
|
9236
|
+
const chars = Array.from(fragment.text);
|
|
9237
|
+
let width = 0;
|
|
9238
|
+
let fitCount = 0;
|
|
9239
|
+
for (const char of chars) {
|
|
9240
|
+
const charWidthPt = measurer.widthOfTextAtSize(char, fragment.font, fragment.sizePt);
|
|
9241
|
+
if (width + charWidthPt > remainingWidthPt) break;
|
|
9242
|
+
width += charWidthPt;
|
|
9243
|
+
fitCount++;
|
|
9244
|
+
}
|
|
9245
|
+
if (fitCount > 0) result.push({
|
|
9246
|
+
...fragment,
|
|
9247
|
+
text: chars.slice(0, fitCount).join("")
|
|
9248
|
+
});
|
|
9249
|
+
break;
|
|
9250
|
+
}
|
|
9251
|
+
return result;
|
|
9252
|
+
}
|
|
9253
|
+
function buildPositionedAxis(repeatIndices, repeatSizePtOf, bandIndices, bandSizePtOf) {
|
|
9254
|
+
const indices = [...repeatIndices, ...bandIndices];
|
|
9255
|
+
const sizesPt = [...repeatIndices.map(repeatSizePtOf), ...bandIndices.map(bandSizePtOf)];
|
|
9256
|
+
const offsetsPt = [0];
|
|
9257
|
+
let running = 0;
|
|
9258
|
+
for (const size of sizesPt) {
|
|
9259
|
+
running += size;
|
|
9260
|
+
offsetsPt.push(running);
|
|
9261
|
+
}
|
|
9262
|
+
return {
|
|
9263
|
+
indices,
|
|
9264
|
+
sizesPt,
|
|
9265
|
+
offsetsPt,
|
|
9266
|
+
positionByIndex: new Map(indices.map((index, position) => [index, position]))
|
|
9267
|
+
};
|
|
9268
|
+
}
|
|
9269
|
+
function axisSpanSizePt(axis, startIndex, span) {
|
|
9270
|
+
const startPosition = axis.positionByIndex.get(startIndex);
|
|
9271
|
+
if (startPosition === void 0) return 0;
|
|
9272
|
+
return sumColumnWidthsPt(axis.sizesPt, startPosition, span);
|
|
9273
|
+
}
|
|
9274
|
+
function renderCellText(cell, rowCells, columnAxis, rowAxis, gridLeftXPt, gridTopYDownPt, pageHeightPt, measurer, out) {
|
|
9275
|
+
const columnPosition = columnAxis.positionByIndex.get(cell.column);
|
|
9276
|
+
const rowPosition = rowAxis.positionByIndex.get(cell.row);
|
|
9277
|
+
if (columnPosition === void 0 || rowPosition === void 0) return;
|
|
9278
|
+
const ownWidthPt = axisSpanSizePt(columnAxis, cell.column, cell.colSpan ?? 1);
|
|
9279
|
+
const heightPt = axisSpanSizePt(rowAxis, cell.row, cell.rowSpan ?? 1);
|
|
9280
|
+
const xLeftPt = gridLeftXPt + columnAxis.offsetsPt[columnPosition];
|
|
9281
|
+
const yTopDownPt = gridTopYDownPt + rowAxis.offsetsPt[rowPosition];
|
|
9282
|
+
const alignment = defaultAlignmentForValue(cell.value.kind);
|
|
9283
|
+
const numericLike = isNumericLikeValue(cell.value.kind);
|
|
9284
|
+
const styledRuns = cellStyledRuns(cell);
|
|
9285
|
+
const naturalLine = wrapRunsToWidth(styledRuns, measurer, Number.POSITIVE_INFINITY)[0];
|
|
9286
|
+
let availableWidthPt = Math.max(0, ownWidthPt - 4);
|
|
9287
|
+
let fragments = naturalLine.fragments;
|
|
9288
|
+
let lineWidthPt = naturalLine.widthPt;
|
|
9289
|
+
if (lineWidthPt > availableWidthPt) if (numericLike) {
|
|
9290
|
+
const overflowLine = wrapRunsToWidth([{
|
|
9291
|
+
text: NUMERIC_OVERFLOW_TEXT,
|
|
9292
|
+
font: styledRuns[0].font,
|
|
9293
|
+
sizePt: styledRuns[0].sizePt,
|
|
9294
|
+
color: styledRuns[0].color
|
|
9295
|
+
}], measurer, Number.POSITIVE_INFINITY)[0];
|
|
9296
|
+
fragments = overflowLine.fragments;
|
|
9297
|
+
lineWidthPt = overflowLine.widthPt;
|
|
9298
|
+
} else if (cell.value.kind === "string") {
|
|
9299
|
+
let spillColumn = cell.column + (cell.colSpan ?? 1);
|
|
9300
|
+
while (lineWidthPt > availableWidthPt) {
|
|
9301
|
+
const neighborPosition = columnAxis.positionByIndex.get(spillColumn);
|
|
9302
|
+
if (neighborPosition === void 0 || !isCellVisuallyEmpty(rowCells?.get(spillColumn))) break;
|
|
9303
|
+
availableWidthPt += columnAxis.sizesPt[neighborPosition];
|
|
9304
|
+
spillColumn++;
|
|
9305
|
+
}
|
|
9306
|
+
if (lineWidthPt > availableWidthPt) fragments = truncateFragmentsToWidth(fragments, measurer, availableWidthPt);
|
|
9307
|
+
} else fragments = truncateFragmentsToWidth(fragments, measurer, availableWidthPt);
|
|
9308
|
+
const alignOffsetPt = alignmentOffsetPt(alignment, availableWidthPt, lineWidthPt);
|
|
9309
|
+
const textStartXPt = xLeftPt + CELL_TEXT_PADDING_PT + alignOffsetPt;
|
|
9310
|
+
const lineHeightPt = lineNaturalHeightPt(naturalLine, measurer, styledRuns[0]);
|
|
9311
|
+
const baselineYDownPt = yTopDownPt + Math.max(CELL_TEXT_PADDING_PT, heightPt - CELL_TEXT_PADDING_PT - lineHeightPt) + naturalLine.ascentPt;
|
|
9312
|
+
for (const fragment of fragments) {
|
|
9313
|
+
const textItem = {
|
|
9314
|
+
kind: "text",
|
|
9315
|
+
text: fragment.text,
|
|
9316
|
+
xPt: textStartXPt + fragment.xOffsetPt,
|
|
9317
|
+
yPt: pageHeightPt - baselineYDownPt,
|
|
9318
|
+
font: fragment.font,
|
|
9319
|
+
sizePt: fragment.sizePt,
|
|
9320
|
+
color: fragment.color,
|
|
9321
|
+
underline: fragment.underline,
|
|
9322
|
+
sourcePath: fragment.sourcePath
|
|
9323
|
+
};
|
|
9324
|
+
out.push(textItem);
|
|
9325
|
+
}
|
|
9326
|
+
}
|
|
9327
|
+
function renderHeaderLabels(gutter, columnAxis, rowAxis, gridLeftXPt, gridTopYDownPt, pageHeightPt, measurer, out) {
|
|
9328
|
+
const labelFont = DEFAULT_LAYOUT_FONT;
|
|
9329
|
+
const lineHeightPt = measurer.lineHeightAtSize(labelFont, HEADER_LABEL_SIZE_PT);
|
|
9330
|
+
const ascentPt = measurer.ascenderAtSize(labelFont, HEADER_LABEL_SIZE_PT);
|
|
9331
|
+
columnAxis.indices.forEach((columnIndex, position) => {
|
|
9332
|
+
const label = columnLetters(columnIndex);
|
|
9333
|
+
const widthPt = columnAxis.sizesPt[position];
|
|
9334
|
+
const labelWidthPt = measurer.widthOfTextAtSize(label, labelFont, HEADER_LABEL_SIZE_PT);
|
|
9335
|
+
const xPt = gridLeftXPt + columnAxis.offsetsPt[position] + alignmentOffsetPt("center", widthPt, labelWidthPt);
|
|
9336
|
+
const baselineYDownPt = gridTopYDownPt - gutter.heightPt + (gutter.heightPt - lineHeightPt) / 2 + ascentPt;
|
|
9337
|
+
out.push({
|
|
9338
|
+
kind: "text",
|
|
9339
|
+
text: label,
|
|
9340
|
+
xPt,
|
|
9341
|
+
yPt: pageHeightPt - baselineYDownPt,
|
|
9342
|
+
font: labelFont,
|
|
9343
|
+
sizePt: HEADER_LABEL_SIZE_PT,
|
|
9344
|
+
color: HEADER_LABEL_COLOR
|
|
9345
|
+
});
|
|
9346
|
+
});
|
|
9347
|
+
rowAxis.indices.forEach((rowIndex, position) => {
|
|
9348
|
+
const label = String(rowIndex + 1);
|
|
9349
|
+
const heightPt = rowAxis.sizesPt[position];
|
|
9350
|
+
const labelWidthPt = measurer.widthOfTextAtSize(label, labelFont, HEADER_LABEL_SIZE_PT);
|
|
9351
|
+
const xPt = gridLeftXPt - gutter.widthPt + Math.max(HEADER_LABEL_PADDING_PT, gutter.widthPt - HEADER_LABEL_PADDING_PT - labelWidthPt);
|
|
9352
|
+
const baselineYDownPt = gridTopYDownPt + rowAxis.offsetsPt[position] + Math.max(0, (heightPt - lineHeightPt) / 2) + ascentPt;
|
|
9353
|
+
out.push({
|
|
9354
|
+
kind: "text",
|
|
9355
|
+
text: label,
|
|
9356
|
+
xPt,
|
|
9357
|
+
yPt: pageHeightPt - baselineYDownPt,
|
|
9358
|
+
font: labelFont,
|
|
9359
|
+
sizePt: HEADER_LABEL_SIZE_PT,
|
|
9360
|
+
color: HEADER_LABEL_COLOR
|
|
9361
|
+
});
|
|
9362
|
+
});
|
|
9363
|
+
}
|
|
9364
|
+
function renderGridlines(gridLeftXPt, gridTopYDownPt, gridWidthPt, gridHeightPt, columnOffsetsPt, rowOffsetsPt, pageHeightPt, out) {
|
|
9365
|
+
for (const offsetPt of columnOffsetsPt) {
|
|
9366
|
+
const xPt = gridLeftXPt + offsetPt;
|
|
9367
|
+
const line = {
|
|
9368
|
+
kind: "line",
|
|
9369
|
+
x1Pt: xPt,
|
|
9370
|
+
y1Pt: pageHeightPt - gridTopYDownPt,
|
|
9371
|
+
x2Pt: xPt,
|
|
9372
|
+
y2Pt: pageHeightPt - (gridTopYDownPt + gridHeightPt),
|
|
9373
|
+
color: GRIDLINE_COLOR,
|
|
9374
|
+
widthPt: GRIDLINE_WIDTH_PT
|
|
9375
|
+
};
|
|
9376
|
+
out.push(line);
|
|
9377
|
+
}
|
|
9378
|
+
for (const offsetPt of rowOffsetsPt) {
|
|
9379
|
+
const yDownPt = gridTopYDownPt + offsetPt;
|
|
9380
|
+
const line = {
|
|
9381
|
+
kind: "line",
|
|
9382
|
+
x1Pt: gridLeftXPt,
|
|
9383
|
+
y1Pt: pageHeightPt - yDownPt,
|
|
9384
|
+
x2Pt: gridLeftXPt + gridWidthPt,
|
|
9385
|
+
y2Pt: pageHeightPt - yDownPt,
|
|
9386
|
+
color: GRIDLINE_COLOR,
|
|
9387
|
+
widthPt: GRIDLINE_WIDTH_PT
|
|
9388
|
+
};
|
|
9389
|
+
out.push(line);
|
|
9390
|
+
}
|
|
9391
|
+
}
|
|
9392
|
+
function bandableIndices(start, end, repeat) {
|
|
9393
|
+
const indices = [];
|
|
9394
|
+
for (let i = start; i <= end; i++) {
|
|
9395
|
+
if (repeat !== void 0 && i >= repeat.start && i <= repeat.end) continue;
|
|
9396
|
+
indices.push(i);
|
|
9397
|
+
}
|
|
9398
|
+
return indices;
|
|
9399
|
+
}
|
|
9400
|
+
function rangeIndices(start, end) {
|
|
9401
|
+
const indices = [];
|
|
9402
|
+
for (let i = start; i <= end; i++) indices.push(i);
|
|
9403
|
+
return indices;
|
|
9404
|
+
}
|
|
9405
|
+
function convertSheetToPages(sheet, measurer, signal, out) {
|
|
9406
|
+
throwIfAborted(signal);
|
|
9407
|
+
const range = resolvePrintRange(sheet);
|
|
9408
|
+
if (range === void 0) return;
|
|
9409
|
+
const { printSettings } = sheet;
|
|
9410
|
+
const { pageSize, margins } = printSettings;
|
|
9411
|
+
const pageContentWidthPt = Math.max(0, pageSize.widthPt - margins.leftPt - margins.rightPt);
|
|
9412
|
+
const pageContentHeightPt = Math.max(0, pageSize.heightPt - margins.topPt - margins.bottomPt);
|
|
9413
|
+
const columnEntries = resolveAxis(sheet.columns.map((c) => ({
|
|
9414
|
+
index: c.index,
|
|
9415
|
+
sizePt: c.widthPt,
|
|
9416
|
+
hidden: c.hidden
|
|
9417
|
+
})), range.startColumn, range.endColumn, DEFAULT_COLUMN_WIDTH_PT);
|
|
9418
|
+
const rowEntries = resolveAxis(sheet.rows.map((r) => ({
|
|
9419
|
+
index: r.index,
|
|
9420
|
+
sizePt: r.heightPt,
|
|
9421
|
+
hidden: r.hidden
|
|
9422
|
+
})), range.startRow, range.endRow, DEFAULT_ROW_HEIGHT_PT);
|
|
9423
|
+
const columnSizeByIndex = new Map(columnEntries.map((e) => [e.index, e.sizePt]));
|
|
9424
|
+
const rowSizeByIndex = new Map(rowEntries.map((e) => [e.index, e.sizePt]));
|
|
9425
|
+
const hiddenColumnIndices = new Set(columnEntries.filter((e) => e.hidden).map((e) => e.index));
|
|
9426
|
+
const hiddenRowIndices = new Set(rowEntries.filter((e) => e.hidden).map((e) => e.index));
|
|
9427
|
+
const gutter = computeHeaderGutter(printSettings, range, measurer);
|
|
9428
|
+
const repeatColumns = printSettings.repeatColumns;
|
|
9429
|
+
const repeatRows = printSettings.repeatRows;
|
|
9430
|
+
const repeatColumnIndices = repeatColumns === void 0 ? [] : rangeIndices(repeatColumns.start, repeatColumns.end);
|
|
9431
|
+
const repeatRowIndices = repeatRows === void 0 ? [] : rangeIndices(repeatRows.start, repeatRows.end);
|
|
9432
|
+
const repeatColumnsWidthPt = repeatColumnIndices.reduce((sum, i) => sum + (columnSizeByIndex.get(i) ?? 0), 0);
|
|
9433
|
+
const repeatRowsHeightPt = repeatRowIndices.reduce((sum, i) => sum + (rowSizeByIndex.get(i) ?? 0), 0);
|
|
9434
|
+
const bandableColumnIndices = bandableIndices(range.startColumn, range.endColumn, repeatColumns);
|
|
9435
|
+
const bandableRowIndices = bandableIndices(range.startRow, range.endRow, repeatRows);
|
|
9436
|
+
const availableWidthPt = Math.max(0, pageContentWidthPt - gutter.widthPt - repeatColumnsWidthPt);
|
|
9437
|
+
const availableHeightPt = Math.max(0, pageContentHeightPt - gutter.heightPt - repeatRowsHeightPt);
|
|
9438
|
+
const scale = resolveScale(printSettings, availableWidthPt, availableHeightPt, bandableColumnIndices.reduce((sum, i) => sum + (columnSizeByIndex.get(i) ?? 0), 0), bandableRowIndices.reduce((sum, i) => sum + (rowSizeByIndex.get(i) ?? 0), 0));
|
|
9439
|
+
const descaledAvailableWidthPt = availableWidthPt / scale;
|
|
9440
|
+
const descaledAvailableHeightPt = availableHeightPt / scale;
|
|
9441
|
+
const manualBreakColumns = new Set(printSettings.manualBreaks?.columns ?? []);
|
|
9442
|
+
const manualBreakRows = new Set(printSettings.manualBreaks?.rows ?? []);
|
|
9443
|
+
throwIfAborted(signal);
|
|
9444
|
+
const columnBands = partitionIndices(bandableColumnIndices, (i) => columnSizeByIndex.get(i) ?? 0, descaledAvailableWidthPt, manualBreakColumns);
|
|
9445
|
+
const rowBands = partitionIndices(bandableRowIndices, (i) => rowSizeByIndex.get(i) ?? 0, descaledAvailableHeightPt, manualBreakRows);
|
|
9446
|
+
const cellsByRow = /* @__PURE__ */ new Map();
|
|
9447
|
+
for (const cell of sheet.cells) {
|
|
9448
|
+
let row = cellsByRow.get(cell.row);
|
|
9449
|
+
if (row === void 0) {
|
|
9450
|
+
row = /* @__PURE__ */ new Map();
|
|
9451
|
+
cellsByRow.set(cell.row, row);
|
|
9452
|
+
}
|
|
9453
|
+
row.set(cell.column, cell);
|
|
9454
|
+
}
|
|
9455
|
+
const scaledSizeOf = (sizeByIndex) => (index) => (sizeByIndex.get(index) ?? 0) * scale;
|
|
9456
|
+
const unscaledSizeOf = (sizeByIndex) => (index) => sizeByIndex.get(index) ?? 0;
|
|
9457
|
+
const bandPairs = printSettings.pageOrder === "overThenDown" ? rowBands.flatMap((rowBand) => columnBands.map((columnBand) => ({
|
|
9458
|
+
columnBand,
|
|
9459
|
+
rowBand
|
|
9460
|
+
}))) : columnBands.flatMap((columnBand) => rowBands.map((rowBand) => ({
|
|
9461
|
+
columnBand,
|
|
9462
|
+
rowBand
|
|
9463
|
+
})));
|
|
9464
|
+
for (const { columnBand, rowBand } of bandPairs) {
|
|
9465
|
+
throwIfAborted(signal);
|
|
9466
|
+
const columnAxis = buildPositionedAxis(repeatColumnIndices, unscaledSizeOf(columnSizeByIndex), columnBand, scaledSizeOf(columnSizeByIndex));
|
|
9467
|
+
const rowAxis = buildPositionedAxis(repeatRowIndices, unscaledSizeOf(rowSizeByIndex), rowBand, scaledSizeOf(rowSizeByIndex));
|
|
9468
|
+
const gridLeftXPt = margins.leftPt + gutter.widthPt;
|
|
9469
|
+
const gridTopYDownPt = margins.topPt + gutter.heightPt;
|
|
9470
|
+
const gridWidthPt = columnAxis.offsetsPt[columnAxis.offsetsPt.length - 1];
|
|
9471
|
+
const gridHeightPt = rowAxis.offsetsPt[rowAxis.offsetsPt.length - 1];
|
|
9472
|
+
const items = [];
|
|
9473
|
+
if (printSettings.gridlines) renderGridlines(gridLeftXPt, gridTopYDownPt, gridWidthPt, gridHeightPt, columnAxis.offsetsPt, rowAxis.offsetsPt, pageSize.heightPt, items);
|
|
9474
|
+
if (printSettings.headers) renderHeaderLabels(gutter, columnAxis, rowAxis, gridLeftXPt, gridTopYDownPt, pageSize.heightPt, measurer, items);
|
|
9475
|
+
for (const rowIndex of rowAxis.indices) {
|
|
9476
|
+
const rowCells = cellsByRow.get(rowIndex);
|
|
9477
|
+
if (rowCells === void 0) continue;
|
|
9478
|
+
for (const [columnIndex, cell] of rowCells) {
|
|
9479
|
+
throwIfAborted(signal);
|
|
9480
|
+
if (!columnAxis.positionByIndex.has(columnIndex) || hiddenColumnIndices.has(columnIndex) || hiddenRowIndices.has(cell.row)) continue;
|
|
9481
|
+
renderCellText(cell, rowCells, columnAxis, rowAxis, gridLeftXPt, gridTopYDownPt, pageSize.heightPt, measurer, items);
|
|
9482
|
+
}
|
|
9483
|
+
}
|
|
9484
|
+
out.push({
|
|
9485
|
+
widthPt: pageSize.widthPt,
|
|
9486
|
+
heightPt: pageSize.heightPt,
|
|
9487
|
+
items
|
|
9488
|
+
});
|
|
9489
|
+
}
|
|
9490
|
+
}
|
|
9491
|
+
function convertSpreadsheetToLayout(doc, options) {
|
|
9492
|
+
const pages = [];
|
|
9493
|
+
for (const sheet of doc.sheets) convertSheetToPages(sheet, options.measurer, options.signal, pages);
|
|
9494
|
+
return {
|
|
9495
|
+
formatVersion: LAYOUT_FORMAT_VERSION$1,
|
|
9496
|
+
metadata: doc.metadata,
|
|
9497
|
+
pages,
|
|
9498
|
+
images: {}
|
|
9499
|
+
};
|
|
9500
|
+
}
|
|
9501
|
+
//#endregion
|
|
8545
9502
|
//#region src/layout/reconstruct.ts
|
|
8546
9503
|
const ZERO_MARGINS = {
|
|
8547
9504
|
topPt: 0,
|
|
@@ -8910,6 +9867,17 @@ function odpToPdf(bytes, options) {
|
|
|
8910
9867
|
onSubstitution: options?.onSubstitution
|
|
8911
9868
|
});
|
|
8912
9869
|
}
|
|
9870
|
+
function odsToPdf(bytes, options) {
|
|
9871
|
+
const content = readOdsContent(decodePackage$2(bytes));
|
|
9872
|
+
if (content.kind !== "spreadsheet") throw new Error("readOdsContent returned a non-spreadsheet ContentDocument");
|
|
9873
|
+
return writePdf(convertSpreadsheetToLayout(content, {
|
|
9874
|
+
measurer: createStandardFontMeasurer(),
|
|
9875
|
+
signal: options?.signal
|
|
9876
|
+
}), {
|
|
9877
|
+
signal: options?.signal,
|
|
9878
|
+
onSubstitution: options?.onSubstitution
|
|
9879
|
+
});
|
|
9880
|
+
}
|
|
8913
9881
|
function pdfToDocx(bytes, options) {
|
|
8914
9882
|
const content = reconstructWordprocessing(readPdf(bytes, {
|
|
8915
9883
|
signal: options?.signal,
|
|
@@ -8975,6 +9943,10 @@ const SUPPORTED_CONVERSIONS = [
|
|
|
8975
9943
|
source: "odp",
|
|
8976
9944
|
target: "pdf"
|
|
8977
9945
|
},
|
|
9946
|
+
{
|
|
9947
|
+
source: "ods",
|
|
9948
|
+
target: "pdf"
|
|
9949
|
+
},
|
|
8978
9950
|
{
|
|
8979
9951
|
source: "pdf",
|
|
8980
9952
|
target: "docx"
|
|
@@ -9067,6 +10039,19 @@ function createLocalDocumentConverter() {
|
|
|
9067
10039
|
diagnostics
|
|
9068
10040
|
});
|
|
9069
10041
|
}
|
|
10042
|
+
if (source.format === "ods" && targetFormat === "pdf") {
|
|
10043
|
+
const bytes = odsToPdf(source.bytes, {
|
|
10044
|
+
signal: options.signal,
|
|
10045
|
+
onSubstitution: (s, c) => diagnostics.push(substitutionDiagnostic(s, c))
|
|
10046
|
+
});
|
|
10047
|
+
return Promise.resolve({
|
|
10048
|
+
document: {
|
|
10049
|
+
format: "pdf",
|
|
10050
|
+
bytes
|
|
10051
|
+
},
|
|
10052
|
+
diagnostics
|
|
10053
|
+
});
|
|
10054
|
+
}
|
|
9070
10055
|
if (source.format === "pdf" && targetFormat === "docx") {
|
|
9071
10056
|
const bytes = pdfToDocx(source.bytes, {
|
|
9072
10057
|
signal: options.signal,
|
|
@@ -9130,4 +10115,4 @@ function fixedClock(date) {
|
|
|
9130
10115
|
return { now: () => date };
|
|
9131
10116
|
}
|
|
9132
10117
|
//#endregion
|
|
9133
|
-
export { AttributeSchema, BinaryPartSchema, COLOR_BLACK, CONTENT_FORMAT_VERSION, CommentSchema, CompactPackageSchema, CompactPartSchema, CompactXmlNodeSchema, ContentBlockSchema, ContentDocumentSchema, ContentImageBlockSchema, ContentPageBreakSchema, ContentParagraphSchema, ContentRunSchema, ContentSectionSchema, ContentShapeSchema, ContentSlideSchema, ContentTableCellSchema, ContentTableRowSchema, ContentTableSchema, DEFAULT_LAYOUT_FONT, DefinedNameSchema, DocxBytesSchema, DocxEditor, DocxParagraph, DocxRun, DocxTable, DocxTableCell, DocxTableRow, LAYOUT_FORMAT_VERSION, NOOP_DIAGNOSTIC_SINK, OdgBytesSchema, OdpBytesSchema, OdpEditor, OdpShape, OdpSlide, OdsBytesSchema, OdtBytesSchema, OdtEditor, OdtList, OdtListItem, OdtParagraph, OdtRun, OdtTable, OdtTableCell, OdtTableRow, PAGE_SIZE_A4, PAGE_SIZE_LETTER, PackageSchema, PartSchema, PdfBytesSchema, PdfEncryptedError, PdfParseError, PptxBytesSchema, PptxEditor, PptxShape, PptxSlide, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, XmlCdataSchema, XmlCommentSchema, XmlDeclarationSchema, XmlElementSchema, XmlNodeSchema, XmlPartSchema, XmlPiSchema, XmlTextSchema, attr, base64ToBytes, buildDocxPackage, buildOdpPackage, buildOdtPackage, buildPptxPackage, buildXml, bytesToBase64, childrenWithTag, compactCodec, compactPackageCodec, convertPresentationToLayout, convertWordprocessingToLayout, createDocx, createLocalDocumentConverter, createOdp, createOdt, createPptx, decodeCompactPackage, decodeEntities, decodePackage, docxPdfCodec, docxToPdf, elementsWithTag, encodeCompactPackage, encodePackage, fixedClock, flipY, fromCompact, isCompactXmlNode, isContentBlock, isXmlNode, odpPdfCodec, odpToPdf, odtPdfCodec, odtToPdf, openDocx, openOdp, openOdt, openPptx, packageCodec, parsePackage, parseXml, pdfCodec, pdfToDocx, pdfToOdp, pdfToOdt, pdfToPptx, pptxPdfCodec, pptxToPdf, readDocxContent, readOdpContent, readOdtContent, readPdf, readPptxContent, reconstructPresentation, reconstructWordprocessing, resolveRelationships, rgbHexToColor, rootElement, serializePackage, systemClock, textContent, throwIfAborted, toCompact, unzipPackage, walk, writePdf, xmlCodec, zipPackage };
|
|
10118
|
+
export { AttributeSchema, BinaryPartSchema, COLOR_BLACK, CONTENT_FORMAT_VERSION, CommentSchema, CompactPackageSchema, CompactPartSchema, CompactXmlNodeSchema, ContentBlockSchema, ContentCellValueSchema, ContentDocumentSchema, ContentImageBlockSchema, ContentPageBreakSchema, ContentParagraphSchema, ContentRunSchema, ContentSectionSchema, ContentShapeSchema, ContentSheetCellSchema, ContentSheetColumnSchema, ContentSheetPrintRangeSchema, ContentSheetPrintSettingsSchema, ContentSheetRepeatRangeSchema, ContentSheetRowSchema, ContentSheetSchema, ContentSlideSchema, ContentTableCellSchema, ContentTableRowSchema, ContentTableSchema, DEFAULT_LAYOUT_FONT, DefinedNameSchema, DocxBytesSchema, DocxEditor, DocxParagraph, DocxRun, DocxTable, DocxTableCell, DocxTableRow, LAYOUT_FORMAT_VERSION, NOOP_DIAGNOSTIC_SINK, OdgBytesSchema, OdpBytesSchema, OdpEditor, OdpShape, OdpSlide, OdsBytesSchema, OdsCell, OdsEditor, OdsSheet, OdtBytesSchema, OdtEditor, OdtList, OdtListItem, OdtParagraph, OdtRun, OdtTable, OdtTableCell, OdtTableRow, PAGE_SIZE_A4, PAGE_SIZE_LETTER, PackageSchema, PartSchema, PdfBytesSchema, PdfEncryptedError, PdfParseError, PptxBytesSchema, PptxEditor, PptxShape, PptxSlide, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, XmlCdataSchema, XmlCommentSchema, XmlDeclarationSchema, XmlElementSchema, XmlNodeSchema, XmlPartSchema, XmlPiSchema, XmlTextSchema, attr, base64ToBytes, buildDocxPackage, buildOdpPackage, buildOdsPackage, buildOdtPackage, buildPptxPackage, buildXml, bytesToBase64, childrenWithTag, compactCodec, compactPackageCodec, convertPresentationToLayout, convertSpreadsheetToLayout, convertWordprocessingToLayout, createDocx, createLocalDocumentConverter, createOdp, createOds, createOdt, createPptx, decodeCompactPackage, decodeEntities, decodePackage, docxPdfCodec, docxToPdf, elementsWithTag, encodeCompactPackage, encodePackage, fixedClock, flipY, fromCompact, isCompactXmlNode, isContentBlock, isXmlNode, odpPdfCodec, odpToPdf, odsToPdf, odtPdfCodec, odtToPdf, openDocx, openOdp, openOds, openOdt, openPptx, packageCodec, parsePackage, parseXml, pdfCodec, pdfToDocx, pdfToOdp, pdfToOdt, pdfToPptx, pptxPdfCodec, pptxToPdf, readDocxContent, readOdpContent, readOdsContent, readOdtContent, readPdf, readPptxContent, reconstructPresentation, reconstructWordprocessing, resolveRelationships, rgbHexToColor, rootElement, serializePackage, systemClock, textContent, throwIfAborted, toCompact, unzipPackage, walk, writePdf, xmlCodec, zipPackage };
|