ooxml-core 0.7.0 → 0.8.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/docx/embedded.cjs +23 -2
- package/dist/docx/embedded.mjs +23 -2
- package/dist/docx/index.cjs +23 -2
- package/dist/docx/index.mjs +23 -2
- package/dist/docx/layout/index.cjs +2 -0
- package/dist/docx/layout/index.mjs +2 -0
- package/dist/docx/layout/paragraph-layout.d.ts.map +1 -1
- package/dist/docx/layout/result.d.ts +3 -0
- package/dist/docx/layout/result.d.ts.map +1 -1
- package/dist/docx/load/index.cjs +23 -2
- package/dist/docx/load/index.mjs +23 -2
- package/dist/docx/write-table-properties.d.ts +2 -0
- package/dist/docx/write-table-properties.d.ts.map +1 -1
- package/dist/docx/write-table.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/docx/embedded.cjs
CHANGED
|
@@ -1790,6 +1790,26 @@ var CELL_ORDER = [
|
|
|
1790
1790
|
];
|
|
1791
1791
|
var CELL_BORDER_ORDER = ["top", "start", "left", "bottom", "end", "right", "insideH", "insideV"];
|
|
1792
1792
|
var CELL_SIDES = ["top", "left", "bottom", "right"];
|
|
1793
|
+
function patchCellVerticalAlignment(doc, tc, next, base) {
|
|
1794
|
+
if (next === base) return;
|
|
1795
|
+
if (next !== void 0 && !isStVerticalJc(next))
|
|
1796
|
+
throw new Error("Cell vertical alignment must be a valid ST_VerticalJc value.");
|
|
1797
|
+
let props = first2(tc, "tcPr");
|
|
1798
|
+
if (!props) {
|
|
1799
|
+
if (next === void 0) return;
|
|
1800
|
+
props = makeW(doc, "tcPr");
|
|
1801
|
+
tc.insertBefore(props, tc.firstChild);
|
|
1802
|
+
}
|
|
1803
|
+
const alignment = first2(props, "vAlign") ?? makeW(doc, "vAlign");
|
|
1804
|
+
for (const old of children2(props, "vAlign")) props.removeChild(old);
|
|
1805
|
+
if (next !== void 0) {
|
|
1806
|
+
alignment.setAttributeNS(WORD_NS, "w:val", next);
|
|
1807
|
+
props.appendChild(alignment);
|
|
1808
|
+
}
|
|
1809
|
+
orderChildren(props, CELL_ORDER);
|
|
1810
|
+
if (!Array.from(props.childNodes).some((node) => node.nodeType === 1) && !props.attributes.length)
|
|
1811
|
+
tc.removeChild(props);
|
|
1812
|
+
}
|
|
1793
1813
|
function patchCellMargins(doc, tc, next, base) {
|
|
1794
1814
|
patchMarginProperties(doc, tc, "tcPr", "tcMar", CELL_ORDER, next, base);
|
|
1795
1815
|
}
|
|
@@ -1880,7 +1900,7 @@ var TABLE_DESCRIPTOR_KEYS = [
|
|
|
1880
1900
|
"style",
|
|
1881
1901
|
"look"
|
|
1882
1902
|
];
|
|
1883
|
-
var CELL_DESCRIPTOR_KEYS = ["gridSpan", "verticalMerge", "widthTwips"
|
|
1903
|
+
var CELL_DESCRIPTOR_KEYS = ["gridSpan", "verticalMerge", "widthTwips"];
|
|
1884
1904
|
function pick(source, keys) {
|
|
1885
1905
|
const record = source;
|
|
1886
1906
|
const result = {};
|
|
@@ -1906,7 +1926,7 @@ function assertNoDescriptorEdits(table, base) {
|
|
|
1906
1926
|
if (!source) continue;
|
|
1907
1927
|
if (JSON.stringify(pick(cell, CELL_DESCRIPTOR_KEYS)) !== JSON.stringify(pick(source, CELL_DESCRIPTOR_KEYS)))
|
|
1908
1928
|
throw new Error(
|
|
1909
|
-
"Cannot edit table cell width
|
|
1929
|
+
"Cannot edit table cell width or merge on an existing cell; cell text, borders, shading, margins and vertical alignment are supported. The original DOCX package remains unchanged."
|
|
1910
1930
|
);
|
|
1911
1931
|
}
|
|
1912
1932
|
}
|
|
@@ -1977,6 +1997,7 @@ function writeTable(doc, table, node, base, writeParagraph, replaceSlots2) {
|
|
|
1977
1997
|
patchCellBorders(doc, tc, cell.borders, source?.model.borders);
|
|
1978
1998
|
patchCellShading(doc, tc, cell, source?.model);
|
|
1979
1999
|
patchCellMargins(doc, tc, cell.margins, source?.model.margins);
|
|
2000
|
+
patchCellVerticalAlignment(doc, tc, cell.verticalAlign, source?.model.verticalAlign);
|
|
1980
2001
|
const oldParagraphs = children2(tc, "p");
|
|
1981
2002
|
const nextParagraphs = cell.paragraphs.map((paragraph) => {
|
|
1982
2003
|
const index = source?.paragraphs.findIndex((p) => p.id === paragraph.id) ?? -1;
|
package/dist/docx/embedded.mjs
CHANGED
|
@@ -1784,6 +1784,26 @@ var CELL_ORDER = [
|
|
|
1784
1784
|
];
|
|
1785
1785
|
var CELL_BORDER_ORDER = ["top", "start", "left", "bottom", "end", "right", "insideH", "insideV"];
|
|
1786
1786
|
var CELL_SIDES = ["top", "left", "bottom", "right"];
|
|
1787
|
+
function patchCellVerticalAlignment(doc, tc, next, base) {
|
|
1788
|
+
if (next === base) return;
|
|
1789
|
+
if (next !== void 0 && !isStVerticalJc(next))
|
|
1790
|
+
throw new Error("Cell vertical alignment must be a valid ST_VerticalJc value.");
|
|
1791
|
+
let props = first2(tc, "tcPr");
|
|
1792
|
+
if (!props) {
|
|
1793
|
+
if (next === void 0) return;
|
|
1794
|
+
props = makeW(doc, "tcPr");
|
|
1795
|
+
tc.insertBefore(props, tc.firstChild);
|
|
1796
|
+
}
|
|
1797
|
+
const alignment = first2(props, "vAlign") ?? makeW(doc, "vAlign");
|
|
1798
|
+
for (const old of children2(props, "vAlign")) props.removeChild(old);
|
|
1799
|
+
if (next !== void 0) {
|
|
1800
|
+
alignment.setAttributeNS(WORD_NS, "w:val", next);
|
|
1801
|
+
props.appendChild(alignment);
|
|
1802
|
+
}
|
|
1803
|
+
orderChildren(props, CELL_ORDER);
|
|
1804
|
+
if (!Array.from(props.childNodes).some((node) => node.nodeType === 1) && !props.attributes.length)
|
|
1805
|
+
tc.removeChild(props);
|
|
1806
|
+
}
|
|
1787
1807
|
function patchCellMargins(doc, tc, next, base) {
|
|
1788
1808
|
patchMarginProperties(doc, tc, "tcPr", "tcMar", CELL_ORDER, next, base);
|
|
1789
1809
|
}
|
|
@@ -1874,7 +1894,7 @@ var TABLE_DESCRIPTOR_KEYS = [
|
|
|
1874
1894
|
"style",
|
|
1875
1895
|
"look"
|
|
1876
1896
|
];
|
|
1877
|
-
var CELL_DESCRIPTOR_KEYS = ["gridSpan", "verticalMerge", "widthTwips"
|
|
1897
|
+
var CELL_DESCRIPTOR_KEYS = ["gridSpan", "verticalMerge", "widthTwips"];
|
|
1878
1898
|
function pick(source, keys) {
|
|
1879
1899
|
const record = source;
|
|
1880
1900
|
const result = {};
|
|
@@ -1900,7 +1920,7 @@ function assertNoDescriptorEdits(table, base) {
|
|
|
1900
1920
|
if (!source) continue;
|
|
1901
1921
|
if (JSON.stringify(pick(cell, CELL_DESCRIPTOR_KEYS)) !== JSON.stringify(pick(source, CELL_DESCRIPTOR_KEYS)))
|
|
1902
1922
|
throw new Error(
|
|
1903
|
-
"Cannot edit table cell width
|
|
1923
|
+
"Cannot edit table cell width or merge on an existing cell; cell text, borders, shading, margins and vertical alignment are supported. The original DOCX package remains unchanged."
|
|
1904
1924
|
);
|
|
1905
1925
|
}
|
|
1906
1926
|
}
|
|
@@ -1971,6 +1991,7 @@ function writeTable(doc, table, node, base, writeParagraph, replaceSlots2) {
|
|
|
1971
1991
|
patchCellBorders(doc, tc, cell.borders, source?.model.borders);
|
|
1972
1992
|
patchCellShading(doc, tc, cell, source?.model);
|
|
1973
1993
|
patchCellMargins(doc, tc, cell.margins, source?.model.margins);
|
|
1994
|
+
patchCellVerticalAlignment(doc, tc, cell.verticalAlign, source?.model.verticalAlign);
|
|
1974
1995
|
const oldParagraphs = children2(tc, "p");
|
|
1975
1996
|
const nextParagraphs = cell.paragraphs.map((paragraph) => {
|
|
1976
1997
|
const index = source?.paragraphs.findIndex((p) => p.id === paragraph.id) ?? -1;
|
package/dist/docx/index.cjs
CHANGED
|
@@ -2435,6 +2435,26 @@ var CELL_ORDER = [
|
|
|
2435
2435
|
];
|
|
2436
2436
|
var CELL_BORDER_ORDER = ["top", "start", "left", "bottom", "end", "right", "insideH", "insideV"];
|
|
2437
2437
|
var CELL_SIDES = ["top", "left", "bottom", "right"];
|
|
2438
|
+
function patchCellVerticalAlignment(doc, tc, next, base) {
|
|
2439
|
+
if (next === base) return;
|
|
2440
|
+
if (next !== void 0 && !isStVerticalJc(next))
|
|
2441
|
+
throw new Error("Cell vertical alignment must be a valid ST_VerticalJc value.");
|
|
2442
|
+
let props = first2(tc, "tcPr");
|
|
2443
|
+
if (!props) {
|
|
2444
|
+
if (next === void 0) return;
|
|
2445
|
+
props = makeW(doc, "tcPr");
|
|
2446
|
+
tc.insertBefore(props, tc.firstChild);
|
|
2447
|
+
}
|
|
2448
|
+
const alignment = first2(props, "vAlign") ?? makeW(doc, "vAlign");
|
|
2449
|
+
for (const old of children2(props, "vAlign")) props.removeChild(old);
|
|
2450
|
+
if (next !== void 0) {
|
|
2451
|
+
alignment.setAttributeNS(WORD_NS, "w:val", next);
|
|
2452
|
+
props.appendChild(alignment);
|
|
2453
|
+
}
|
|
2454
|
+
orderChildren(props, CELL_ORDER);
|
|
2455
|
+
if (!Array.from(props.childNodes).some((node) => node.nodeType === 1) && !props.attributes.length)
|
|
2456
|
+
tc.removeChild(props);
|
|
2457
|
+
}
|
|
2438
2458
|
function patchCellMargins(doc, tc, next, base) {
|
|
2439
2459
|
patchMarginProperties(doc, tc, "tcPr", "tcMar", CELL_ORDER, next, base);
|
|
2440
2460
|
}
|
|
@@ -2525,7 +2545,7 @@ var TABLE_DESCRIPTOR_KEYS = [
|
|
|
2525
2545
|
"style",
|
|
2526
2546
|
"look"
|
|
2527
2547
|
];
|
|
2528
|
-
var CELL_DESCRIPTOR_KEYS = ["gridSpan", "verticalMerge", "widthTwips"
|
|
2548
|
+
var CELL_DESCRIPTOR_KEYS = ["gridSpan", "verticalMerge", "widthTwips"];
|
|
2529
2549
|
function pick(source, keys) {
|
|
2530
2550
|
const record = source;
|
|
2531
2551
|
const result = {};
|
|
@@ -2551,7 +2571,7 @@ function assertNoDescriptorEdits(table, base) {
|
|
|
2551
2571
|
if (!source) continue;
|
|
2552
2572
|
if (JSON.stringify(pick(cell, CELL_DESCRIPTOR_KEYS)) !== JSON.stringify(pick(source, CELL_DESCRIPTOR_KEYS)))
|
|
2553
2573
|
throw new Error(
|
|
2554
|
-
"Cannot edit table cell width
|
|
2574
|
+
"Cannot edit table cell width or merge on an existing cell; cell text, borders, shading, margins and vertical alignment are supported. The original DOCX package remains unchanged."
|
|
2555
2575
|
);
|
|
2556
2576
|
}
|
|
2557
2577
|
}
|
|
@@ -2622,6 +2642,7 @@ function writeTable(doc, table, node, base, writeParagraph, replaceSlots2) {
|
|
|
2622
2642
|
patchCellBorders(doc, tc, cell.borders, source?.model.borders);
|
|
2623
2643
|
patchCellShading(doc, tc, cell, source?.model);
|
|
2624
2644
|
patchCellMargins(doc, tc, cell.margins, source?.model.margins);
|
|
2645
|
+
patchCellVerticalAlignment(doc, tc, cell.verticalAlign, source?.model.verticalAlign);
|
|
2625
2646
|
const oldParagraphs = children2(tc, "p");
|
|
2626
2647
|
const nextParagraphs = cell.paragraphs.map((paragraph) => {
|
|
2627
2648
|
const index = source?.paragraphs.findIndex((p) => p.id === paragraph.id) ?? -1;
|
package/dist/docx/index.mjs
CHANGED
|
@@ -2429,6 +2429,26 @@ var CELL_ORDER = [
|
|
|
2429
2429
|
];
|
|
2430
2430
|
var CELL_BORDER_ORDER = ["top", "start", "left", "bottom", "end", "right", "insideH", "insideV"];
|
|
2431
2431
|
var CELL_SIDES = ["top", "left", "bottom", "right"];
|
|
2432
|
+
function patchCellVerticalAlignment(doc, tc, next, base) {
|
|
2433
|
+
if (next === base) return;
|
|
2434
|
+
if (next !== void 0 && !isStVerticalJc(next))
|
|
2435
|
+
throw new Error("Cell vertical alignment must be a valid ST_VerticalJc value.");
|
|
2436
|
+
let props = first2(tc, "tcPr");
|
|
2437
|
+
if (!props) {
|
|
2438
|
+
if (next === void 0) return;
|
|
2439
|
+
props = makeW(doc, "tcPr");
|
|
2440
|
+
tc.insertBefore(props, tc.firstChild);
|
|
2441
|
+
}
|
|
2442
|
+
const alignment = first2(props, "vAlign") ?? makeW(doc, "vAlign");
|
|
2443
|
+
for (const old of children2(props, "vAlign")) props.removeChild(old);
|
|
2444
|
+
if (next !== void 0) {
|
|
2445
|
+
alignment.setAttributeNS(WORD_NS, "w:val", next);
|
|
2446
|
+
props.appendChild(alignment);
|
|
2447
|
+
}
|
|
2448
|
+
orderChildren(props, CELL_ORDER);
|
|
2449
|
+
if (!Array.from(props.childNodes).some((node) => node.nodeType === 1) && !props.attributes.length)
|
|
2450
|
+
tc.removeChild(props);
|
|
2451
|
+
}
|
|
2432
2452
|
function patchCellMargins(doc, tc, next, base) {
|
|
2433
2453
|
patchMarginProperties(doc, tc, "tcPr", "tcMar", CELL_ORDER, next, base);
|
|
2434
2454
|
}
|
|
@@ -2519,7 +2539,7 @@ var TABLE_DESCRIPTOR_KEYS = [
|
|
|
2519
2539
|
"style",
|
|
2520
2540
|
"look"
|
|
2521
2541
|
];
|
|
2522
|
-
var CELL_DESCRIPTOR_KEYS = ["gridSpan", "verticalMerge", "widthTwips"
|
|
2542
|
+
var CELL_DESCRIPTOR_KEYS = ["gridSpan", "verticalMerge", "widthTwips"];
|
|
2523
2543
|
function pick(source, keys) {
|
|
2524
2544
|
const record = source;
|
|
2525
2545
|
const result = {};
|
|
@@ -2545,7 +2565,7 @@ function assertNoDescriptorEdits(table, base) {
|
|
|
2545
2565
|
if (!source) continue;
|
|
2546
2566
|
if (JSON.stringify(pick(cell, CELL_DESCRIPTOR_KEYS)) !== JSON.stringify(pick(source, CELL_DESCRIPTOR_KEYS)))
|
|
2547
2567
|
throw new Error(
|
|
2548
|
-
"Cannot edit table cell width
|
|
2568
|
+
"Cannot edit table cell width or merge on an existing cell; cell text, borders, shading, margins and vertical alignment are supported. The original DOCX package remains unchanged."
|
|
2549
2569
|
);
|
|
2550
2570
|
}
|
|
2551
2571
|
}
|
|
@@ -2616,6 +2636,7 @@ function writeTable(doc, table, node, base, writeParagraph, replaceSlots2) {
|
|
|
2616
2636
|
patchCellBorders(doc, tc, cell.borders, source?.model.borders);
|
|
2617
2637
|
patchCellShading(doc, tc, cell, source?.model);
|
|
2618
2638
|
patchCellMargins(doc, tc, cell.margins, source?.model.margins);
|
|
2639
|
+
patchCellVerticalAlignment(doc, tc, cell.verticalAlign, source?.model.verticalAlign);
|
|
2619
2640
|
const oldParagraphs = children2(tc, "p");
|
|
2620
2641
|
const nextParagraphs = cell.paragraphs.map((paragraph) => {
|
|
2621
2642
|
const index = source?.paragraphs.findIndex((p) => p.id === paragraph.id) ?? -1;
|
|
@@ -1130,6 +1130,8 @@ function layoutParagraph(paragraph, contentWidthPx, measurer, note, lineBox, sta
|
|
|
1130
1130
|
rendered.forEach(({ token }, index) => {
|
|
1131
1131
|
const extent2 = tokenExtent(token, paragraph, fonts, measurer);
|
|
1132
1132
|
const fragment = expectDefined(fragments[index], "fragment for rendered token");
|
|
1133
|
+
fragment.sourceStart = globalOffset(token);
|
|
1134
|
+
fragment.sourceEnd = fragment.sourceStart + (paragraph.runs[token.runIndex]?.synthetic ? 0 : token.kind === "word" || token.kind === "space" ? token.text.length : 1);
|
|
1133
1135
|
fragment.topPx = baselinePx - extent2.above;
|
|
1134
1136
|
if (token.kind !== "object") fragment.boxHeightPx = extent2.ascent + extent2.descent;
|
|
1135
1137
|
});
|
|
@@ -1128,6 +1128,8 @@ function layoutParagraph(paragraph, contentWidthPx, measurer, note, lineBox, sta
|
|
|
1128
1128
|
rendered.forEach(({ token }, index) => {
|
|
1129
1129
|
const extent2 = tokenExtent(token, paragraph, fonts, measurer);
|
|
1130
1130
|
const fragment = expectDefined(fragments[index], "fragment for rendered token");
|
|
1131
|
+
fragment.sourceStart = globalOffset(token);
|
|
1132
|
+
fragment.sourceEnd = fragment.sourceStart + (paragraph.runs[token.runIndex]?.synthetic ? 0 : token.kind === "word" || token.kind === "space" ? token.text.length : 1);
|
|
1131
1133
|
fragment.topPx = baselinePx - extent2.above;
|
|
1132
1134
|
if (token.kind !== "object") fragment.boxHeightPx = extent2.ascent + extent2.descent;
|
|
1133
1135
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paragraph-layout.d.ts","sourceRoot":"","sources":["../../../src/docx/layout/paragraph-layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,KAAK,EAAkB,UAAU,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAclD,MAAM,WAAW,qBAAqB;IACrC,uFAAuF;IACvF,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,oFAAoF;IACpF,kBAAkB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAChC,uEAAuE;IACvE,oBAAoB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAClC,qFAAqF;IACrF,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,oBAAoB,CAAC;CAC7B;AAED;;;;;;GAMG;AACH;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,CACvB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,KACZ;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC;AAExE,wBAAgB,eAAe,CAC9B,SAAS,EAAE,eAAe,EAC1B,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE,YAAY,EACtB,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,EAC/B,OAAO,CAAC,EAAE,SAAS,EACnB,UAAU,SAAI,GACZ,qBAAqB,
|
|
1
|
+
{"version":3,"file":"paragraph-layout.d.ts","sourceRoot":"","sources":["../../../src/docx/layout/paragraph-layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,KAAK,EAAkB,UAAU,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAclD,MAAM,WAAW,qBAAqB;IACrC,uFAAuF;IACvF,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,oFAAoF;IACpF,kBAAkB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAChC,uEAAuE;IACvE,oBAAoB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAClC,qFAAqF;IACrF,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,oBAAoB,CAAC;CAC7B;AAED;;;;;;GAMG;AACH;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,CACvB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,KACZ;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC;AAExE,wBAAgB,eAAe,CAC9B,SAAS,EAAE,eAAe,EAC1B,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE,YAAY,EACtB,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,EAC/B,OAAO,CAAC,EAAE,SAAS,EACnB,UAAU,SAAI,GACZ,qBAAqB,CA2PvB"}
|
|
@@ -4,6 +4,9 @@ export interface LayoutFragment {
|
|
|
4
4
|
xPx: number;
|
|
5
5
|
widthPx: number;
|
|
6
6
|
runIndex: number;
|
|
7
|
+
/** Paragraph source range represented by this fragment; generated list labels have an empty range. */
|
|
8
|
+
sourceStart?: number;
|
|
9
|
+
sourceEnd?: number;
|
|
7
10
|
bold?: boolean;
|
|
8
11
|
italic?: boolean;
|
|
9
12
|
fontFamily?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../../src/docx/layout/result.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,MAAM,WAAW,cAAc;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,iBAAiB,EAAE,SAAS,CAAC;IAChD,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,kFAAkF;IAClF,MAAM,CAAC,EAAE,OAAO,YAAY,EAAE,YAAY,CAAC;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IACzB,0FAA0F;IAC1F,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yFAAyF;IACzF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2EAA2E;IAC3E,MAAM,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,YAAY,GAAG,OAAO,GAAG,WAAW,CAAC;CACjE;AAED,yEAAyE;AACzE,MAAM,WAAW,UAAU;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,SA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,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,kGAAkG;IAClG,MAAM,CAAC,EAAE,cAAc,EAAE,CAAC;IAC1B,iGAAiG;IACjG,SAAS,CAAC,EAAE,iBAAiB,EAAE,CAAC;CAChC;AAED,MAAM,WAAW,iBAAiB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,uEAAuE;IACvE,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,kBAAkB,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,cAAc;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,oFAAoF;IACpF,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,YAAY;IAC5B,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,uGAAuG;IACvG,cAAc,EAAE,MAAM,EAAE,CAAC;CACzB"}
|
package/dist/docx/load/index.cjs
CHANGED
|
@@ -1036,6 +1036,26 @@ var CELL_ORDER = [
|
|
|
1036
1036
|
];
|
|
1037
1037
|
var CELL_BORDER_ORDER = ["top", "start", "left", "bottom", "end", "right", "insideH", "insideV"];
|
|
1038
1038
|
var CELL_SIDES = ["top", "left", "bottom", "right"];
|
|
1039
|
+
function patchCellVerticalAlignment(doc, tc, next, base) {
|
|
1040
|
+
if (next === base) return;
|
|
1041
|
+
if (next !== void 0 && !isStVerticalJc(next))
|
|
1042
|
+
throw new Error("Cell vertical alignment must be a valid ST_VerticalJc value.");
|
|
1043
|
+
let props = first2(tc, "tcPr");
|
|
1044
|
+
if (!props) {
|
|
1045
|
+
if (next === void 0) return;
|
|
1046
|
+
props = makeW(doc, "tcPr");
|
|
1047
|
+
tc.insertBefore(props, tc.firstChild);
|
|
1048
|
+
}
|
|
1049
|
+
const alignment = first2(props, "vAlign") ?? makeW(doc, "vAlign");
|
|
1050
|
+
for (const old of children2(props, "vAlign")) props.removeChild(old);
|
|
1051
|
+
if (next !== void 0) {
|
|
1052
|
+
alignment.setAttributeNS(WORD_NS, "w:val", next);
|
|
1053
|
+
props.appendChild(alignment);
|
|
1054
|
+
}
|
|
1055
|
+
orderChildren(props, CELL_ORDER);
|
|
1056
|
+
if (!Array.from(props.childNodes).some((node) => node.nodeType === 1) && !props.attributes.length)
|
|
1057
|
+
tc.removeChild(props);
|
|
1058
|
+
}
|
|
1039
1059
|
function patchCellMargins(doc, tc, next, base) {
|
|
1040
1060
|
patchMarginProperties(doc, tc, "tcPr", "tcMar", CELL_ORDER, next, base);
|
|
1041
1061
|
}
|
|
@@ -1126,7 +1146,7 @@ var TABLE_DESCRIPTOR_KEYS = [
|
|
|
1126
1146
|
"style",
|
|
1127
1147
|
"look"
|
|
1128
1148
|
];
|
|
1129
|
-
var CELL_DESCRIPTOR_KEYS = ["gridSpan", "verticalMerge", "widthTwips"
|
|
1149
|
+
var CELL_DESCRIPTOR_KEYS = ["gridSpan", "verticalMerge", "widthTwips"];
|
|
1130
1150
|
function pick(source, keys) {
|
|
1131
1151
|
const record = source;
|
|
1132
1152
|
const result = {};
|
|
@@ -1152,7 +1172,7 @@ function assertNoDescriptorEdits(table, base) {
|
|
|
1152
1172
|
if (!source) continue;
|
|
1153
1173
|
if (JSON.stringify(pick(cell, CELL_DESCRIPTOR_KEYS)) !== JSON.stringify(pick(source, CELL_DESCRIPTOR_KEYS)))
|
|
1154
1174
|
throw new Error(
|
|
1155
|
-
"Cannot edit table cell width
|
|
1175
|
+
"Cannot edit table cell width or merge on an existing cell; cell text, borders, shading, margins and vertical alignment are supported. The original DOCX package remains unchanged."
|
|
1156
1176
|
);
|
|
1157
1177
|
}
|
|
1158
1178
|
}
|
|
@@ -1223,6 +1243,7 @@ function writeTable(doc, table, node, base, writeParagraph, replaceSlots2) {
|
|
|
1223
1243
|
patchCellBorders(doc, tc, cell.borders, source?.model.borders);
|
|
1224
1244
|
patchCellShading(doc, tc, cell, source?.model);
|
|
1225
1245
|
patchCellMargins(doc, tc, cell.margins, source?.model.margins);
|
|
1246
|
+
patchCellVerticalAlignment(doc, tc, cell.verticalAlign, source?.model.verticalAlign);
|
|
1226
1247
|
const oldParagraphs = children2(tc, "p");
|
|
1227
1248
|
const nextParagraphs = cell.paragraphs.map((paragraph) => {
|
|
1228
1249
|
const index = source?.paragraphs.findIndex((p) => p.id === paragraph.id) ?? -1;
|
package/dist/docx/load/index.mjs
CHANGED
|
@@ -1030,6 +1030,26 @@ var CELL_ORDER = [
|
|
|
1030
1030
|
];
|
|
1031
1031
|
var CELL_BORDER_ORDER = ["top", "start", "left", "bottom", "end", "right", "insideH", "insideV"];
|
|
1032
1032
|
var CELL_SIDES = ["top", "left", "bottom", "right"];
|
|
1033
|
+
function patchCellVerticalAlignment(doc, tc, next, base) {
|
|
1034
|
+
if (next === base) return;
|
|
1035
|
+
if (next !== void 0 && !isStVerticalJc(next))
|
|
1036
|
+
throw new Error("Cell vertical alignment must be a valid ST_VerticalJc value.");
|
|
1037
|
+
let props = first2(tc, "tcPr");
|
|
1038
|
+
if (!props) {
|
|
1039
|
+
if (next === void 0) return;
|
|
1040
|
+
props = makeW(doc, "tcPr");
|
|
1041
|
+
tc.insertBefore(props, tc.firstChild);
|
|
1042
|
+
}
|
|
1043
|
+
const alignment = first2(props, "vAlign") ?? makeW(doc, "vAlign");
|
|
1044
|
+
for (const old of children2(props, "vAlign")) props.removeChild(old);
|
|
1045
|
+
if (next !== void 0) {
|
|
1046
|
+
alignment.setAttributeNS(WORD_NS, "w:val", next);
|
|
1047
|
+
props.appendChild(alignment);
|
|
1048
|
+
}
|
|
1049
|
+
orderChildren(props, CELL_ORDER);
|
|
1050
|
+
if (!Array.from(props.childNodes).some((node) => node.nodeType === 1) && !props.attributes.length)
|
|
1051
|
+
tc.removeChild(props);
|
|
1052
|
+
}
|
|
1033
1053
|
function patchCellMargins(doc, tc, next, base) {
|
|
1034
1054
|
patchMarginProperties(doc, tc, "tcPr", "tcMar", CELL_ORDER, next, base);
|
|
1035
1055
|
}
|
|
@@ -1120,7 +1140,7 @@ var TABLE_DESCRIPTOR_KEYS = [
|
|
|
1120
1140
|
"style",
|
|
1121
1141
|
"look"
|
|
1122
1142
|
];
|
|
1123
|
-
var CELL_DESCRIPTOR_KEYS = ["gridSpan", "verticalMerge", "widthTwips"
|
|
1143
|
+
var CELL_DESCRIPTOR_KEYS = ["gridSpan", "verticalMerge", "widthTwips"];
|
|
1124
1144
|
function pick(source, keys) {
|
|
1125
1145
|
const record = source;
|
|
1126
1146
|
const result = {};
|
|
@@ -1146,7 +1166,7 @@ function assertNoDescriptorEdits(table, base) {
|
|
|
1146
1166
|
if (!source) continue;
|
|
1147
1167
|
if (JSON.stringify(pick(cell, CELL_DESCRIPTOR_KEYS)) !== JSON.stringify(pick(source, CELL_DESCRIPTOR_KEYS)))
|
|
1148
1168
|
throw new Error(
|
|
1149
|
-
"Cannot edit table cell width
|
|
1169
|
+
"Cannot edit table cell width or merge on an existing cell; cell text, borders, shading, margins and vertical alignment are supported. The original DOCX package remains unchanged."
|
|
1150
1170
|
);
|
|
1151
1171
|
}
|
|
1152
1172
|
}
|
|
@@ -1217,6 +1237,7 @@ function writeTable(doc, table, node, base, writeParagraph, replaceSlots2) {
|
|
|
1217
1237
|
patchCellBorders(doc, tc, cell.borders, source?.model.borders);
|
|
1218
1238
|
patchCellShading(doc, tc, cell, source?.model);
|
|
1219
1239
|
patchCellMargins(doc, tc, cell.margins, source?.model.margins);
|
|
1240
|
+
patchCellVerticalAlignment(doc, tc, cell.verticalAlign, source?.model.verticalAlign);
|
|
1220
1241
|
const oldParagraphs = children2(tc, "p");
|
|
1221
1242
|
const nextParagraphs = cell.paragraphs.map((paragraph) => {
|
|
1222
1243
|
const index = source?.paragraphs.findIndex((p) => p.id === paragraph.id) ?? -1;
|
|
@@ -5,6 +5,8 @@ import { type XmlDocument, type XmlElement } from './xml.js';
|
|
|
5
5
|
export declare function patchRowProperties(doc: XmlDocument, tr: XmlElement, next: TableRowProperties | undefined, base: TableRowProperties | undefined): void;
|
|
6
6
|
/** Updates table defaults without replacing borders, style, look or extension XML. */
|
|
7
7
|
export declare function patchTableMargins(doc: XmlDocument, table: Table, node: XmlElement, base?: Table): void;
|
|
8
|
+
/** Patches only vertical alignment; undefined restores table/style default inheritance. */
|
|
9
|
+
export declare function patchCellVerticalAlignment(doc: XmlDocument, tc: XmlElement, next: TableCell['verticalAlign'], base: TableCell['verticalAlign']): void;
|
|
8
10
|
/** Changes individual cell overrides; deleting an override restores table/default inheritance. */
|
|
9
11
|
export declare function patchCellMargins(doc: XmlDocument, tc: XmlElement, next: TableCellMargins | undefined, base: TableCellMargins | undefined): void;
|
|
10
12
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-table-properties.d.ts","sourceRoot":"","sources":["../../src/docx/write-table-properties.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAK3F,OAAO,
|
|
1
|
+
{"version":3,"file":"write-table-properties.d.ts","sourceRoot":"","sources":["../../src/docx/write-table-properties.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAK3F,OAAO,EAAmC,KAA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,KAAK,EAAa,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"write-table.d.ts","sourceRoot":"","sources":["../../src/docx/write-table.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAa,MAAM,YAAY,CAAC;AAS9D,OAAO,EAMN,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,MAAM,UAAU,CAAC;AAElB,KAAK,eAAe,GAAG,CACtB,GAAG,EAAE,WAAW,EAChB,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,UAAU,EAChB,IAAI,CAAC,EAAE,SAAS,KACZ,UAAU,CAAC;AAChB,KAAK,WAAW,GAAG,CAClB,GAAG,EAAE,WAAW,EAChB,MAAM,EAAE,UAAU,EAClB,GAAG,EAAE,UAAU,EAAE,EACjB,IAAI,EAAE,UAAU,EAAE,KACd,IAAI,CAAC;AAEV,iGAAiG;AACjG,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAiChE;AAwDD,wBAAgB,UAAU,CACzB,GAAG,EAAE,WAAW,EAChB,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,KAAK,GAAG,SAAS,EACvB,cAAc,EAAE,eAAe,EAC/B,YAAY,EAAE,WAAW,GACvB,UAAU,CAwHZ"}
|