@office-open/docx 0.12.2 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -11
- package/dist/index.d.mts +28 -31
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +102 -113
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -4
package/dist/index.mjs
CHANGED
|
@@ -381,7 +381,8 @@ const createTransformation = (options) => {
|
|
|
381
381
|
x: widthEmu,
|
|
382
382
|
y: heightEmu
|
|
383
383
|
},
|
|
384
|
-
|
|
384
|
+
flipHorizontal: options.flipHorizontal,
|
|
385
|
+
flipVertical: options.flipVertical,
|
|
385
386
|
offset: {
|
|
386
387
|
emus: {
|
|
387
388
|
x: offsetLeftEmu,
|
|
@@ -1003,46 +1004,9 @@ const TableLayoutType = {
|
|
|
1003
1004
|
//#endregion
|
|
1004
1005
|
//#region src/shared/border.ts
|
|
1005
1006
|
/**
|
|
1006
|
-
*
|
|
1007
|
-
*
|
|
1008
|
-
* `bottom`, `
|
|
1009
|
-
*
|
|
1010
|
-
* Reference: http://officeopenxml.com/WPtableBorders.php
|
|
1011
|
-
*
|
|
1012
|
-
* ## XSD Schema
|
|
1013
|
-
* ```xml
|
|
1014
|
-
* <xsd:simpleType name="ST_Border">
|
|
1015
|
-
* <xsd:restriction base="xsd:string">
|
|
1016
|
-
* <xsd:enumeration value="single"/>
|
|
1017
|
-
* <xsd:enumeration value="dashDotStroked"/>
|
|
1018
|
-
* <xsd:enumeration value="dashed"/>
|
|
1019
|
-
* <xsd:enumeration value="dashSmallGap"/>
|
|
1020
|
-
* <xsd:enumeration value="dotDash"/>
|
|
1021
|
-
* <xsd:enumeration value="dotDotDash"/>
|
|
1022
|
-
* <xsd:enumeration value="dotted"/>
|
|
1023
|
-
* <xsd:enumeration value="double"/>
|
|
1024
|
-
* <xsd:enumeration value="doubleWave"/>
|
|
1025
|
-
* <xsd:enumeration value="inset"/>
|
|
1026
|
-
* <xsd:enumeration value="nil"/>
|
|
1027
|
-
* <xsd:enumeration value="none"/>
|
|
1028
|
-
* <xsd:enumeration value="outset"/>
|
|
1029
|
-
* <xsd:enumeration value="thick"/>
|
|
1030
|
-
* <xsd:enumeration value="thickThinLargeGap"/>
|
|
1031
|
-
* <xsd:enumeration value="thickThinMediumGap"/>
|
|
1032
|
-
* <xsd:enumeration value="thickThinSmallGap"/>
|
|
1033
|
-
* <xsd:enumeration value="thinThickLargeGap"/>
|
|
1034
|
-
* <xsd:enumeration value="thinThickMediumGap"/>
|
|
1035
|
-
* <xsd:enumeration value="thinThickSmallGap"/>
|
|
1036
|
-
* <xsd:enumeration value="thinThickThinLargeGap"/>
|
|
1037
|
-
* <xsd:enumeration value="thinThickThinMediumGap"/>
|
|
1038
|
-
* <xsd:enumeration value="thinThickThinSmallGap"/>
|
|
1039
|
-
* <xsd:enumeration value="threeDEmboss"/>
|
|
1040
|
-
* <xsd:enumeration value="threeDEngrave"/>
|
|
1041
|
-
* <xsd:enumeration value="triple"/>
|
|
1042
|
-
* <xsd:enumeration value="wave"/>
|
|
1043
|
-
* </xsd:restriction>
|
|
1044
|
-
* </xsd:simpleType>
|
|
1045
|
-
* ```
|
|
1007
|
+
* Border style tokens for the `style` field — the common line styles Word
|
|
1008
|
+
* renders as line patterns. Child elements of w:tblBorders specify the sides:
|
|
1009
|
+
* `top`, `bottom`, `start`/`left`, `end`/`right`, `insideH`, `insideV`.
|
|
1046
1010
|
*
|
|
1047
1011
|
* @publicApi
|
|
1048
1012
|
*/
|
|
@@ -1102,15 +1066,15 @@ const BorderStyle = {
|
|
|
1102
1066
|
/** A wavy line */
|
|
1103
1067
|
WAVE: "wave"
|
|
1104
1068
|
};
|
|
1105
|
-
/** Valid border `@w:val` values (ST_Border). */
|
|
1106
|
-
const BORDER_STYLES = Object.values(BorderStyle);
|
|
1107
1069
|
/**
|
|
1108
1070
|
* Parse one CT_Border side element. Returns undefined when the element is
|
|
1109
|
-
* malformed (missing
|
|
1071
|
+
* malformed (missing `@w:val`) so callers skip the side. Any ST_Border token
|
|
1072
|
+
* passes through — Word's artistic styles (apples, weavingBraid, …) keep the
|
|
1073
|
+
* whole side instead of being dropped.
|
|
1110
1074
|
*/
|
|
1111
1075
|
function parseBorderSide(sideEl) {
|
|
1112
1076
|
const style = attr(sideEl, "w:val");
|
|
1113
|
-
if (!style
|
|
1077
|
+
if (!style) return void 0;
|
|
1114
1078
|
const sideOpts = { style };
|
|
1115
1079
|
const color = attr(sideEl, "w:color");
|
|
1116
1080
|
if (color) sideOpts.color = color;
|
|
@@ -3324,7 +3288,7 @@ function buildCustomXmlPropertiesXml(pr) {
|
|
|
3324
3288
|
function stringifyCustomXmlShell(opts, contentXml) {
|
|
3325
3289
|
const attrs = [`w:element="${escapeXml(opts.element)}"`];
|
|
3326
3290
|
if (opts.uri !== void 0) attrs.push(`w:uri="${escapeXml(opts.uri)}"`);
|
|
3327
|
-
const prXml = opts.
|
|
3291
|
+
const prXml = opts.properties ? buildCustomXmlPropertiesXml(opts.properties) : "";
|
|
3328
3292
|
return `<w:customXml ${attrs.join(" ")}>${prXml}${contentXml}</w:customXml>`;
|
|
3329
3293
|
}
|
|
3330
3294
|
const customXmlBlockDesc = {
|
|
@@ -3342,7 +3306,7 @@ const customXmlBlockDesc = {
|
|
|
3342
3306
|
const uri = attr(el, "w:uri");
|
|
3343
3307
|
if (uri) opts.uri = uri;
|
|
3344
3308
|
const xmlPr = findChild(el, "w:customXmlPr");
|
|
3345
|
-
if (xmlPr) opts.
|
|
3309
|
+
if (xmlPr) opts.properties = parseCustomXmlProperties(xmlPr);
|
|
3346
3310
|
const childList = [];
|
|
3347
3311
|
for (const child of el.elements ?? []) {
|
|
3348
3312
|
if (child.name === "w:customXmlPr") continue;
|
|
@@ -6252,7 +6216,7 @@ function parseCustomXmlInline(el, ctx) {
|
|
|
6252
6216
|
const pr = findChild(el, "w:customXmlPr");
|
|
6253
6217
|
if (pr) {
|
|
6254
6218
|
const parsed = parseCustomXmlProperties(pr);
|
|
6255
|
-
if (parsed.placeholder !== void 0 || parsed.attributes !== void 0) cx.
|
|
6219
|
+
if (parsed.placeholder !== void 0 || parsed.attributes !== void 0) cx.properties = parsed;
|
|
6256
6220
|
}
|
|
6257
6221
|
const content = parseContainerChildren(el, ctx);
|
|
6258
6222
|
if (content.length > 0) cx.children = content;
|
|
@@ -6916,6 +6880,8 @@ function parsePictureRun(el, ctx) {
|
|
|
6916
6880
|
if (info.altText) imageOpts.altText = info.altText;
|
|
6917
6881
|
if (info.floating) imageOpts.floating = info.floating;
|
|
6918
6882
|
if (info.graphicFrameLocks !== void 0) imageOpts.graphicFrameLocks = info.graphicFrameLocks;
|
|
6883
|
+
const cstate = attr(blip, "cstate");
|
|
6884
|
+
if (cstate !== void 0) imageOpts.compression = cstate;
|
|
6919
6885
|
const blipFill = findFirst(el, "pic:blipFill");
|
|
6920
6886
|
if (blipFill) {
|
|
6921
6887
|
const srcRect = readSourceRectangle(blipFill);
|
|
@@ -6942,10 +6908,8 @@ function parsePictureRun(el, ctx) {
|
|
|
6942
6908
|
if (rot !== void 0) transform.rotation = parseAngle(rot);
|
|
6943
6909
|
const flipH = attrBool(xfrm, "flipH");
|
|
6944
6910
|
const flipV = attrBool(xfrm, "flipV");
|
|
6945
|
-
if (flipH !== void 0
|
|
6946
|
-
|
|
6947
|
-
...flipV !== void 0 ? { vertical: flipV } : {}
|
|
6948
|
-
};
|
|
6911
|
+
if (flipH !== void 0) transform.flipHorizontal = flipH;
|
|
6912
|
+
if (flipV !== void 0) transform.flipVertical = flipV;
|
|
6949
6913
|
}
|
|
6950
6914
|
}
|
|
6951
6915
|
const blipResult = blipDesc.parse(blip, ctx);
|
|
@@ -7066,16 +7030,29 @@ function readShapeFill(parent, ctx) {
|
|
|
7066
7030
|
* the `idx` attribute plus an optional EG_ColorChoice color override.
|
|
7067
7031
|
*/
|
|
7068
7032
|
function parseStyleRef(el, ctx) {
|
|
7069
|
-
const idx =
|
|
7033
|
+
const idx = attrNum(el, "idx");
|
|
7070
7034
|
if (idx === void 0) return void 0;
|
|
7071
|
-
const result = { idx };
|
|
7035
|
+
const result = { index: idx };
|
|
7036
|
+
const color = parseColorChoice(el, ctx);
|
|
7037
|
+
if (color && Object.keys(color).length > 0) result.color = color;
|
|
7038
|
+
return result;
|
|
7039
|
+
}
|
|
7040
|
+
/**
|
|
7041
|
+
* Parse a:fontRef — @idx is ST_FontCollectionIndex (major/minor/none), not a
|
|
7042
|
+
* number, so it reads as a collection slot instead of a matrix index. Off-XSD
|
|
7043
|
+
* tokens drop the reference (core parseFontReference precedent).
|
|
7044
|
+
*/
|
|
7045
|
+
function parseFontRef(el, ctx) {
|
|
7046
|
+
const idx = attr(el, "idx");
|
|
7047
|
+
if (idx !== "major" && idx !== "minor" && idx !== "none") return void 0;
|
|
7048
|
+
const result = { collection: idx };
|
|
7072
7049
|
const color = parseColorChoice(el, ctx);
|
|
7073
7050
|
if (color && Object.keys(color).length > 0) result.color = color;
|
|
7074
7051
|
return result;
|
|
7075
7052
|
}
|
|
7076
7053
|
/**
|
|
7077
7054
|
* Parse a wps:style (CT_ShapeStyle): line/fill/effect/font references into the
|
|
7078
|
-
* document theme. Delegates color to the shared core
|
|
7055
|
+
* document theme. Delegates color to the shared core parseColorChoice.
|
|
7079
7056
|
*/
|
|
7080
7057
|
function parseShapeStyle(styleEl, ctx) {
|
|
7081
7058
|
const result = {};
|
|
@@ -7086,7 +7063,7 @@ function parseShapeStyle(styleEl, ctx) {
|
|
|
7086
7063
|
const effectRef = findChild(styleEl, "a:effectRef");
|
|
7087
7064
|
if (effectRef) result.effectReference = parseStyleRef(effectRef, ctx);
|
|
7088
7065
|
const fontRef = findChild(styleEl, "a:fontRef");
|
|
7089
|
-
if (fontRef) result.fontReference =
|
|
7066
|
+
if (fontRef) result.fontReference = parseFontRef(fontRef, ctx);
|
|
7090
7067
|
return result;
|
|
7091
7068
|
}
|
|
7092
7069
|
/**
|
|
@@ -7161,7 +7138,7 @@ function parseWpsShapeCore(wspEl, ctx) {
|
|
|
7161
7138
|
const custGeom = findChild(spPr, "a:custGeom");
|
|
7162
7139
|
if (custGeom) result.customGeometry = customGeometryDesc.parse(custGeom, ctx);
|
|
7163
7140
|
const prstGeom = findChild(spPr, "a:prstGeom");
|
|
7164
|
-
if (prstGeom) result.
|
|
7141
|
+
if (prstGeom) result.geometry = presetGeometryDesc.parse(prstGeom, ctx);
|
|
7165
7142
|
const scene3d = findChild(spPr, "a:scene3d");
|
|
7166
7143
|
if (scene3d) result.scene3d = scene3DDesc.parse(scene3d, ctx);
|
|
7167
7144
|
const sp3d = findChild(spPr, "a:sp3d");
|
|
@@ -7224,12 +7201,8 @@ function readChildTransformation(spPr) {
|
|
|
7224
7201
|
}
|
|
7225
7202
|
const flipH = attrBool(xfrm, "flipH");
|
|
7226
7203
|
const flipV = attrBool(xfrm, "flipV");
|
|
7227
|
-
if (flipH !== void 0
|
|
7228
|
-
|
|
7229
|
-
if (flipH !== void 0) flip.horizontal = flipH;
|
|
7230
|
-
if (flipV !== void 0) flip.vertical = flipV;
|
|
7231
|
-
result.flip = flip;
|
|
7232
|
-
}
|
|
7204
|
+
if (flipH !== void 0) result.flipHorizontal = flipH;
|
|
7205
|
+
if (flipV !== void 0) result.flipVertical = flipV;
|
|
7233
7206
|
const rot = attrNum(xfrm, "rot");
|
|
7234
7207
|
if (rot !== void 0) result.rotation = rot;
|
|
7235
7208
|
return result;
|
|
@@ -7375,7 +7348,7 @@ function parseWpgGroupDrawing(el, ctx) {
|
|
|
7375
7348
|
if (!wgp) return void 0;
|
|
7376
7349
|
const info = parseAnchorOrInline(el, ctx) ?? {};
|
|
7377
7350
|
const grpSpPr = findChild(wgp, "wpg:grpSpPr");
|
|
7378
|
-
const {
|
|
7351
|
+
const { childOffsetX, childOffsetY, childExtentWidth, childExtentHeight } = readGroupCoords(grpSpPr);
|
|
7379
7352
|
const group = {
|
|
7380
7353
|
children: parseGroupChildren(wgp, ctx),
|
|
7381
7354
|
transformation: {
|
|
@@ -7384,8 +7357,10 @@ function parseWpgGroupDrawing(el, ctx) {
|
|
|
7384
7357
|
...info.effectExtent ? { effectExtent: info.effectExtent } : {}
|
|
7385
7358
|
}
|
|
7386
7359
|
};
|
|
7387
|
-
if (
|
|
7388
|
-
if (
|
|
7360
|
+
if (childOffsetX !== void 0) group.childOffsetX = childOffsetX;
|
|
7361
|
+
if (childOffsetY !== void 0) group.childOffsetY = childOffsetY;
|
|
7362
|
+
if (childExtentWidth !== void 0) group.childExtentWidth = childExtentWidth;
|
|
7363
|
+
if (childExtentHeight !== void 0) group.childExtentHeight = childExtentHeight;
|
|
7389
7364
|
if (info.floating) group.floating = info.floating;
|
|
7390
7365
|
if (info.altText) group.altText = info.altText;
|
|
7391
7366
|
if (info.graphicFrameLocks !== void 0) group.graphicFrameLocks = info.graphicFrameLocks;
|
|
@@ -7407,22 +7382,18 @@ function readGroupCoords(grpSpPr) {
|
|
|
7407
7382
|
if (!grpSpPr) return {};
|
|
7408
7383
|
const xfrm = findChild(grpSpPr, "a:xfrm");
|
|
7409
7384
|
if (!xfrm) return {};
|
|
7410
|
-
|
|
7411
|
-
let childExtent;
|
|
7385
|
+
const result = {};
|
|
7412
7386
|
const off = findChild(xfrm, "a:chOff");
|
|
7413
|
-
if (off?.attributes)
|
|
7414
|
-
|
|
7415
|
-
|
|
7416
|
-
}
|
|
7387
|
+
if (off?.attributes) {
|
|
7388
|
+
result.childOffsetX = Number(off.attributes["x"] ?? 0);
|
|
7389
|
+
result.childOffsetY = Number(off.attributes["y"] ?? 0);
|
|
7390
|
+
}
|
|
7417
7391
|
const ext = findChild(xfrm, "a:chExt");
|
|
7418
|
-
if (ext?.attributes)
|
|
7419
|
-
|
|
7420
|
-
|
|
7421
|
-
}
|
|
7422
|
-
return
|
|
7423
|
-
childOffset,
|
|
7424
|
-
childExtent
|
|
7425
|
-
};
|
|
7392
|
+
if (ext?.attributes) {
|
|
7393
|
+
result.childExtentWidth = Number(ext.attributes["cx"] ?? 0);
|
|
7394
|
+
result.childExtentHeight = Number(ext.attributes["cy"] ?? 0);
|
|
7395
|
+
}
|
|
7396
|
+
return result;
|
|
7426
7397
|
}
|
|
7427
7398
|
/**
|
|
7428
7399
|
* Parse the children of a group element (CT_WordprocessingGroup choice):
|
|
@@ -7561,14 +7532,16 @@ function parseContentPart(el) {
|
|
|
7561
7532
|
*/
|
|
7562
7533
|
function parseNestedGroup(grpSpEl, ctx) {
|
|
7563
7534
|
const grpSpPr = findChild(grpSpEl, "wpg:grpSpPr");
|
|
7564
|
-
const {
|
|
7535
|
+
const { childOffsetX, childOffsetY, childExtentWidth, childExtentHeight } = readGroupCoords(grpSpPr);
|
|
7565
7536
|
const result = {
|
|
7566
7537
|
type: "wpg",
|
|
7567
7538
|
transformation: readChildTransformation(grpSpPr),
|
|
7568
7539
|
children: parseGroupChildren(grpSpEl, ctx)
|
|
7569
7540
|
};
|
|
7570
|
-
if (
|
|
7571
|
-
if (
|
|
7541
|
+
if (childOffsetX !== void 0) result.childOffsetX = childOffsetX;
|
|
7542
|
+
if (childOffsetY !== void 0) result.childOffsetY = childOffsetY;
|
|
7543
|
+
if (childExtentWidth !== void 0) result.childExtentWidth = childExtentWidth;
|
|
7544
|
+
if (childExtentHeight !== void 0) result.childExtentHeight = childExtentHeight;
|
|
7572
7545
|
const grpSpLocks = readGrpSpLocks(findChild(grpSpEl, "wpg:cNvGrpSpPr"));
|
|
7573
7546
|
if (grpSpLocks) result.groupShapeLocks = grpSpLocks;
|
|
7574
7547
|
if (grpSpPr) {
|
|
@@ -7958,6 +7931,7 @@ function stringifyBlipFill(mediaData, blipEffects, tile, ctx) {
|
|
|
7958
7931
|
const parts = [];
|
|
7959
7932
|
const blipAttrs = [];
|
|
7960
7933
|
if (fileName !== void 0) blipAttrs.push(`r:embed="{${escapeXml(fileName)}}"`);
|
|
7934
|
+
if (mediaData.compression !== void 0) blipAttrs.push(`cstate="${escapeXml(mediaData.compression)}"`);
|
|
7961
7935
|
if (mediaData.sourceUrl !== void 0 && ctx) {
|
|
7962
7936
|
const linkId = ctx.viewWrapper.relationships.add(IMAGE_REL, mediaData.sourceUrl, TargetModeType.EXTERNAL);
|
|
7963
7937
|
blipAttrs.push(`r:link="rId${linkId}"`);
|
|
@@ -7989,8 +7963,8 @@ function stringifyShapeProps(transform, outline, fill, effects, scene3d, shape3d
|
|
|
7989
7963
|
y: transform.offset?.emus?.y ?? 0,
|
|
7990
7964
|
width: transform.emus.x,
|
|
7991
7965
|
height: transform.emus.y,
|
|
7992
|
-
flipHorizontal: transform.
|
|
7993
|
-
flipVertical: transform.
|
|
7966
|
+
flipHorizontal: transform.flipHorizontal,
|
|
7967
|
+
flipVertical: transform.flipVertical,
|
|
7994
7968
|
rotation: transform.rotation,
|
|
7995
7969
|
geometry: "rect",
|
|
7996
7970
|
fill,
|
|
@@ -8032,11 +8006,11 @@ function stringifyWpsShape(opts, ctx) {
|
|
|
8032
8006
|
y: transform.offset?.emus?.y ?? 0,
|
|
8033
8007
|
width: transform.emus.x,
|
|
8034
8008
|
height: transform.emus.y,
|
|
8035
|
-
flipHorizontal: transform.
|
|
8036
|
-
flipVertical: transform.
|
|
8009
|
+
flipHorizontal: transform.flipHorizontal,
|
|
8010
|
+
flipVertical: transform.flipVertical,
|
|
8037
8011
|
rotation: transform.rotation,
|
|
8038
8012
|
customGeometry: opts.customGeometry,
|
|
8039
|
-
geometry: opts.customGeometry ? void 0 : opts.
|
|
8013
|
+
geometry: opts.customGeometry ? void 0 : opts.geometry ?? "rect",
|
|
8040
8014
|
fill: opts.fill,
|
|
8041
8015
|
outline: opts.outline,
|
|
8042
8016
|
effectDag: opts.effectDag,
|
|
@@ -8085,14 +8059,20 @@ function stringifyNonVisualShapeProperties(opts) {
|
|
|
8085
8059
|
/** Stringify a single style-matrix reference (a:lnRef/a:fillRef/...). */
|
|
8086
8060
|
function stringifyStyleRef(name, ref) {
|
|
8087
8061
|
if (!ref) return "";
|
|
8088
|
-
const idx = escapeXml(ref.idx);
|
|
8089
8062
|
const colorXml = ref.color ? createColorElement(ref.color) : "";
|
|
8090
|
-
if (colorXml) return `<${name} idx="${
|
|
8091
|
-
return `<${name} idx="${
|
|
8063
|
+
if (colorXml) return `<${name} idx="${ref.index}">${colorXml}</${name}>`;
|
|
8064
|
+
return `<${name} idx="${ref.index}"/>`;
|
|
8065
|
+
}
|
|
8066
|
+
/** Stringify a:fontRef — @idx is ST_FontCollectionIndex, not a number. */
|
|
8067
|
+
function stringifyFontRef(ref) {
|
|
8068
|
+
if (!ref) return "";
|
|
8069
|
+
const colorXml = ref.color ? createColorElement(ref.color) : "";
|
|
8070
|
+
if (colorXml) return `<a:fontRef idx="${escapeXml(ref.collection)}">${colorXml}</a:fontRef>`;
|
|
8071
|
+
return `<a:fontRef idx="${escapeXml(ref.collection)}"/>`;
|
|
8092
8072
|
}
|
|
8093
8073
|
/** Stringify a wps:style (CT_ShapeStyle): lnRef/fillRef/effectRef/fontRef. */
|
|
8094
8074
|
function stringifyShapeStyle(opts) {
|
|
8095
|
-
const inner = stringifyStyleRef("a:lnRef", opts.lineReference) + stringifyStyleRef("a:fillRef", opts.fillReference) + stringifyStyleRef("a:effectRef", opts.effectReference) +
|
|
8075
|
+
const inner = stringifyStyleRef("a:lnRef", opts.lineReference) + stringifyStyleRef("a:fillRef", opts.fillReference) + stringifyStyleRef("a:effectRef", opts.effectReference) + stringifyFontRef(opts.fontReference);
|
|
8096
8076
|
return inner ? `<wps:style>${inner}</wps:style>` : "";
|
|
8097
8077
|
}
|
|
8098
8078
|
function stringifyBodyPr(opts) {
|
|
@@ -8105,13 +8085,13 @@ function stringifyWpgGroup(opts, ctx) {
|
|
|
8105
8085
|
y: transform.offset?.emus?.y ?? 0,
|
|
8106
8086
|
width: transform.emus.x,
|
|
8107
8087
|
height: transform.emus.y,
|
|
8108
|
-
flipHorizontal: transform.
|
|
8109
|
-
flipVertical: transform.
|
|
8088
|
+
flipHorizontal: transform.flipHorizontal,
|
|
8089
|
+
flipVertical: transform.flipVertical,
|
|
8110
8090
|
rotation: transform.rotation,
|
|
8111
|
-
childOffsetX: opts.
|
|
8112
|
-
childOffsetY: opts.
|
|
8113
|
-
childExtentWidth: opts.
|
|
8114
|
-
childExtentHeight: opts.
|
|
8091
|
+
childOffsetX: opts.childOffsetX,
|
|
8092
|
+
childOffsetY: opts.childOffsetY,
|
|
8093
|
+
childExtentWidth: opts.childExtentWidth,
|
|
8094
|
+
childExtentHeight: opts.childExtentHeight,
|
|
8115
8095
|
fill: opts.fill,
|
|
8116
8096
|
effects: opts.effects
|
|
8117
8097
|
}, ctx) ?? "";
|
|
@@ -8187,7 +8167,7 @@ function stringifyCnvFrPr(locks) {
|
|
|
8187
8167
|
function stringifyChildXfrm(prefix, t) {
|
|
8188
8168
|
const x = t.offset?.emus?.x ?? 0;
|
|
8189
8169
|
const y = t.offset?.emus?.y ?? 0;
|
|
8190
|
-
return `<${prefix}:xfrm${(t.
|
|
8170
|
+
return `<${prefix}:xfrm${(t.flipHorizontal ? " flipH=\"1\"" : "") + (t.flipVertical ? " flipV=\"1\"" : "")}${t.rotation !== void 0 ? ` rot="${t.rotation}"` : ""}><a:off x="${x}" y="${y}"/><a:ext cx="${t.emus.x}" cy="${t.emus.y}"/></${prefix}:xfrm>`;
|
|
8191
8171
|
}
|
|
8192
8172
|
/**
|
|
8193
8173
|
* Stringify a wpg:contentPart child (CT_WordprocessingContentPart) inside a
|
|
@@ -8213,13 +8193,13 @@ function stringifyNestedGroup(grp, ctx) {
|
|
|
8213
8193
|
y: grp.transformation.offset?.emus?.y ?? 0,
|
|
8214
8194
|
width: grp.transformation.emus.x,
|
|
8215
8195
|
height: grp.transformation.emus.y,
|
|
8216
|
-
flipHorizontal: grp.transformation.
|
|
8217
|
-
flipVertical: grp.transformation.
|
|
8196
|
+
flipHorizontal: grp.transformation.flipHorizontal,
|
|
8197
|
+
flipVertical: grp.transformation.flipVertical,
|
|
8218
8198
|
rotation: grp.transformation.rotation,
|
|
8219
|
-
childOffsetX: grp.
|
|
8220
|
-
childOffsetY: grp.
|
|
8221
|
-
childExtentWidth: grp.
|
|
8222
|
-
childExtentHeight: grp.
|
|
8199
|
+
childOffsetX: grp.childOffsetX,
|
|
8200
|
+
childOffsetY: grp.childOffsetY,
|
|
8201
|
+
childExtentWidth: grp.childExtentWidth,
|
|
8202
|
+
childExtentHeight: grp.childExtentHeight,
|
|
8223
8203
|
fill: grp.fill,
|
|
8224
8204
|
effects: grp.effects
|
|
8225
8205
|
}, ctx) ?? "";
|
|
@@ -8248,8 +8228,10 @@ function stringifyGraphicDataContent(mediaData, opts, hlIds, ctx) {
|
|
|
8248
8228
|
const wpgXml = stringifyWpgGroup({
|
|
8249
8229
|
children: md.children,
|
|
8250
8230
|
transformation: transform,
|
|
8251
|
-
|
|
8252
|
-
|
|
8231
|
+
childOffsetX: md.childOffsetX,
|
|
8232
|
+
childOffsetY: md.childOffsetY,
|
|
8233
|
+
childExtentWidth: md.childExtentWidth,
|
|
8234
|
+
childExtentHeight: md.childExtentHeight,
|
|
8253
8235
|
fill: md.fill,
|
|
8254
8236
|
effects: md.effects,
|
|
8255
8237
|
groupShapeLocks: md.groupShapeLocks
|
|
@@ -8938,7 +8920,8 @@ function stringifyChildDispatch(child, ctx) {
|
|
|
8938
8920
|
transformation: createTransformation(opts.transformation),
|
|
8939
8921
|
sourceRectangle: opts.sourceRectangle,
|
|
8940
8922
|
nonVisualProperties: opts.nonVisualProperties,
|
|
8941
|
-
useLocalDpi: opts.useLocalDpi
|
|
8923
|
+
useLocalDpi: opts.useLocalDpi,
|
|
8924
|
+
compression: opts.compression
|
|
8942
8925
|
},
|
|
8943
8926
|
docProperties: opts.altText,
|
|
8944
8927
|
floating: opts.floating,
|
|
@@ -8964,6 +8947,7 @@ function stringifyChildDispatch(child, ctx) {
|
|
|
8964
8947
|
type: "svg",
|
|
8965
8948
|
...createPictureData(rawData, opts.transformation, fileName, opts.sourceRectangle, opts.nonVisualProperties),
|
|
8966
8949
|
useLocalDpi: opts.useLocalDpi,
|
|
8950
|
+
compression: opts.compression,
|
|
8967
8951
|
fallback
|
|
8968
8952
|
}), opts.fileName);
|
|
8969
8953
|
} else {
|
|
@@ -8972,6 +8956,7 @@ function stringifyChildDispatch(child, ctx) {
|
|
|
8972
8956
|
type,
|
|
8973
8957
|
...createPictureData(rawData, opts.transformation, fileName, opts.sourceRectangle, opts.nonVisualProperties),
|
|
8974
8958
|
useLocalDpi: opts.useLocalDpi,
|
|
8959
|
+
compression: opts.compression,
|
|
8975
8960
|
sourceUrl: opts.sourceUrl
|
|
8976
8961
|
}), opts.fileName);
|
|
8977
8962
|
}
|
|
@@ -9099,8 +9084,10 @@ function stringifyChildDispatch(child, ctx) {
|
|
|
9099
9084
|
const mediaData = {
|
|
9100
9085
|
children: opts.children,
|
|
9101
9086
|
transformation: createTransformation(opts.transformation),
|
|
9102
|
-
|
|
9103
|
-
|
|
9087
|
+
childOffsetX: opts.childOffsetX,
|
|
9088
|
+
childOffsetY: opts.childOffsetY,
|
|
9089
|
+
childExtentWidth: opts.childExtentWidth,
|
|
9090
|
+
childExtentHeight: opts.childExtentHeight,
|
|
9104
9091
|
fill: opts.fill,
|
|
9105
9092
|
effects: opts.effects,
|
|
9106
9093
|
groupShapeLocks: opts.groupShapeLocks,
|
|
@@ -10524,7 +10511,7 @@ function parseTableRowEl(el, ctx) {
|
|
|
10524
10511
|
const xmlPr = findChild(child, "w:customXmlPr");
|
|
10525
10512
|
if (xmlPr) {
|
|
10526
10513
|
const parsed = parseCustomXmlProperties(xmlPr);
|
|
10527
|
-
if (parsed.placeholder !== void 0 || parsed.attributes !== void 0) cx.
|
|
10514
|
+
if (parsed.placeholder !== void 0 || parsed.attributes !== void 0) cx.properties = parsed;
|
|
10528
10515
|
}
|
|
10529
10516
|
const cxCells = [];
|
|
10530
10517
|
for (const sub of child.elements ?? []) if (sub.name === "w:tc") cxCells.push(parseTableCellEl(sub, ctx));
|
|
@@ -10577,7 +10564,7 @@ function parseTableEl(el, ctx) {
|
|
|
10577
10564
|
const xmlPr = findChild(child, "w:customXmlPr");
|
|
10578
10565
|
if (xmlPr) {
|
|
10579
10566
|
const parsed = parseCustomXmlProperties(xmlPr);
|
|
10580
|
-
if (parsed.placeholder !== void 0 || parsed.attributes !== void 0) cx.
|
|
10567
|
+
if (parsed.placeholder !== void 0 || parsed.attributes !== void 0) cx.properties = parsed;
|
|
10581
10568
|
}
|
|
10582
10569
|
const cxRows = [];
|
|
10583
10570
|
for (const sub of child.elements ?? []) if (sub.name === "w:tr") cxRows.push(parseTableRowEl(sub, ctx));
|
|
@@ -13983,7 +13970,7 @@ function parseCustomXmlBlock(el, ctx, parseChild) {
|
|
|
13983
13970
|
const uri = attr(el, "w:uri");
|
|
13984
13971
|
if (uri) opts.uri = uri;
|
|
13985
13972
|
const xmlPr = findChild(el, "w:customXmlPr");
|
|
13986
|
-
if (xmlPr) opts.
|
|
13973
|
+
if (xmlPr) opts.properties = parseCustomXmlProperties(xmlPr);
|
|
13987
13974
|
const children = [];
|
|
13988
13975
|
for (const child of el.elements ?? []) {
|
|
13989
13976
|
if (child.name === "w:customXmlPr") continue;
|
|
@@ -15665,6 +15652,8 @@ const bibliographyDesc = {
|
|
|
15665
15652
|
/** Gallery type for building blocks (ST_DocPartGallery) */
|
|
15666
15653
|
const DocPartGallery = {
|
|
15667
15654
|
PLACEHOLDER: "placeholder",
|
|
15655
|
+
/** Matches any gallery — used by docPartObj references without a specific gallery. */
|
|
15656
|
+
ANY: "any",
|
|
15668
15657
|
DEFAULT: "default",
|
|
15669
15658
|
DOC_PARTS: "docParts",
|
|
15670
15659
|
COVER_PAGE: "coverPg",
|