@office-open/docx 0.9.5 → 0.9.6
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/{context-CSBntKXD.mjs → context-DfxK5XnG.mjs} +2 -2
- package/dist/{context-CSBntKXD.mjs.map → context-DfxK5XnG.mjs.map} +1 -1
- package/dist/{core-properties-BMagGcpC.d.mts → core-properties-DMRyJWDp.d.mts} +240 -228
- package/dist/core-properties-DMRyJWDp.d.mts.map +1 -0
- package/dist/{document-DYH7tGnw.mjs → document-D2OTVcbX.mjs} +308 -172
- package/dist/document-D2OTVcbX.mjs.map +1 -0
- package/dist/{generate-BVfOLdwW.mjs → generate-B2i9hUSF.mjs} +3 -3
- package/dist/{generate-BVfOLdwW.mjs.map → generate-B2i9hUSF.mjs.map} +1 -1
- package/dist/generate.d.mts +1 -1
- package/dist/generate.mjs +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +4 -4
- package/dist/{parse-Db2NGghB.mjs → parse-DqXV5xqQ.mjs} +3 -3
- package/dist/{parse-Db2NGghB.mjs.map → parse-DqXV5xqQ.mjs.map} +1 -1
- package/dist/parse.d.mts +1 -1
- package/dist/parse.mjs +1 -1
- package/dist/patch/index.d.mts +1 -1
- package/dist/patch/index.mjs +1 -1
- package/package.json +3 -3
- package/dist/core-properties-BMagGcpC.d.mts.map +0 -1
- package/dist/document-DYH7tGnw.mjs.map +0 -1
|
@@ -796,7 +796,7 @@ function parseRunProperties(el) {
|
|
|
796
796
|
const bdr = findChild(el, "w:bdr");
|
|
797
797
|
if (bdr) opts.border = parseBorder(bdr);
|
|
798
798
|
const shd = findChild(el, "w:shd");
|
|
799
|
-
if (shd) opts.shading = parseShading(shd);
|
|
799
|
+
if (shd) opts.shading = parseShading$1(shd);
|
|
800
800
|
const eastAsianLayout = findChild(el, "w:eastAsianLayout");
|
|
801
801
|
if (eastAsianLayout) opts.eastAsianLayout = parseEastAsianLayout(eastAsianLayout);
|
|
802
802
|
const contentPart = findChild(el, "w:contentPart");
|
|
@@ -841,7 +841,7 @@ function parseBorder(el) {
|
|
|
841
841
|
/**
|
|
842
842
|
* Parse a w:shd element into ShadingAttributesProperties.
|
|
843
843
|
*/
|
|
844
|
-
function parseShading(el) {
|
|
844
|
+
function parseShading$1(el) {
|
|
845
845
|
const opts = {};
|
|
846
846
|
const fill = colorAttr(el, "w:fill");
|
|
847
847
|
if (fill) opts.fill = fill;
|
|
@@ -1171,7 +1171,7 @@ function tabStopsStr(defs) {
|
|
|
1171
1171
|
})}/>`;
|
|
1172
1172
|
}).join("")}</w:tabs>`;
|
|
1173
1173
|
}
|
|
1174
|
-
function cnfStyleStr(opts) {
|
|
1174
|
+
function cnfStyleStr$1(opts) {
|
|
1175
1175
|
return `<w:cnfStyle ${attrParts({
|
|
1176
1176
|
"w:firstRow": opts.firstRow ? "1" : "0",
|
|
1177
1177
|
"w:lastRow": opts.lastRow ? "1" : "0",
|
|
@@ -1347,7 +1347,7 @@ function stringifyParagraphProperties(options) {
|
|
|
1347
1347
|
if (options.alignment) parts.push(`<w:jc w:val="${options.alignment}"/>`);
|
|
1348
1348
|
if (options.outlineLevel !== void 0) parts.push(`<w:outlineLvl w:val="${options.outlineLevel}"/>`);
|
|
1349
1349
|
if (options.divId !== void 0) parts.push(`<w:divId w:val="${options.divId}"/>`);
|
|
1350
|
-
if (options.cnfStyle) parts.push(cnfStyleStr(options.cnfStyle));
|
|
1350
|
+
if (options.cnfStyle) parts.push(cnfStyleStr$1(options.cnfStyle));
|
|
1351
1351
|
if (options.suppressLineNumbers !== void 0) parts.push(onOff("w:suppressLineNumbers", options.suppressLineNumbers));
|
|
1352
1352
|
if (options.autoSpaceEastAsianText !== void 0) parts.push(onOff("w:autoSpaceDN", options.autoSpaceEastAsianText));
|
|
1353
1353
|
if (options.suppressAutoHyphens !== void 0) parts.push(onOff("w:suppressAutoHyphens", options.suppressAutoHyphens));
|
|
@@ -4249,24 +4249,20 @@ function tableWidthStr(name, opts) {
|
|
|
4249
4249
|
})}/>`;
|
|
4250
4250
|
}
|
|
4251
4251
|
function cellMarginChildrenStr(opts) {
|
|
4252
|
-
const unitType = opts.marginUnitType ?? WidthType.DXA;
|
|
4253
4252
|
const parts = [];
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
size: opts.right,
|
|
4268
|
-
type: unitType
|
|
4269
|
-
}));
|
|
4253
|
+
const side = (name, w) => {
|
|
4254
|
+
if (w === void 0) return;
|
|
4255
|
+
parts.push(tableWidthStr(name, {
|
|
4256
|
+
size: w.size,
|
|
4257
|
+
type: w.type ?? WidthType.DXA
|
|
4258
|
+
}));
|
|
4259
|
+
};
|
|
4260
|
+
side("w:top", opts.top);
|
|
4261
|
+
side("w:start", opts.start);
|
|
4262
|
+
side("w:left", opts.left);
|
|
4263
|
+
side("w:bottom", opts.bottom);
|
|
4264
|
+
side("w:end", opts.end);
|
|
4265
|
+
side("w:right", opts.right);
|
|
4270
4266
|
return parts.join("");
|
|
4271
4267
|
}
|
|
4272
4268
|
function cellMarginStr(tag, opts) {
|
|
@@ -4291,6 +4287,8 @@ function cellBordersStr(opts) {
|
|
|
4291
4287
|
if (opts.bottom) parts.push(borderStr("w:bottom", opts.bottom));
|
|
4292
4288
|
if (opts.end) parts.push(borderStr("w:end", opts.end));
|
|
4293
4289
|
if (opts.right) parts.push(borderStr("w:right", opts.right));
|
|
4290
|
+
if (opts.insideHorizontal) parts.push(borderStr("w:insideH", opts.insideHorizontal));
|
|
4291
|
+
if (opts.insideVertical) parts.push(borderStr("w:insideV", opts.insideVertical));
|
|
4294
4292
|
if (opts.topLeftToBottomRight) parts.push(borderStr("w:tl2br", opts.topLeftToBottomRight));
|
|
4295
4293
|
if (opts.topRightToBottomLeft) parts.push(borderStr("w:tr2bl", opts.topRightToBottomLeft));
|
|
4296
4294
|
return parts.length > 0 ? `<w:tcBorders>${parts.join("")}</w:tcBorders>` : void 0;
|
|
@@ -4319,6 +4317,23 @@ function tableLookStr(opts) {
|
|
|
4319
4317
|
"w:noVBand": opts.noVBand
|
|
4320
4318
|
})}/>`;
|
|
4321
4319
|
}
|
|
4320
|
+
function cnfStyleStr(opts) {
|
|
4321
|
+
return `<w:cnfStyle ${attrParts({
|
|
4322
|
+
"w:val": opts.val,
|
|
4323
|
+
"w:firstRow": opts.firstRow,
|
|
4324
|
+
"w:lastRow": opts.lastRow,
|
|
4325
|
+
"w:firstColumn": opts.firstColumn,
|
|
4326
|
+
"w:lastColumn": opts.lastColumn,
|
|
4327
|
+
"w:oddVBand": opts.oddVBand,
|
|
4328
|
+
"w:evenVBand": opts.evenVBand,
|
|
4329
|
+
"w:oddHBand": opts.oddHBand,
|
|
4330
|
+
"w:evenHBand": opts.evenHBand,
|
|
4331
|
+
"w:firstRowFirstColumn": opts.firstRowFirstColumn,
|
|
4332
|
+
"w:firstRowLastColumn": opts.firstRowLastColumn,
|
|
4333
|
+
"w:lastRowFirstColumn": opts.lastRowFirstColumn,
|
|
4334
|
+
"w:lastRowLastColumn": opts.lastRowLastColumn
|
|
4335
|
+
})}/>`;
|
|
4336
|
+
}
|
|
4322
4337
|
function changeAttrStr(tag, opts) {
|
|
4323
4338
|
return `<${tag} ${attrParts({
|
|
4324
4339
|
"w:author": opts.author,
|
|
@@ -4339,7 +4354,7 @@ function cellMergeStr(opts) {
|
|
|
4339
4354
|
function cellSpacingStr(opts) {
|
|
4340
4355
|
return `<w:tblCellSpacing ${attrParts({
|
|
4341
4356
|
"w:type": opts.type,
|
|
4342
|
-
"w:w": measurementOrPercentValue(opts.
|
|
4357
|
+
"w:w": measurementOrPercentValue(opts.size)
|
|
4343
4358
|
})}/>`;
|
|
4344
4359
|
}
|
|
4345
4360
|
function stringifyTablePropertiesChangeInner(options) {
|
|
@@ -4365,6 +4380,7 @@ function stringifyTablePropertiesInner(options) {
|
|
|
4365
4380
|
if (options.styleColBandSize !== void 0) parts.push(`<w:tblStyleColBandSize w:val="${options.styleColBandSize}"/>`);
|
|
4366
4381
|
if (options.width) parts.push(tableWidthStr("w:tblW", options.width));
|
|
4367
4382
|
if (options.alignment) parts.push(`<w:jc w:val="${options.alignment}"/>`);
|
|
4383
|
+
if (options.cellSpacing) parts.push(cellSpacingStr(options.cellSpacing));
|
|
4368
4384
|
if (options.indent) parts.push(tableWidthStr("w:tblInd", options.indent));
|
|
4369
4385
|
if (options.borders) {
|
|
4370
4386
|
const bs = tableBordersStr(options.borders);
|
|
@@ -4377,7 +4393,6 @@ function stringifyTablePropertiesInner(options) {
|
|
|
4377
4393
|
if (cm) parts.push(cm);
|
|
4378
4394
|
}
|
|
4379
4395
|
if (options.tableLook) parts.push(tableLookStr(options.tableLook));
|
|
4380
|
-
if (options.cellSpacing) parts.push(cellSpacingStr(options.cellSpacing));
|
|
4381
4396
|
if (options.caption !== void 0) parts.push(`<w:tblCaption w:val="${options.caption}"/>`);
|
|
4382
4397
|
if (options.description !== void 0) parts.push(`<w:tblDescription w:val="${options.description}"/>`);
|
|
4383
4398
|
if (options.revision) parts.push(stringifyTablePropertiesChangeInner(options.revision));
|
|
@@ -4400,13 +4415,7 @@ function stringifyTableRowPropertiesChangeInner(options) {
|
|
|
4400
4415
|
}
|
|
4401
4416
|
function stringifyTableRowPropertiesInner(options) {
|
|
4402
4417
|
const parts = [];
|
|
4403
|
-
if (options.cnfStyle !== void 0)
|
|
4404
|
-
const a = attrParts({
|
|
4405
|
-
"w:val": options.cnfStyle.val,
|
|
4406
|
-
"w:changed": options.cnfStyle.changed
|
|
4407
|
-
});
|
|
4408
|
-
parts.push(`<w:cnfStyle ${a}/>`);
|
|
4409
|
-
}
|
|
4418
|
+
if (options.cnfStyle !== void 0) parts.push(cnfStyleStr(options.cnfStyle));
|
|
4410
4419
|
if (options.divId !== void 0) parts.push(`<w:divId w:val="${options.divId}"/>`);
|
|
4411
4420
|
if (options.gridBefore !== void 0) parts.push(`<w:gridBefore w:val="${options.gridBefore}"/>`);
|
|
4412
4421
|
if (options.gridAfter !== void 0) parts.push(`<w:gridAfter w:val="${options.gridAfter}"/>`);
|
|
@@ -4446,15 +4455,11 @@ function stringifyTableCellPropertiesChangeInner(options) {
|
|
|
4446
4455
|
}
|
|
4447
4456
|
function stringifyTableCellPropertiesInner(options) {
|
|
4448
4457
|
const parts = [];
|
|
4449
|
-
if (options.cnfStyle !== void 0)
|
|
4450
|
-
const a = attrParts({
|
|
4451
|
-
"w:val": options.cnfStyle.val,
|
|
4452
|
-
"w:changed": options.cnfStyle.changed
|
|
4453
|
-
});
|
|
4454
|
-
parts.push(`<w:cnfStyle ${a}/>`);
|
|
4455
|
-
}
|
|
4458
|
+
if (options.cnfStyle !== void 0) parts.push(cnfStyleStr(options.cnfStyle));
|
|
4456
4459
|
if (options.width) parts.push(tableWidthStr("w:tcW", options.width));
|
|
4457
4460
|
if (options.columnSpan) parts.push(`<w:gridSpan w:val="${options.columnSpan}"/>`);
|
|
4461
|
+
if (options.horizontalMerge !== void 0) if (options.horizontalMerge === "restart") parts.push(`<w:hMerge w:val="restart"/>`);
|
|
4462
|
+
else parts.push(`<w:hMerge/>`);
|
|
4458
4463
|
if (options.verticalMerge) parts.push(`<w:vMerge w:val="${options.verticalMerge}"/>`);
|
|
4459
4464
|
else if (options.rowSpan && options.rowSpan > 1) parts.push(`<w:vMerge w:val="${VerticalMergeType.RESTART}"/>`);
|
|
4460
4465
|
if (options.borders) {
|
|
@@ -4462,16 +4467,14 @@ function stringifyTableCellPropertiesInner(options) {
|
|
|
4462
4467
|
if (bs) parts.push(bs);
|
|
4463
4468
|
}
|
|
4464
4469
|
if (options.shading) parts.push(shadingStr(options.shading));
|
|
4470
|
+
if (options.noWrap !== void 0) parts.push(onOff("w:noWrap", options.noWrap));
|
|
4465
4471
|
if (options.margins) {
|
|
4466
4472
|
const cm = cellMarginStr("w:tcMar", options.margins);
|
|
4467
4473
|
if (cm) parts.push(cm);
|
|
4468
4474
|
}
|
|
4469
4475
|
if (options.textDirection) parts.push(`<w:textDirection w:val="${options.textDirection}"/>`);
|
|
4470
|
-
if (options.verticalAlign) parts.push(`<w:vAlign w:val="${options.verticalAlign}"/>`);
|
|
4471
|
-
if (options.horizontalMerge !== void 0) if (options.horizontalMerge === "restart") parts.push(`<w:hMerge w:val="restart"/>`);
|
|
4472
|
-
else parts.push(`<w:hMerge/>`);
|
|
4473
|
-
if (options.noWrap !== void 0) parts.push(onOff("w:noWrap", options.noWrap));
|
|
4474
4476
|
if (options.fitText !== void 0) parts.push(onOff("w:tcFitText", options.fitText));
|
|
4477
|
+
if (options.verticalAlign) parts.push(`<w:vAlign w:val="${options.verticalAlign}"/>`);
|
|
4475
4478
|
if (options.hideMark !== void 0) parts.push(onOff("w:hideMark", options.hideMark));
|
|
4476
4479
|
if (options.headers !== void 0) {
|
|
4477
4480
|
const headerParts = options.headers.map((h) => `<w:header w:val="${h}"/>`).join("");
|
|
@@ -4479,15 +4482,15 @@ function stringifyTableCellPropertiesInner(options) {
|
|
|
4479
4482
|
}
|
|
4480
4483
|
if (options.insertion) parts.push(changeAttrStr("w:cellIns", options.insertion));
|
|
4481
4484
|
if (options.deletion) parts.push(changeAttrStr("w:cellDel", options.deletion));
|
|
4482
|
-
if (options.revision) parts.push(stringifyTableCellPropertiesChangeInner(options.revision));
|
|
4483
4485
|
if (options.cellMerge) parts.push(cellMergeStr(options.cellMerge));
|
|
4486
|
+
if (options.revision) parts.push(stringifyTableCellPropertiesChangeInner(options.revision));
|
|
4484
4487
|
return parts.join("");
|
|
4485
4488
|
}
|
|
4486
4489
|
function stringifyTableCellProperties(options) {
|
|
4487
4490
|
const inner = stringifyTableCellPropertiesInner(options);
|
|
4488
4491
|
if (options.includeIfEmpty || inner) return `<w:tcPr>${inner}</w:tcPr>`;
|
|
4489
4492
|
}
|
|
4490
|
-
function
|
|
4493
|
+
function stringifyTablePropertyExceptionsInner(options) {
|
|
4491
4494
|
const parts = [];
|
|
4492
4495
|
if (options.width) parts.push(tableWidthStr("w:tblW", options.width));
|
|
4493
4496
|
if (options.alignment) parts.push(`<w:jc w:val="${options.alignment}"/>`);
|
|
@@ -4506,15 +4509,18 @@ function stringifyTablePropertyExceptions(options) {
|
|
|
4506
4509
|
if (options.tableLook) parts.push(tableLookStr(options.tableLook));
|
|
4507
4510
|
if (options.tblPrExChange) {
|
|
4508
4511
|
const change = options.tblPrExChange;
|
|
4509
|
-
const
|
|
4512
|
+
const a = attrParts({
|
|
4510
4513
|
"w:author": change.author,
|
|
4514
|
+
"w:date": change.date,
|
|
4511
4515
|
"w:id": change.id
|
|
4512
|
-
};
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
parts.push(`<w:tblPrExChange ${a}/>`);
|
|
4516
|
+
});
|
|
4517
|
+
const revInner = stringifyTablePropertyExceptionsInner(change);
|
|
4518
|
+
parts.push(`<w:tblPrExChange ${a}><w:tblPrEx>${revInner}</w:tblPrEx></w:tblPrExChange>`);
|
|
4516
4519
|
}
|
|
4517
|
-
return
|
|
4520
|
+
return parts.join("");
|
|
4521
|
+
}
|
|
4522
|
+
function stringifyTablePropertyExceptions(options) {
|
|
4523
|
+
return `<w:tblPrEx>${stringifyTablePropertyExceptionsInner(options)}</w:tblPrEx>`;
|
|
4518
4524
|
}
|
|
4519
4525
|
//#endregion
|
|
4520
4526
|
//#region src/parts/table/descriptor.ts
|
|
@@ -4654,6 +4660,137 @@ function computeVerticalMergeCells(rows) {
|
|
|
4654
4660
|
}
|
|
4655
4661
|
return extraMap;
|
|
4656
4662
|
}
|
|
4663
|
+
/** Parse a w:tblCellMar / w:tcMar container into TableCellMarginOptions. */
|
|
4664
|
+
function parseCellMargins(marginEl) {
|
|
4665
|
+
const margins = {};
|
|
4666
|
+
for (const side of [
|
|
4667
|
+
"top",
|
|
4668
|
+
"start",
|
|
4669
|
+
"left",
|
|
4670
|
+
"bottom",
|
|
4671
|
+
"end",
|
|
4672
|
+
"right"
|
|
4673
|
+
]) {
|
|
4674
|
+
const sideEl = findChild(marginEl, `w:${side}`);
|
|
4675
|
+
if (sideEl) {
|
|
4676
|
+
const size = attrNum(sideEl, "w:w");
|
|
4677
|
+
if (size !== void 0) {
|
|
4678
|
+
const type = attr(sideEl, "w:type");
|
|
4679
|
+
margins[side] = type ? {
|
|
4680
|
+
size,
|
|
4681
|
+
type
|
|
4682
|
+
} : { size };
|
|
4683
|
+
}
|
|
4684
|
+
}
|
|
4685
|
+
}
|
|
4686
|
+
if (Object.keys(margins).length === 0) return void 0;
|
|
4687
|
+
return margins;
|
|
4688
|
+
}
|
|
4689
|
+
/** Parse a w:shd (CT_Shd) element into ShadingAttributesProperties. */
|
|
4690
|
+
function parseShading(shd) {
|
|
4691
|
+
const shading = {};
|
|
4692
|
+
const fill = attr(shd, "w:fill");
|
|
4693
|
+
if (fill) shading.fill = fill;
|
|
4694
|
+
const color = attr(shd, "w:color");
|
|
4695
|
+
if (color) shading.color = color;
|
|
4696
|
+
const val = attr(shd, "w:val");
|
|
4697
|
+
if (val) shading.type = val;
|
|
4698
|
+
const themeColor = attr(shd, "w:themeColor");
|
|
4699
|
+
if (themeColor && THEME_COLORS.includes(themeColor)) shading.themeColor = themeColor;
|
|
4700
|
+
const themeTint = attr(shd, "w:themeTint");
|
|
4701
|
+
if (themeTint) shading.themeTint = themeTint;
|
|
4702
|
+
const themeShade = attr(shd, "w:themeShade");
|
|
4703
|
+
if (themeShade) shading.themeShade = themeShade;
|
|
4704
|
+
const themeFill = attr(shd, "w:themeFill");
|
|
4705
|
+
if (themeFill && THEME_COLORS.includes(themeFill)) shading.themeFill = themeFill;
|
|
4706
|
+
const themeFillTint = attr(shd, "w:themeFillTint");
|
|
4707
|
+
if (themeFillTint) shading.themeFillTint = themeFillTint;
|
|
4708
|
+
const themeFillShade = attr(shd, "w:themeFillShade");
|
|
4709
|
+
if (themeFillShade) shading.themeFillShade = themeFillShade;
|
|
4710
|
+
if (Object.keys(shading).length === 0) return void 0;
|
|
4711
|
+
return shading;
|
|
4712
|
+
}
|
|
4713
|
+
/** Parse a w:cnfStyle (CT_Cnf) element into CnfStyleOptions. */
|
|
4714
|
+
function parseCnfStyle(cnfEl) {
|
|
4715
|
+
const cnf = {};
|
|
4716
|
+
const val = attr(cnfEl, "w:val");
|
|
4717
|
+
if (val) cnf.val = val;
|
|
4718
|
+
const firstRow = attrBool(cnfEl, "w:firstRow");
|
|
4719
|
+
if (firstRow !== void 0) cnf.firstRow = firstRow;
|
|
4720
|
+
const lastRow = attrBool(cnfEl, "w:lastRow");
|
|
4721
|
+
if (lastRow !== void 0) cnf.lastRow = lastRow;
|
|
4722
|
+
const firstColumn = attrBool(cnfEl, "w:firstColumn");
|
|
4723
|
+
if (firstColumn !== void 0) cnf.firstColumn = firstColumn;
|
|
4724
|
+
const lastColumn = attrBool(cnfEl, "w:lastColumn");
|
|
4725
|
+
if (lastColumn !== void 0) cnf.lastColumn = lastColumn;
|
|
4726
|
+
const oddVBand = attrBool(cnfEl, "w:oddVBand");
|
|
4727
|
+
if (oddVBand !== void 0) cnf.oddVBand = oddVBand;
|
|
4728
|
+
const evenVBand = attrBool(cnfEl, "w:evenVBand");
|
|
4729
|
+
if (evenVBand !== void 0) cnf.evenVBand = evenVBand;
|
|
4730
|
+
const oddHBand = attrBool(cnfEl, "w:oddHBand");
|
|
4731
|
+
if (oddHBand !== void 0) cnf.oddHBand = oddHBand;
|
|
4732
|
+
const evenHBand = attrBool(cnfEl, "w:evenHBand");
|
|
4733
|
+
if (evenHBand !== void 0) cnf.evenHBand = evenHBand;
|
|
4734
|
+
const firstRowFirstColumn = attrBool(cnfEl, "w:firstRowFirstColumn");
|
|
4735
|
+
if (firstRowFirstColumn !== void 0) cnf.firstRowFirstColumn = firstRowFirstColumn;
|
|
4736
|
+
const firstRowLastColumn = attrBool(cnfEl, "w:firstRowLastColumn");
|
|
4737
|
+
if (firstRowLastColumn !== void 0) cnf.firstRowLastColumn = firstRowLastColumn;
|
|
4738
|
+
const lastRowFirstColumn = attrBool(cnfEl, "w:lastRowFirstColumn");
|
|
4739
|
+
if (lastRowFirstColumn !== void 0) cnf.lastRowFirstColumn = lastRowFirstColumn;
|
|
4740
|
+
const lastRowLastColumn = attrBool(cnfEl, "w:lastRowLastColumn");
|
|
4741
|
+
if (lastRowLastColumn !== void 0) cnf.lastRowLastColumn = lastRowLastColumn;
|
|
4742
|
+
if (Object.keys(cnf).length === 0) return void 0;
|
|
4743
|
+
return cnf;
|
|
4744
|
+
}
|
|
4745
|
+
/**
|
|
4746
|
+
* Parse a w:tblPrEx (CT_TblPrEx) element into TablePropertyExOptions.
|
|
4747
|
+
* CT_TblPrExBase shares its child elements with CT_TblPrBase, so this reuses
|
|
4748
|
+
* parseTablePropertiesEl and maps the table-level margins field to cellMargin.
|
|
4749
|
+
*/
|
|
4750
|
+
function parseTablePropertyExceptions(el) {
|
|
4751
|
+
const base = parseTablePropertiesEl(el);
|
|
4752
|
+
const opts = {};
|
|
4753
|
+
if (base.width !== void 0) opts.width = base.width;
|
|
4754
|
+
if (base.indent !== void 0) opts.indent = base.indent;
|
|
4755
|
+
if (base.layout !== void 0) opts.layout = base.layout;
|
|
4756
|
+
if (base.borders !== void 0) opts.borders = base.borders;
|
|
4757
|
+
if (base.shading !== void 0) opts.shading = base.shading;
|
|
4758
|
+
if (base.alignment !== void 0) opts.alignment = base.alignment;
|
|
4759
|
+
if (base.margins !== void 0) opts.cellMargin = base.margins;
|
|
4760
|
+
if (base.tableLook !== void 0) opts.tableLook = base.tableLook;
|
|
4761
|
+
if (base.cellSpacing !== void 0) opts.cellSpacing = base.cellSpacing;
|
|
4762
|
+
const tblPrExChange = findChild(el, "w:tblPrExChange");
|
|
4763
|
+
if (tblPrExChange) {
|
|
4764
|
+
const change = parseTablePropertyExChange(tblPrExChange);
|
|
4765
|
+
if (change) opts.tblPrExChange = change;
|
|
4766
|
+
}
|
|
4767
|
+
return opts;
|
|
4768
|
+
}
|
|
4769
|
+
/** Parse a w:tblPrExChange (CT_TblPrExChange) — track-change wrapper around the previous tblPrEx. */
|
|
4770
|
+
function parseTablePropertyExChange(el) {
|
|
4771
|
+
const change = {};
|
|
4772
|
+
const id = attrNum(el, "w:id");
|
|
4773
|
+
if (id !== void 0) change.id = id;
|
|
4774
|
+
const author = attr(el, "w:author");
|
|
4775
|
+
if (author) change.author = author;
|
|
4776
|
+
const date = attr(el, "w:date");
|
|
4777
|
+
if (date) change.date = date;
|
|
4778
|
+
const innerTblPrEx = findChild(el, "w:tblPrEx");
|
|
4779
|
+
if (innerTblPrEx) {
|
|
4780
|
+
const inner = parseTablePropertyExceptions(innerTblPrEx);
|
|
4781
|
+
if (inner.width !== void 0) change.width = inner.width;
|
|
4782
|
+
if (inner.indent !== void 0) change.indent = inner.indent;
|
|
4783
|
+
if (inner.layout !== void 0) change.layout = inner.layout;
|
|
4784
|
+
if (inner.borders !== void 0) change.borders = inner.borders;
|
|
4785
|
+
if (inner.shading !== void 0) change.shading = inner.shading;
|
|
4786
|
+
if (inner.alignment !== void 0) change.alignment = inner.alignment;
|
|
4787
|
+
if (inner.cellMargin !== void 0) change.cellMargin = inner.cellMargin;
|
|
4788
|
+
if (inner.tableLook !== void 0) change.tableLook = inner.tableLook;
|
|
4789
|
+
if (inner.cellSpacing !== void 0) change.cellSpacing = inner.cellSpacing;
|
|
4790
|
+
}
|
|
4791
|
+
if (change.id === void 0 || change.author === void 0) return void 0;
|
|
4792
|
+
return change;
|
|
4793
|
+
}
|
|
4657
4794
|
const tableDesc = {
|
|
4658
4795
|
kind: "custom",
|
|
4659
4796
|
stringify(opts, ctx) {
|
|
@@ -4669,6 +4806,7 @@ const tableDesc = {
|
|
|
4669
4806
|
indent: opts.indent,
|
|
4670
4807
|
layout: opts.layout,
|
|
4671
4808
|
revision: opts.revision,
|
|
4809
|
+
shading: opts.shading,
|
|
4672
4810
|
style: opts.style,
|
|
4673
4811
|
styleColBandSize: opts.styleColBandSize,
|
|
4674
4812
|
styleRowBandSize: opts.styleRowBandSize,
|
|
@@ -4774,35 +4912,13 @@ function parseTablePropertiesEl(el) {
|
|
|
4774
4912
|
}
|
|
4775
4913
|
const tblCellMar = findChild(el, "w:tblCellMar");
|
|
4776
4914
|
if (tblCellMar) {
|
|
4777
|
-
const margins =
|
|
4778
|
-
|
|
4779
|
-
"top",
|
|
4780
|
-
"bottom",
|
|
4781
|
-
"left",
|
|
4782
|
-
"right"
|
|
4783
|
-
]) {
|
|
4784
|
-
const sideEl = findChild(tblCellMar, `w:${side}`);
|
|
4785
|
-
if (sideEl) {
|
|
4786
|
-
const size = attrNum(sideEl, "w:w");
|
|
4787
|
-
const type = attr(sideEl, "w:type");
|
|
4788
|
-
if (size !== void 0) margins[side] = {
|
|
4789
|
-
size,
|
|
4790
|
-
type: type ?? "dxa"
|
|
4791
|
-
};
|
|
4792
|
-
}
|
|
4793
|
-
}
|
|
4794
|
-
if (Object.keys(margins).length > 0) opts.margins = margins;
|
|
4915
|
+
const margins = parseCellMargins(tblCellMar);
|
|
4916
|
+
if (margins) opts.margins = margins;
|
|
4795
4917
|
}
|
|
4796
4918
|
const shd = findChild(el, "w:shd");
|
|
4797
4919
|
if (shd) {
|
|
4798
|
-
const shading =
|
|
4799
|
-
|
|
4800
|
-
if (fill) shading.fill = fill;
|
|
4801
|
-
const color = attr(shd, "w:color");
|
|
4802
|
-
if (color) shading.color = color;
|
|
4803
|
-
const val = attr(shd, "w:val");
|
|
4804
|
-
if (val) shading.type = val;
|
|
4805
|
-
if (Object.keys(shading).length > 0) opts.shading = shading;
|
|
4920
|
+
const shading = parseShading(shd);
|
|
4921
|
+
if (shading) opts.shading = shading;
|
|
4806
4922
|
}
|
|
4807
4923
|
const tblDesc = findChild(el, "w:tblDescription");
|
|
4808
4924
|
if (tblDesc) {
|
|
@@ -4810,28 +4926,35 @@ function parseTablePropertiesEl(el) {
|
|
|
4810
4926
|
if (val) opts.description = val;
|
|
4811
4927
|
}
|
|
4812
4928
|
const tblpPr = findChild(el, "w:tblpPr");
|
|
4813
|
-
|
|
4929
|
+
const tblOverlap = findChild(el, "w:tblOverlap");
|
|
4930
|
+
if (tblpPr || tblOverlap) {
|
|
4814
4931
|
const floatOpts = {};
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4932
|
+
if (tblpPr) {
|
|
4933
|
+
const horzAnchor = attr(tblpPr, "w:horzAnchor");
|
|
4934
|
+
if (horzAnchor) floatOpts.horizontalAnchor = horzAnchor;
|
|
4935
|
+
const vertAnchor = attr(tblpPr, "w:vertAnchor");
|
|
4936
|
+
if (vertAnchor) floatOpts.verticalAnchor = vertAnchor;
|
|
4937
|
+
const tblpX = attrNum(tblpPr, "w:tblpX");
|
|
4938
|
+
if (tblpX !== void 0) floatOpts.absoluteHorizontalPosition = tblpX;
|
|
4939
|
+
const tblpXSpec = attr(tblpPr, "w:tblpXSpec");
|
|
4940
|
+
if (tblpXSpec) floatOpts.relativeHorizontalPosition = tblpXSpec;
|
|
4941
|
+
const tblpY = attrNum(tblpPr, "w:tblpY");
|
|
4942
|
+
if (tblpY !== void 0) floatOpts.absoluteVerticalPosition = tblpY;
|
|
4943
|
+
const tblpYSpec = attr(tblpPr, "w:tblpYSpec");
|
|
4944
|
+
if (tblpYSpec) floatOpts.relativeVerticalPosition = tblpYSpec;
|
|
4945
|
+
const bottomFromText = attrNum(tblpPr, "w:bottomFromText");
|
|
4946
|
+
if (bottomFromText !== void 0) floatOpts.bottomFromText = bottomFromText;
|
|
4947
|
+
const topFromText = attrNum(tblpPr, "w:topFromText");
|
|
4948
|
+
if (topFromText !== void 0) floatOpts.topFromText = topFromText;
|
|
4949
|
+
const leftFromText = attrNum(tblpPr, "w:leftFromText");
|
|
4950
|
+
if (leftFromText !== void 0) floatOpts.leftFromText = leftFromText;
|
|
4951
|
+
const rightFromText = attrNum(tblpPr, "w:rightFromText");
|
|
4952
|
+
if (rightFromText !== void 0) floatOpts.rightFromText = rightFromText;
|
|
4953
|
+
}
|
|
4954
|
+
if (tblOverlap) {
|
|
4955
|
+
const overlap = attr(tblOverlap, "w:val");
|
|
4956
|
+
if (overlap) floatOpts.overlap = overlap;
|
|
4957
|
+
}
|
|
4835
4958
|
if (Object.keys(floatOpts).length > 0) opts.float = floatOpts;
|
|
4836
4959
|
}
|
|
4837
4960
|
const tblInd = findChild(el, "w:tblInd");
|
|
@@ -4865,7 +4988,7 @@ function parseTablePropertiesEl(el) {
|
|
|
4865
4988
|
const type = attr(tblCellSpacing, "w:type");
|
|
4866
4989
|
const w = attrNum(tblCellSpacing, "w:w");
|
|
4867
4990
|
if (w !== void 0) opts.cellSpacing = {
|
|
4868
|
-
|
|
4991
|
+
size: w,
|
|
4869
4992
|
...type ? { type } : {}
|
|
4870
4993
|
};
|
|
4871
4994
|
}
|
|
@@ -4882,17 +5005,51 @@ function parseTablePropertiesEl(el) {
|
|
|
4882
5005
|
if (innerTblPr) Object.assign(rev, parseTablePropertiesEl(innerTblPr));
|
|
4883
5006
|
if (Object.keys(rev).length > 0) opts.revision = rev;
|
|
4884
5007
|
}
|
|
5008
|
+
const tblLook = findChild(el, "w:tblLook");
|
|
5009
|
+
if (tblLook) {
|
|
5010
|
+
const look = {};
|
|
5011
|
+
const firstRow = attrBool(tblLook, "w:firstRow");
|
|
5012
|
+
if (firstRow !== void 0) look.firstRow = firstRow;
|
|
5013
|
+
const lastRow = attrBool(tblLook, "w:lastRow");
|
|
5014
|
+
if (lastRow !== void 0) look.lastRow = lastRow;
|
|
5015
|
+
const firstColumn = attrBool(tblLook, "w:firstColumn");
|
|
5016
|
+
if (firstColumn !== void 0) look.firstColumn = firstColumn;
|
|
5017
|
+
const lastColumn = attrBool(tblLook, "w:lastColumn");
|
|
5018
|
+
if (lastColumn !== void 0) look.lastColumn = lastColumn;
|
|
5019
|
+
const noHBand = attrBool(tblLook, "w:noHBand");
|
|
5020
|
+
if (noHBand !== void 0) look.noHBand = noHBand;
|
|
5021
|
+
const noVBand = attrBool(tblLook, "w:noVBand");
|
|
5022
|
+
if (noVBand !== void 0) look.noVBand = noVBand;
|
|
5023
|
+
if (Object.keys(look).length > 0) opts.tableLook = look;
|
|
5024
|
+
}
|
|
4885
5025
|
return opts;
|
|
4886
5026
|
}
|
|
4887
5027
|
function parseColumnWidthsEl(el) {
|
|
4888
|
-
const
|
|
5028
|
+
const widths = [];
|
|
4889
5029
|
const tblGrid = findChild(el, "w:tblGrid");
|
|
4890
|
-
if (!tblGrid) return
|
|
5030
|
+
if (!tblGrid) return { widths };
|
|
4891
5031
|
for (const col of children(tblGrid, "w:gridCol")) {
|
|
4892
5032
|
const w = attrNum(col, "w:w");
|
|
4893
|
-
|
|
5033
|
+
widths.push(w ?? 100);
|
|
5034
|
+
}
|
|
5035
|
+
const tblGridChange = findChild(tblGrid, "w:tblGridChange");
|
|
5036
|
+
if (tblGridChange) {
|
|
5037
|
+
const id = attrNum(tblGridChange, "w:id");
|
|
5038
|
+
const innerGrid = findChild(tblGridChange, "w:tblGrid");
|
|
5039
|
+
const revWidths = [];
|
|
5040
|
+
if (innerGrid) for (const col of children(innerGrid, "w:gridCol")) {
|
|
5041
|
+
const w = attrNum(col, "w:w");
|
|
5042
|
+
revWidths.push(w ?? 100);
|
|
5043
|
+
}
|
|
5044
|
+
if (id !== void 0) return {
|
|
5045
|
+
widths,
|
|
5046
|
+
revision: {
|
|
5047
|
+
id,
|
|
5048
|
+
columnWidths: revWidths
|
|
5049
|
+
}
|
|
5050
|
+
};
|
|
4894
5051
|
}
|
|
4895
|
-
return
|
|
5052
|
+
return { widths };
|
|
4896
5053
|
}
|
|
4897
5054
|
function parseTableRowPropertiesEl(el) {
|
|
4898
5055
|
const opts = {};
|
|
@@ -4902,18 +5059,13 @@ function parseTableRowPropertiesEl(el) {
|
|
|
4902
5059
|
const rule = attr(trHeight, "w:hRule");
|
|
4903
5060
|
if (val !== void 0) opts.height = {
|
|
4904
5061
|
value: val,
|
|
4905
|
-
rule
|
|
5062
|
+
...rule ? { rule } : {}
|
|
4906
5063
|
};
|
|
4907
5064
|
}
|
|
4908
5065
|
const cnfStyle = findChild(el, "w:cnfStyle");
|
|
4909
5066
|
if (cnfStyle) {
|
|
4910
|
-
const
|
|
4911
|
-
if (
|
|
4912
|
-
const cnf = { val };
|
|
4913
|
-
const changed = attrBool(cnfStyle, "w:changed");
|
|
4914
|
-
if (changed !== void 0) cnf.changed = changed;
|
|
4915
|
-
opts.cnfStyle = cnf;
|
|
4916
|
-
}
|
|
5067
|
+
const cnf = parseCnfStyle(cnfStyle);
|
|
5068
|
+
if (cnf) opts.cnfStyle = cnf;
|
|
4917
5069
|
}
|
|
4918
5070
|
const divId = findChild(el, "w:divId");
|
|
4919
5071
|
if (divId) {
|
|
@@ -4962,7 +5114,7 @@ function parseTableRowPropertiesEl(el) {
|
|
|
4962
5114
|
const type = attr(tblCellSpacing, "w:type");
|
|
4963
5115
|
const w = attrNum(tblCellSpacing, "w:w");
|
|
4964
5116
|
if (w !== void 0) opts.cellSpacing = {
|
|
4965
|
-
|
|
5117
|
+
size: w,
|
|
4966
5118
|
...type ? { type } : {}
|
|
4967
5119
|
};
|
|
4968
5120
|
}
|
|
@@ -4987,34 +5139,22 @@ function parseTableRowPropertiesEl(el) {
|
|
|
4987
5139
|
if (tblHeader) opts.tableHeader = attrBool(tblHeader, "w:val") ?? true;
|
|
4988
5140
|
const cantSplit = findChild(el, "w:cantSplit");
|
|
4989
5141
|
if (cantSplit) opts.cantSplit = attrBool(cantSplit, "w:val") ?? true;
|
|
4990
|
-
const tblLook = findChild(el, "w:tblLook");
|
|
4991
|
-
if (tblLook) {
|
|
4992
|
-
const look = {};
|
|
4993
|
-
const firstRow = attrBool(tblLook, "w:firstRow");
|
|
4994
|
-
if (firstRow !== void 0) look.firstRow = firstRow;
|
|
4995
|
-
const lastRow = attrBool(tblLook, "w:lastRow");
|
|
4996
|
-
if (lastRow !== void 0) look.lastRow = lastRow;
|
|
4997
|
-
const firstColumn = attrBool(tblLook, "w:firstColumn");
|
|
4998
|
-
if (firstColumn !== void 0) look.firstColumn = firstColumn;
|
|
4999
|
-
const lastColumn = attrBool(tblLook, "w:lastColumn");
|
|
5000
|
-
if (lastColumn !== void 0) look.lastColumn = lastColumn;
|
|
5001
|
-
const noHBand = attrBool(tblLook, "w:noHBand");
|
|
5002
|
-
if (noHBand !== void 0) look.noHBand = noHBand;
|
|
5003
|
-
const noVBand = attrBool(tblLook, "w:noVBand");
|
|
5004
|
-
if (noVBand !== void 0) look.noVBand = noVBand;
|
|
5005
|
-
if (Object.keys(look).length > 0) opts.tableLook = look;
|
|
5006
|
-
}
|
|
5007
5142
|
return opts;
|
|
5008
5143
|
}
|
|
5009
5144
|
function parseTableCellPropertiesEl(el) {
|
|
5010
5145
|
const opts = {};
|
|
5146
|
+
const cnfStyle = findChild(el, "w:cnfStyle");
|
|
5147
|
+
if (cnfStyle) {
|
|
5148
|
+
const cnf = parseCnfStyle(cnfStyle);
|
|
5149
|
+
if (cnf) opts.cnfStyle = cnf;
|
|
5150
|
+
}
|
|
5011
5151
|
const tcW = findChild(el, "w:tcW");
|
|
5012
5152
|
if (tcW) {
|
|
5013
5153
|
const size = attrNum(tcW, "w:w");
|
|
5014
5154
|
const type = attr(tcW, "w:type");
|
|
5015
5155
|
if (size !== void 0) opts.width = {
|
|
5016
5156
|
size,
|
|
5017
|
-
type
|
|
5157
|
+
...type ? { type } : {}
|
|
5018
5158
|
};
|
|
5019
5159
|
}
|
|
5020
5160
|
const gridSpan = findChild(el, "w:gridSpan");
|
|
@@ -5031,39 +5171,47 @@ function parseTableCellPropertiesEl(el) {
|
|
|
5031
5171
|
}
|
|
5032
5172
|
const shd = findChild(el, "w:shd");
|
|
5033
5173
|
if (shd) {
|
|
5034
|
-
const shading =
|
|
5035
|
-
|
|
5036
|
-
if (fill) shading.fill = fill;
|
|
5037
|
-
const color = attr(shd, "w:color");
|
|
5038
|
-
if (color) shading.color = color;
|
|
5039
|
-
const val = attr(shd, "w:val");
|
|
5040
|
-
if (val) shading.type = val;
|
|
5041
|
-
if (Object.keys(shading).length > 0) opts.shading = shading;
|
|
5174
|
+
const shading = parseShading(shd);
|
|
5175
|
+
if (shading) opts.shading = shading;
|
|
5042
5176
|
}
|
|
5043
5177
|
const tcBorders = findChild(el, "w:tcBorders");
|
|
5044
5178
|
if (tcBorders) {
|
|
5045
|
-
const
|
|
5046
|
-
for (const [xmlSide, key] of [
|
|
5179
|
+
const SIDE_KEYS = [
|
|
5047
5180
|
["top", "top"],
|
|
5048
5181
|
["start", "start"],
|
|
5049
5182
|
["left", "left"],
|
|
5050
5183
|
["bottom", "bottom"],
|
|
5051
5184
|
["end", "end"],
|
|
5052
5185
|
["right", "right"],
|
|
5186
|
+
["insideH", "insideHorizontal"],
|
|
5187
|
+
["insideV", "insideVertical"],
|
|
5053
5188
|
["tl2br", "topLeftToBottomRight"],
|
|
5054
5189
|
["tr2bl", "topRightToBottomLeft"]
|
|
5055
|
-
]
|
|
5190
|
+
];
|
|
5191
|
+
const borders = {};
|
|
5192
|
+
for (const [xmlSide, key] of SIDE_KEYS) {
|
|
5056
5193
|
const sideEl = findChild(tcBorders, `w:${xmlSide}`);
|
|
5057
|
-
if (sideEl)
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5194
|
+
if (!sideEl) continue;
|
|
5195
|
+
const style = attr(sideEl, "w:val");
|
|
5196
|
+
if (!style || !BORDER_STYLES.includes(style)) continue;
|
|
5197
|
+
const sideOpts = { style };
|
|
5198
|
+
const color = attr(sideEl, "w:color");
|
|
5199
|
+
if (color) sideOpts.color = color;
|
|
5200
|
+
const size = attrNum(sideEl, "w:sz");
|
|
5201
|
+
if (size !== void 0) sideOpts.size = size;
|
|
5202
|
+
const space = attrNum(sideEl, "w:space");
|
|
5203
|
+
if (space !== void 0) sideOpts.space = space;
|
|
5204
|
+
const themeColor = attr(sideEl, "w:themeColor");
|
|
5205
|
+
if (themeColor && THEME_COLORS.includes(themeColor)) sideOpts.themeColor = themeColor;
|
|
5206
|
+
const themeTint = attr(sideEl, "w:themeTint");
|
|
5207
|
+
if (themeTint) sideOpts.themeTint = themeTint;
|
|
5208
|
+
const themeShade = attr(sideEl, "w:themeShade");
|
|
5209
|
+
if (themeShade) sideOpts.themeShade = themeShade;
|
|
5210
|
+
const shadow = attrBool(sideEl, "w:shadow");
|
|
5211
|
+
if (shadow !== void 0) sideOpts.shadow = shadow;
|
|
5212
|
+
const frame = attrBool(sideEl, "w:frame");
|
|
5213
|
+
if (frame !== void 0) sideOpts.frame = frame;
|
|
5214
|
+
borders[key] = sideOpts;
|
|
5067
5215
|
}
|
|
5068
5216
|
if (Object.keys(borders).length > 0) opts.borders = borders;
|
|
5069
5217
|
}
|
|
@@ -5071,26 +5219,8 @@ function parseTableCellPropertiesEl(el) {
|
|
|
5071
5219
|
if (noWrap) opts.noWrap = attrBool(noWrap, "w:val") ?? true;
|
|
5072
5220
|
const tcMar = findChild(el, "w:tcMar");
|
|
5073
5221
|
if (tcMar) {
|
|
5074
|
-
const margins =
|
|
5075
|
-
|
|
5076
|
-
for (const side of [
|
|
5077
|
-
"top",
|
|
5078
|
-
"bottom",
|
|
5079
|
-
"left",
|
|
5080
|
-
"right"
|
|
5081
|
-
]) {
|
|
5082
|
-
const sideEl = findChild(tcMar, `w:${side}`);
|
|
5083
|
-
if (sideEl) {
|
|
5084
|
-
const size = attrNum(sideEl, "w:w");
|
|
5085
|
-
const type = attr(sideEl, "w:type");
|
|
5086
|
-
if (size !== void 0) {
|
|
5087
|
-
margins[side] = size;
|
|
5088
|
-
if (type && !marginUnitType) marginUnitType = type;
|
|
5089
|
-
}
|
|
5090
|
-
}
|
|
5091
|
-
}
|
|
5092
|
-
if (marginUnitType) margins.marginUnitType = marginUnitType;
|
|
5093
|
-
if (Object.keys(margins).length > 0) opts.margins = margins;
|
|
5222
|
+
const margins = parseCellMargins(tcMar);
|
|
5223
|
+
if (margins) opts.margins = margins;
|
|
5094
5224
|
}
|
|
5095
5225
|
const textDirection = findChild(el, "w:textDirection");
|
|
5096
5226
|
if (textDirection) {
|
|
@@ -5161,6 +5291,11 @@ function parseTableRowEl(el, ctx) {
|
|
|
5161
5291
|
const opts = {};
|
|
5162
5292
|
const trPr = findChild(el, "w:trPr");
|
|
5163
5293
|
if (trPr) Object.assign(opts, parseTableRowPropertiesEl(trPr));
|
|
5294
|
+
const tblPrEx = findChild(el, "w:tblPrEx");
|
|
5295
|
+
if (tblPrEx) {
|
|
5296
|
+
const exceptions = parseTablePropertyExceptions(tblPrEx);
|
|
5297
|
+
if (Object.keys(exceptions).length > 0) opts.propertyExceptions = exceptions;
|
|
5298
|
+
}
|
|
5164
5299
|
for (const [attrName, optKey] of [
|
|
5165
5300
|
["w:rsidRPr", "rsidRPr"],
|
|
5166
5301
|
["w:rsidR", "rsidR"],
|
|
@@ -5207,8 +5342,9 @@ function parseTableEl(el, ctx) {
|
|
|
5207
5342
|
const opts = {};
|
|
5208
5343
|
const tblPr = findChild(el, "w:tblPr");
|
|
5209
5344
|
if (tblPr) Object.assign(opts, parseTablePropertiesEl(tblPr));
|
|
5210
|
-
const
|
|
5211
|
-
if (
|
|
5345
|
+
const grid = parseColumnWidthsEl(el);
|
|
5346
|
+
if (grid.widths.length > 0) opts.columnWidths = grid.widths;
|
|
5347
|
+
if (grid.revision) opts.columnWidthsRevision = grid.revision;
|
|
5212
5348
|
const rows = [];
|
|
5213
5349
|
for (const child of el.elements ?? []) if (child.name === "w:tr") rows.push(parseTableRowEl(child, ctx));
|
|
5214
5350
|
else if (child.name === "w:sdt") {
|
|
@@ -6224,4 +6360,4 @@ function parseNotePropertiesEl(el) {
|
|
|
6224
6360
|
//#endregion
|
|
6225
6361
|
export { setBodyParseChild as $, stringifyParagraphInline as A, HorizontalPositionAlign as B, createPageSize as C, Media as Ct, parseSdtBlock as D, tableDesc as E, parseDrawingRun as F, createWrapTight as G, SpaceType as H, createVerticalPosition as I, altChunkDesc as J, TextWrappingSide as K, createHorizontalPosition as L, parseMathChildren as M, drawingDesc as N, parseSdtProperties as O, resetDrawingIdGen as P, sdtBlockDesc as Q, HorizontalPositionRelativeFrom as R, PageOrientation as S, WORKAROUND2 as St, setTableParseChild as T, VerticalPositionAlign as U, NumberFormat as V, createWrapThrough as W, customXmlBlockDesc as X, checkboxSymbolRunInner as Y, parseCustomXmlPr as Z, DocumentGridType as _, TextHorzOverflowType as _t, HeaderFooterType as a, stringifyRunProperties as at, sectionPageSizeDefaults as b, VerticalAnchor as bt, createSectionType as c, parsedRunToOptions as ct, createPageMargin as d, TextDirection as dt, stringifyCustomXmlShell as et, PageBorderDisplay as f, VerticalMergeType as ft, createPageNumberType as g, TextBodyWrappingType as gt, PageNumberSeparator as h, parseFormFieldData as ht, HeaderFooterReferenceType as i, stringifyParagraphProperties as it, stringifyRunInline as j, stringifyChildDispatch as k, LineNumberRestartFormat as l, WidthType as lt, PageBorderZOrder as m, createFormFieldData as mt, sectionPropertiesDesc as n, stringifySdtShell as nt, createHeaderFooterReference as o, parseRun as ot, PageBorderOffsetFrom as p, FormFieldTextType as pt, TextWrappingType as q, stringifySectionPropertiesXml as r, subDocDesc as rt, SectionType as s, parseRunProperties as st, parseSectionPropertiesEl as t, stringifySdtPr as tt, createLineNumberType as u, BorderStyle as ut, createDocumentGrid as v, TextVertOverflowType as vt, DocumentAttributeNamespaces as w, createTransformation as wt, PageTextDirectionType as x, createBodyProperties as xt, sectionMarginDefaults as y, TextVerticalType as yt, VerticalPositionRelativeFrom as z };
|
|
6226
6362
|
|
|
6227
|
-
//# sourceMappingURL=document-
|
|
6363
|
+
//# sourceMappingURL=document-D2OTVcbX.mjs.map
|