office-open 0.11.0 → 0.12.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/ai/index.d.mts +4 -5
- package/dist/ai/index.d.mts.map +1 -1
- package/dist/ai/index.mjs +80 -21
- package/dist/ai/index.mjs.map +1 -1
- package/dist/cli.d.mts +1 -1
- package/dist/cli.mjs +110 -100
- package/dist/cli.mjs.map +1 -1
- package/dist/convert/index.d.mts +9 -7
- package/dist/convert/index.d.mts.map +1 -1
- package/dist/convert/index.mjs +62 -56
- package/dist/convert/index.mjs.map +1 -1
- package/dist/generate.d.mts +0 -1
- package/dist/generate.d.mts.map +1 -1
- package/dist/generate.mjs +3 -2
- package/dist/generate.mjs.map +1 -1
- package/dist/schemas/index.d.mts +10 -2
- package/dist/schemas/index.d.mts.map +1 -1
- package/dist/schemas/index.mjs +2 -2
- package/dist/{schemas-BKyaDGmp.mjs → schemas-DhCWsZ8v.mjs} +16389 -8750
- package/dist/schemas-DhCWsZ8v.mjs.map +1 -0
- package/dist/schemas-Dupoq6xM.d.mts.map +1 -1
- package/package.json +6 -6
- package/schemas/docx.schema.json +10939 -4995
- package/schemas/pptx.schema.json +8531 -6103
- package/schemas/xlsx.schema.json +5206 -2920
- package/dist/schemas-BKyaDGmp.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/convert/picture.ts","../../src/convert/shape.ts","../../src/convert/position.ts","../../src/convert/connector.ts","../../src/convert/group.ts","../../src/convert/table.ts","../../src/convert/smartart.ts","../../src/convert/text.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/convert/picture.ts","../../src/convert/shape.ts","../../src/convert/position.ts","../../src/convert/connector.ts","../../src/convert/group.ts","../../src/convert/table.ts","../../src/convert/smartart.ts","../../src/convert/text.ts"],"mappings":";;;;;;iBAuHgB,cAAc,QAAQ,mBAAqB;iBAE3C,cAAc,QAAQ,mBAAqB;iBAuC3C,cAAc,QAAQ,iBAAqB;iBAE3C,cAAc,QAAQ,mBAAqB;iBAmC3C,cAAc,QAAQ,iBAAqB;iBAE3C,cAAc,QAAQ,mBAAqB;;;KClJ/C,mBAAmB;UAGd;EAEf,OAAO;EACP,UAAU;EACV,UAAU;EACV,YAAY;EACZ,UAAU;EACV,UAAU;;KAIP,gBAAgB,KAAK;EAA0B,OAAO;;iBAG3C,YAAY,UAAU,cAAc,QAAQ,IAAI;iBAehD,iBACd,GAAG,YAAY,oCACd;iBAQa,uBAAuB,UAAU,kBAAkB;iBAWnD,eACd,UAAU,iCACV,gBAAgB,oCACf;UAoCc;EACf,MAAM;EACN,gBAAgB;;iBA8BF,iBAAiB,QAAQ,iBAAmB,iBAAmB;iBA+C/D,YAAY,QAAQ,iBAAmB;iBAEvC,YAAY,QAAQ,iBAAmB;iBASvC,YAAY,QAAQ,mBAAmB;iBAEvC,YAAY,QAAQ,iBAAmB;iBA2CvC,YAAY,QAAQ,mBAAmB;iBAEvC,YAAY,QAAQ,iBAAmB;;;UCvPtC;EACf;EACA;EACA;EACA;EACA;EACA;EACA;;;;iBCdc,eACd,aAAa,8BACb,aAAa,8BACb,aAAa,8BACb,aAAa,+BACZ;iBAgBa,eAAe,KAAK;EAClC;EACA;EACA;EACA;;iBAiBc,gBAAgB,SAAS,mBAAuB;iBAQhD,gBAAgB,QAAQ,qBAAuB;iBA0B/C,gBAAgB,QAAQ,mBAAuB;;;iBCsG/C,YAAY,QAAQ,iBAAmB;iBAEvC,YAAY,QAAQ,iBAAmB;iBAsEvC,YAAY,QAAQ,eAAmB;iBAEvC,YAAY,QAAQ,iBAAmB;iBAgEvC,YAAY,QAAQ,eAAmB;iBAEvC,YAAY,QAAQ,iBAAmB;;;UCvRtC;EACf,MAAM;EACN,aAAa;EACb,UAAU;;iBAyMI,YAAY,QAAQ,iBAAmB;iBAEvC,YAAY,QAAQ,kBAAkB;iBAoEtC,YAAY,QAAQ,eAAmB;iBAEvC,YAAY,QAAQ,kBAAkB;iBA2DtC,YAAY,QAAQ,eAAmB;iBAEvC,YAAY,QAAQ,iBAAmB;;;iBCrVvC,eAAe,QAAQ,oBAAe;iBAqBtC,eAAe,QAAQ,kBAAe;;;iBC2BtC,qBAAqB,SAAS,6BAA6B;iBA2H3D,mBAAmB,MAAM,mBAAmB"}
|
package/dist/convert/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createTransformation } from "@office-open/docx";
|
|
2
|
+
import { columnToLetter, letterToColumn } from "@office-open/xlsx";
|
|
2
3
|
import { convertEmuToPoints, convertEmuToTwip, convertPointsToEmu, convertPointsToTwip, convertToEmu, convertToPt, convertToTwip, convertTwipToEmu, pickConnectorBase, pickGroupBase, pickNonVisualDrawingProperties, stripColorHashPrefix } from "@office-open/core";
|
|
3
4
|
//#region src/convert/position.ts
|
|
4
5
|
/**
|
|
@@ -159,12 +160,14 @@ function boxToDocx(box) {
|
|
|
159
160
|
const baseFromPptx = (p) => ({
|
|
160
161
|
data: p.data,
|
|
161
162
|
type: p.type,
|
|
163
|
+
...p.sourceUrl !== void 0 ? { sourceUrl: p.sourceUrl } : {},
|
|
162
164
|
...pickNonVisualDrawingProperties(p)
|
|
163
165
|
});
|
|
164
166
|
/** Project an xlsx picture onto the shared base. */
|
|
165
167
|
const baseFromXlsx = (x) => ({
|
|
166
168
|
data: x.data,
|
|
167
169
|
type: x.type,
|
|
170
|
+
...x.sourceUrl !== void 0 ? { sourceUrl: x.sourceUrl } : {},
|
|
168
171
|
...pickNonVisualDrawingProperties(x)
|
|
169
172
|
});
|
|
170
173
|
/**
|
|
@@ -183,6 +186,7 @@ const baseFromDocx = (d) => {
|
|
|
183
186
|
return {
|
|
184
187
|
data: d.data,
|
|
185
188
|
type: d.type,
|
|
189
|
+
...d.sourceUrl !== void 0 ? { sourceUrl: d.sourceUrl } : {},
|
|
186
190
|
...cNvPr
|
|
187
191
|
};
|
|
188
192
|
};
|
|
@@ -231,6 +235,7 @@ function toDocxPicture(source) {
|
|
|
231
235
|
return {
|
|
232
236
|
type: docxType(base.type),
|
|
233
237
|
data: base.data,
|
|
238
|
+
...base.sourceUrl !== void 0 ? { sourceUrl: base.sourceUrl } : {},
|
|
234
239
|
transformation: {
|
|
235
240
|
width: p.width ?? 0,
|
|
236
241
|
height: p.height ?? 0,
|
|
@@ -247,6 +252,7 @@ function toDocxPicture(source) {
|
|
|
247
252
|
return {
|
|
248
253
|
type: docxType(base.type),
|
|
249
254
|
data: base.data,
|
|
255
|
+
...base.sourceUrl !== void 0 ? { sourceUrl: base.sourceUrl } : {},
|
|
250
256
|
transformation: {
|
|
251
257
|
width: 0,
|
|
252
258
|
height: 0,
|
|
@@ -266,6 +272,7 @@ function toPptxPicture(source) {
|
|
|
266
272
|
return {
|
|
267
273
|
type: pptxType(base.type),
|
|
268
274
|
data: base.data,
|
|
275
|
+
...base.sourceUrl !== void 0 ? { sourceUrl: base.sourceUrl } : {},
|
|
269
276
|
width: t.width,
|
|
270
277
|
height: t.height,
|
|
271
278
|
...t.offset ? {
|
|
@@ -280,6 +287,7 @@ function toPptxPicture(source) {
|
|
|
280
287
|
return {
|
|
281
288
|
type: pptxType(base.type),
|
|
282
289
|
data: base.data,
|
|
290
|
+
...base.sourceUrl !== void 0 ? { sourceUrl: base.sourceUrl } : {},
|
|
283
291
|
x: (x.col - 1) * DEFAULT_COL_EMU,
|
|
284
292
|
y: (x.row - 1) * DEFAULT_ROW_EMU,
|
|
285
293
|
width: 0,
|
|
@@ -296,6 +304,7 @@ function toXlsxPicture(source) {
|
|
|
296
304
|
return {
|
|
297
305
|
data: base.data,
|
|
298
306
|
type: xlsxType(base.type),
|
|
307
|
+
...base.sourceUrl !== void 0 ? { sourceUrl: base.sourceUrl } : {},
|
|
299
308
|
col: emuToCell(left, DEFAULT_COL_EMU),
|
|
300
309
|
row: emuToCell(top, DEFAULT_ROW_EMU),
|
|
301
310
|
...pickNonVisualDrawingProperties(base)
|
|
@@ -306,6 +315,7 @@ function toXlsxPicture(source) {
|
|
|
306
315
|
return {
|
|
307
316
|
data: base.data,
|
|
308
317
|
type: xlsxType(base.type),
|
|
318
|
+
...base.sourceUrl !== void 0 ? { sourceUrl: base.sourceUrl } : {},
|
|
309
319
|
col: emuToCell(toEmu(p.x), DEFAULT_COL_EMU),
|
|
310
320
|
row: emuToCell(toEmu(p.y), DEFAULT_ROW_EMU),
|
|
311
321
|
...pickNonVisualDrawingProperties(base)
|
|
@@ -349,7 +359,7 @@ function toXlsxPicture(source) {
|
|
|
349
359
|
* before/after a:p spcPts (1/100 pt) ↔ w:p spacing (twips), ÷5 / ×5.
|
|
350
360
|
* line spacing a:p lineSpacingPercent (percent, 100 = single) ↔ w:p line +
|
|
351
361
|
* lineRule "auto" (240 = single); a:p lineSpacingPoints (pt)
|
|
352
|
-
* ↔ line + lineRule "
|
|
362
|
+
* ↔ line + lineRule "exact" (×20).
|
|
353
363
|
* indents/tabs a:p marL/marR/pos (EMU) ↔ w:p (twips), ÷635 / ×635.
|
|
354
364
|
*
|
|
355
365
|
* @module
|
|
@@ -364,7 +374,7 @@ const AUTO_LINE_SINGLE = 240;
|
|
|
364
374
|
const POINTS_PER_TWIP = 1 / 20;
|
|
365
375
|
const round = Math.round;
|
|
366
376
|
/** Discriminant keys of ParagraphChild variants that are NOT a text run. */
|
|
367
|
-
const NON_RUN_KEYS = new Set([
|
|
377
|
+
const NON_RUN_KEYS = /* @__PURE__ */ new Set([
|
|
368
378
|
"hyperlink",
|
|
369
379
|
"pageBreak",
|
|
370
380
|
"columnBreak",
|
|
@@ -473,8 +483,7 @@ function drawingRunPropertiesToDocx(run) {
|
|
|
473
483
|
if (run.underline && run.underline !== "none") out.underline = { type: run.underline };
|
|
474
484
|
if (run.strike === "singleStrike") out.strike = true;
|
|
475
485
|
else if (run.strike === "doubleStrike") out.doubleStrike = true;
|
|
476
|
-
if (run.baseline !== void 0 && run.baseline !== 0)
|
|
477
|
-
else out.subScript = true;
|
|
486
|
+
if (run.baseline !== void 0 && run.baseline !== 0) out.verticalAlign = run.baseline > 0 ? "superscript" : "subscript";
|
|
478
487
|
if (run.spacing !== void 0) out.characterSpacing = round(run.spacing * TWIPS_PER_HUNDREDTH);
|
|
479
488
|
if (run.capitalization === "all") out.allCaps = true;
|
|
480
489
|
else if (run.capitalization === "small") out.smallCaps = true;
|
|
@@ -523,6 +532,7 @@ function docxToDrawingChildren(children) {
|
|
|
523
532
|
};
|
|
524
533
|
const subs = hl.children && hl.children.length ? hl.children : child.text !== void 0 ? [child.text] : [];
|
|
525
534
|
for (const sub of subs) {
|
|
535
|
+
if (typeof sub !== "string" && !isRunChild(sub)) continue;
|
|
526
536
|
const run = typeof sub === "string" ? { text: sub } : docxRunToDrawing(sub);
|
|
527
537
|
out.push({
|
|
528
538
|
...run,
|
|
@@ -551,8 +561,8 @@ function docxRunPropertiesToDrawing(run) {
|
|
|
551
561
|
if (run.underline?.type) out.underline = run.underline.type === "double" ? "double" : "single";
|
|
552
562
|
if (run.doubleStrike) out.strike = "doubleStrike";
|
|
553
563
|
else if (run.strike) out.strike = "singleStrike";
|
|
554
|
-
if (run.
|
|
555
|
-
else if (run.
|
|
564
|
+
if (run.verticalAlign === "superscript") out.baseline = 3e4;
|
|
565
|
+
else if (run.verticalAlign === "subscript") out.baseline = -25e3;
|
|
556
566
|
if (run.characterSpacing !== void 0) out.spacing = round(convertToTwip(run.characterSpacing) * HUNDREDTHS_PER_TWIP);
|
|
557
567
|
if (run.allCaps) out.capitalization = "all";
|
|
558
568
|
else if (run.smallCaps) out.capitalization = "small";
|
|
@@ -618,7 +628,7 @@ function spacingToDocx(props) {
|
|
|
618
628
|
sp.lineRule = "auto";
|
|
619
629
|
} else if (props.lineSpacingPoints !== void 0) {
|
|
620
630
|
sp.line = round(props.lineSpacingPoints / POINTS_PER_TWIP);
|
|
621
|
-
sp.lineRule = "
|
|
631
|
+
sp.lineRule = "exact";
|
|
622
632
|
}
|
|
623
633
|
return Object.keys(sp).length ? sp : void 0;
|
|
624
634
|
}
|
|
@@ -663,9 +673,9 @@ function alignToDrawing(a) {
|
|
|
663
673
|
}
|
|
664
674
|
function fontAlignToDocx(f) {
|
|
665
675
|
switch (f) {
|
|
666
|
-
case "
|
|
667
|
-
case "
|
|
668
|
-
case "
|
|
676
|
+
case "top": return "top";
|
|
677
|
+
case "center": return "center";
|
|
678
|
+
case "bottom": return "bottom";
|
|
669
679
|
case "base": return "baseline";
|
|
670
680
|
case "auto": return "auto";
|
|
671
681
|
default: return;
|
|
@@ -673,9 +683,9 @@ function fontAlignToDocx(f) {
|
|
|
673
683
|
}
|
|
674
684
|
function fontAlignToDrawing(t) {
|
|
675
685
|
switch (t) {
|
|
676
|
-
case "top": return "
|
|
677
|
-
case "center": return "
|
|
678
|
-
case "bottom": return "
|
|
686
|
+
case "top": return "top";
|
|
687
|
+
case "center": return "center";
|
|
688
|
+
case "bottom": return "bottom";
|
|
679
689
|
case "baseline": return "base";
|
|
680
690
|
case "auto": return "auto";
|
|
681
691
|
default: return;
|
|
@@ -683,19 +693,19 @@ function fontAlignToDrawing(t) {
|
|
|
683
693
|
}
|
|
684
694
|
function tabAlignToDocx(a) {
|
|
685
695
|
switch (a) {
|
|
686
|
-
case "
|
|
687
|
-
case "
|
|
688
|
-
case "
|
|
689
|
-
case "
|
|
696
|
+
case "left": return "left";
|
|
697
|
+
case "center": return "center";
|
|
698
|
+
case "right": return "right";
|
|
699
|
+
case "decimal": return "decimal";
|
|
690
700
|
default: return "left";
|
|
691
701
|
}
|
|
692
702
|
}
|
|
693
703
|
function tabAlignToDrawing(t) {
|
|
694
704
|
switch (t) {
|
|
695
|
-
case "left": return "
|
|
696
|
-
case "center": return "
|
|
697
|
-
case "right": return "
|
|
698
|
-
case "decimal": return "
|
|
705
|
+
case "left": return "left";
|
|
706
|
+
case "center": return "center";
|
|
707
|
+
case "right": return "right";
|
|
708
|
+
case "decimal": return "decimal";
|
|
699
709
|
default: return;
|
|
700
710
|
}
|
|
701
711
|
}
|
|
@@ -764,7 +774,7 @@ function isRunChild(child) {
|
|
|
764
774
|
/** Copy the shared shape-content fields that are present on the source. */
|
|
765
775
|
function pickContent(source) {
|
|
766
776
|
const out = {};
|
|
767
|
-
if (source.fill !== void 0) out.fill = source.fill;
|
|
777
|
+
if (source.fill !== void 0 && source.fill !== null) out.fill = source.fill;
|
|
768
778
|
if (source.outline !== void 0) out.outline = source.outline;
|
|
769
779
|
if (source.effects !== void 0) out.effects = source.effects;
|
|
770
780
|
if (source.effectDag !== void 0) out.effectDag = source.effectDag;
|
|
@@ -772,7 +782,7 @@ function pickContent(source) {
|
|
|
772
782
|
if (source.shape3d !== void 0) out.shape3d = source.shape3d;
|
|
773
783
|
return out;
|
|
774
784
|
}
|
|
775
|
-
/** pptx/xlsx geometry shorthand (
|
|
785
|
+
/** pptx/xlsx geometry shorthand (ShapeType | PresetGeometryOptions) → docx preset. */
|
|
776
786
|
function toPresetGeometry(g) {
|
|
777
787
|
if (g === void 0) return void 0;
|
|
778
788
|
return typeof g === "string" ? { preset: g } : g;
|
|
@@ -788,8 +798,9 @@ function textBodyToDocxChildren(textBody) {
|
|
|
788
798
|
/** docx w:p children + bodyProperties → DrawingML text body (a:p), or undefined when empty. */
|
|
789
799
|
function docxToTextBody(children, bodyProperties) {
|
|
790
800
|
const paragraphs = [];
|
|
791
|
-
for (const
|
|
792
|
-
else paragraphs.push(toDrawingParagraph(
|
|
801
|
+
for (const child of children ?? []) if (typeof child === "string") paragraphs.push(child);
|
|
802
|
+
else if ("paragraph" in child) paragraphs.push(typeof child.paragraph === "string" ? child.paragraph : toDrawingParagraph(child.paragraph));
|
|
803
|
+
else if (!("table" in child || "toc" in child || "textbox" in child || "sdt" in child || "altChunk" in child || "subDoc" in child || "customXml" in child || "bookmarkStart" in child || "bookmarkEnd" in child || "rawXml" in child)) paragraphs.push(toDrawingParagraph(child));
|
|
793
804
|
if (paragraphs.length === 0 && bodyProperties === void 0) return void 0;
|
|
794
805
|
const out = {};
|
|
795
806
|
if (paragraphs.length > 0) out.paragraphs = paragraphs;
|
|
@@ -1340,6 +1351,19 @@ function docxGroupChildrenToXlsx(children) {
|
|
|
1340
1351
|
*/
|
|
1341
1352
|
/** Heuristic EMU per character of column width (8.43 chars ≈ DEFAULT_COL_EMU). */
|
|
1342
1353
|
const EMU_PER_CHAR = DEFAULT_COL_EMU / 8.43;
|
|
1354
|
+
/** Parse a merge ref ("A1:D1") into 0-based row/col corners. */
|
|
1355
|
+
function parseMergeRef(ref) {
|
|
1356
|
+
const [from = "", to = from] = ref.split(":");
|
|
1357
|
+
const fa = from.match(/^([A-Z]+)(\d+)$/);
|
|
1358
|
+
const fb = to.match(/^([A-Z]+)(\d+)$/);
|
|
1359
|
+
if (!fa || !fb) return void 0;
|
|
1360
|
+
return {
|
|
1361
|
+
row: Number(fa[2]) - 1,
|
|
1362
|
+
col: letterToColumn(fa[1]) - 1,
|
|
1363
|
+
rowEnd: Number(fb[2]) - 1,
|
|
1364
|
+
colEnd: letterToColumn(fb[1]) - 1
|
|
1365
|
+
};
|
|
1366
|
+
}
|
|
1343
1367
|
const emuToCharWidth = (emu) => emu / EMU_PER_CHAR;
|
|
1344
1368
|
const charWidthToEmu = (chars) => chars * EMU_PER_CHAR;
|
|
1345
1369
|
/** docx height value (twip number or UM) → EMU. */
|
|
@@ -1432,7 +1456,7 @@ const SCHEME_TO_THEME = {
|
|
|
1432
1456
|
folHlink: "followedHyperlink"
|
|
1433
1457
|
};
|
|
1434
1458
|
/** pptx FillOptions (a:fill) → docx ShadingProperties (w:shd). RGB hex and
|
|
1435
|
-
* RgbColorOptions →
|
|
1459
|
+
* RgbColorOptions → `@fill`; SchemeColorOptions → `@themeColor` (token mapped);
|
|
1436
1460
|
* hsl/system/preset/scRgb/phClr and color transforms → dropped (docx shading
|
|
1437
1461
|
* is RGB-hex or theme-color only). */
|
|
1438
1462
|
function pptxFillToDocxShading(fill) {
|
|
@@ -1478,14 +1502,14 @@ function pptxToDocx(src) {
|
|
|
1478
1502
|
};
|
|
1479
1503
|
}
|
|
1480
1504
|
function xlsxToDocx(src) {
|
|
1481
|
-
const merges = src.mergeCells ?? [];
|
|
1505
|
+
const merges = (src.mergeCells ?? []).map((m) => parseMergeRef(m.ref)).filter((m) => m !== void 0);
|
|
1482
1506
|
return {
|
|
1483
1507
|
rows: src.rows.map((row, ri) => ({
|
|
1484
1508
|
...row.height !== void 0 ? { height: { value: convertPointsToTwip(convertToPt(row.height)) } } : {},
|
|
1485
1509
|
cells: (row.cells ?? []).map((cell, ci) => {
|
|
1486
|
-
const merge = merges.find((m) => m.
|
|
1487
|
-
const columnSpan = merge ? merge.
|
|
1488
|
-
const rowSpan = merge ? merge.
|
|
1510
|
+
const merge = merges.find((m) => m.row === ri && m.col === ci);
|
|
1511
|
+
const columnSpan = merge ? merge.colEnd - merge.col + 1 : void 0;
|
|
1512
|
+
const rowSpan = merge ? merge.rowEnd - merge.row + 1 : void 0;
|
|
1489
1513
|
const text = cellValueToText(cell.value);
|
|
1490
1514
|
return {
|
|
1491
1515
|
children: text !== void 0 ? [{ paragraph: { children: [{ text }] } }] : [],
|
|
@@ -1522,14 +1546,14 @@ function docxToPptx(src) {
|
|
|
1522
1546
|
};
|
|
1523
1547
|
}
|
|
1524
1548
|
function xlsxToPptx(src) {
|
|
1525
|
-
const merges = src.mergeCells ?? [];
|
|
1549
|
+
const merges = (src.mergeCells ?? []).map((m) => parseMergeRef(m.ref)).filter((m) => m !== void 0);
|
|
1526
1550
|
return {
|
|
1527
1551
|
rows: src.rows.map((row, ri) => ({
|
|
1528
1552
|
...row.height !== void 0 ? { height: convertPointsToEmu(convertToPt(row.height)) } : {},
|
|
1529
1553
|
cells: (row.cells ?? []).map((cell, ci) => {
|
|
1530
|
-
const merge = merges.find((m) => m.
|
|
1531
|
-
const columnSpan = merge ? merge.
|
|
1532
|
-
const rowSpan = merge ? merge.
|
|
1554
|
+
const merge = merges.find((m) => m.row === ri && m.col === ci);
|
|
1555
|
+
const columnSpan = merge ? merge.colEnd - merge.col + 1 : void 0;
|
|
1556
|
+
const rowSpan = merge ? merge.rowEnd - merge.row + 1 : void 0;
|
|
1533
1557
|
const text = cellValueToText(cell.value);
|
|
1534
1558
|
return {
|
|
1535
1559
|
...text !== void 0 ? { text } : {},
|
|
@@ -1580,16 +1604,7 @@ function docxToXlsx(src) {
|
|
|
1580
1604
|
}
|
|
1581
1605
|
const span = cell.columnSpan ?? 1;
|
|
1582
1606
|
const rspan = cell.rowSpan ?? 1;
|
|
1583
|
-
if (span > 1 || rspan > 1) mergeCells.push({
|
|
1584
|
-
from: {
|
|
1585
|
-
row: ri,
|
|
1586
|
-
col: ci
|
|
1587
|
-
},
|
|
1588
|
-
to: {
|
|
1589
|
-
row: ri + rspan - 1,
|
|
1590
|
-
col: ci + span - 1
|
|
1591
|
-
}
|
|
1592
|
-
});
|
|
1607
|
+
if (span > 1 || rspan > 1) mergeCells.push({ ref: `${columnToLetter(ci + 1)}${ri + 1}:${columnToLetter(ci + span)}${ri + rspan}` });
|
|
1593
1608
|
const value = docxCellText(cell);
|
|
1594
1609
|
ci += span;
|
|
1595
1610
|
return value !== void 0 ? { value } : {};
|
|
@@ -1615,16 +1630,7 @@ function pptxToXlsx(src) {
|
|
|
1615
1630
|
const xrow = { cells: row.cells.map((cell) => {
|
|
1616
1631
|
const span = cell.columnSpan ?? 1;
|
|
1617
1632
|
const rspan = cell.rowSpan ?? 1;
|
|
1618
|
-
if (span > 1 || rspan > 1) mergeCells.push({
|
|
1619
|
-
from: {
|
|
1620
|
-
row: ri,
|
|
1621
|
-
col: ci
|
|
1622
|
-
},
|
|
1623
|
-
to: {
|
|
1624
|
-
row: ri + rspan - 1,
|
|
1625
|
-
col: ci + span - 1
|
|
1626
|
-
}
|
|
1627
|
-
});
|
|
1633
|
+
if (span > 1 || rspan > 1) mergeCells.push({ ref: `${columnToLetter(ci + 1)}${ri + 1}:${columnToLetter(ci + span)}${ri + rspan}` });
|
|
1628
1634
|
const value = pptxCellText(cell);
|
|
1629
1635
|
ci += span;
|
|
1630
1636
|
return value !== void 0 ? { value } : {};
|
|
@@ -1688,7 +1694,7 @@ const altTextFromCnvPr = (cNvPr) => {
|
|
|
1688
1694
|
function toDocxSmartArt(source) {
|
|
1689
1695
|
const box = boxFromPptx(source.x, source.y, source.width, source.height);
|
|
1690
1696
|
return {
|
|
1691
|
-
|
|
1697
|
+
nodes: toDocxNodes(source.nodes),
|
|
1692
1698
|
transformation: {
|
|
1693
1699
|
width: box.width,
|
|
1694
1700
|
height: box.height,
|
|
@@ -1707,7 +1713,7 @@ function toDocxSmartArt(source) {
|
|
|
1707
1713
|
function toPptxSmartArt(source) {
|
|
1708
1714
|
const pos = boxToPptx(boxFromDocx(source.transformation));
|
|
1709
1715
|
return {
|
|
1710
|
-
nodes: toTreeNodes(source.
|
|
1716
|
+
nodes: toTreeNodes(source.nodes),
|
|
1711
1717
|
x: pos.x,
|
|
1712
1718
|
y: pos.y,
|
|
1713
1719
|
width: pos.width,
|