@office-open/docx 0.9.0 → 0.9.1

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.
@@ -2410,7 +2410,7 @@ function stringifyRunProperties(opts) {
2410
2410
  *
2411
2411
  * Used by table.ts, comments.ts, body.ts, and other descriptors that need to
2412
2412
  * serialize paragraph/run content. Includes JSON child dispatch for all
2413
- * IParagraphJsonChild variants (image, chart, hyperlink, etc.).
2413
+ * ParagraphJsonChild variants (image, chart, hyperlink, etc.).
2414
2414
  *
2415
2415
  * Pure string concatenation — zero IXmlableObject, zero BaseXmlComponent.
2416
2416
  *
@@ -3303,6 +3303,45 @@ function parseTablePropertiesEl(el) {
3303
3303
  if (val) shading.type = val;
3304
3304
  if (Object.keys(shading).length > 0) opts.shading = shading;
3305
3305
  }
3306
+ const tblDesc = findChild(el, "w:tblDescription");
3307
+ if (tblDesc) {
3308
+ const val = attr(tblDesc, "w:val");
3309
+ if (val) opts.description = val;
3310
+ }
3311
+ const tblpPr = findChild(el, "w:tblpPr");
3312
+ if (tblpPr) {
3313
+ const floatOpts = {};
3314
+ const horzAnchor = attr(tblpPr, "w:horzAnchor");
3315
+ if (horzAnchor) floatOpts.horizontalAnchor = horzAnchor;
3316
+ const vertAnchor = attr(tblpPr, "w:vertAnchor");
3317
+ if (vertAnchor) floatOpts.verticalAnchor = vertAnchor;
3318
+ const tblpX = attrNum(tblpPr, "w:tblpX");
3319
+ if (tblpX !== void 0) floatOpts.absoluteHorizontalPosition = tblpX;
3320
+ const tblpXSpec = attr(tblpPr, "w:tblpXSpec");
3321
+ if (tblpXSpec) floatOpts.relativeHorizontalPosition = tblpXSpec;
3322
+ const tblpY = attrNum(tblpPr, "w:tblpY");
3323
+ if (tblpY !== void 0) floatOpts.absoluteVerticalPosition = tblpY;
3324
+ const tblpYSpec = attr(tblpPr, "w:tblpYSpec");
3325
+ if (tblpYSpec) floatOpts.relativeVerticalPosition = tblpYSpec;
3326
+ const bottomFromText = attrNum(tblpPr, "w:bottomFromText");
3327
+ if (bottomFromText !== void 0) floatOpts.bottomFromText = bottomFromText;
3328
+ const topFromText = attrNum(tblpPr, "w:topFromText");
3329
+ if (topFromText !== void 0) floatOpts.topFromText = topFromText;
3330
+ const leftFromText = attrNum(tblpPr, "w:leftFromText");
3331
+ if (leftFromText !== void 0) floatOpts.leftFromText = leftFromText;
3332
+ const rightFromText = attrNum(tblpPr, "w:rightFromText");
3333
+ if (rightFromText !== void 0) floatOpts.rightFromText = rightFromText;
3334
+ if (Object.keys(floatOpts).length > 0) opts.float = floatOpts;
3335
+ }
3336
+ const tblInd = findChild(el, "w:tblInd");
3337
+ if (tblInd) {
3338
+ const size = attrNum(tblInd, "w:w");
3339
+ const type = attr(tblInd, "w:type");
3340
+ if (size !== void 0) opts.indent = {
3341
+ size,
3342
+ ...type ? { type } : {}
3343
+ };
3344
+ }
3306
3345
  return opts;
3307
3346
  }
3308
3347
  function parseColumnWidthsEl(el) {
@@ -4197,7 +4236,7 @@ function stringifySectionPropertiesXml(opts) {
4197
4236
  if (opts.rsidSect !== void 0) attrs.push(`w:rsidSect="${opts.rsidSect}"`);
4198
4237
  return `<w:sectPr${attrs.length ? " " + attrs.join(" ") : ""}>${inner}</w:sectPr>`;
4199
4238
  }
4200
- /** Parse a w:sectPr element into ISectionPropertiesOptions. */
4239
+ /** Parse a w:sectPr element into SectionPropertiesOptions. */
4201
4240
  function parseSectionPropertiesEl(el) {
4202
4241
  const opts = {};
4203
4242
  for (const [attrName, optKey] of [
@@ -4370,6 +4409,19 @@ function parseSectionPropertiesEl(el) {
4370
4409
  const rId = attr(printerSettings, "r:id");
4371
4410
  if (rId) opts.printerSettingsId = rId;
4372
4411
  }
4412
+ const headerGroup = {};
4413
+ const footerGroup = {};
4414
+ for (const child of el.elements ?? []) if (child.name === "w:headerReference") {
4415
+ const type = attr(child, "w:type");
4416
+ const rId = attr(child, "r:id");
4417
+ if (type && rId) headerGroup[type] = { referenceId: parseInt(rId.replace("rId", ""), 10) };
4418
+ } else if (child.name === "w:footerReference") {
4419
+ const type = attr(child, "w:type");
4420
+ const rId = attr(child, "r:id");
4421
+ if (type && rId) footerGroup[type] = { referenceId: parseInt(rId.replace("rId", ""), 10) };
4422
+ }
4423
+ if (Object.keys(headerGroup).length > 0) opts.headerWrapperGroup = headerGroup;
4424
+ if (Object.keys(footerGroup).length > 0) opts.footerWrapperGroup = footerGroup;
4373
4425
  return opts;
4374
4426
  }
4375
4427
  function parseNotePropertiesEl(el) {
@@ -4401,4 +4453,4 @@ function parseNotePropertiesEl(el) {
4401
4453
  //#endregion
4402
4454
  export { TextHorzOverflowType as $, stringifyParagraphProperties as A, HorizontalPositionAlign as B, createPageSize as C, stringifyJsonChild as D, tableDesc as E, parseDrawingRun as F, createWrapTight as G, SpaceType as H, createVerticalPosition as I, WidthType as J, TextWrappingSide as K, createHorizontalPosition as L, parseMathChildren as M, drawingDesc as N, stringifyParagraphInline as O, resetDrawingIdGen as P, TextBodyWrappingType as Q, HorizontalPositionRelativeFrom as R, PageOrientation as S, setTableParseChild as T, VerticalPositionAlign as U, NumberFormat as V, createWrapThrough as W, TextDirection as X, BorderStyle as Y, VerticalMergeType as Z, DocumentGridType as _, HeaderFooterType as a, Media as at, sectionPageSizeDefaults as b, createSectionType as c, createPageMargin as d, TextVertOverflowType as et, PageBorderDisplay as f, createPageNumberType as g, PageNumberSeparator as h, HeaderFooterReferenceType as i, WORKAROUND2 as it, stringifyRunProperties as j, stringifyRunInline as k, LineNumberRestartFormat as l, PageBorderZOrder as m, sectionPropertiesDesc as n, VerticalAnchor as nt, createHeaderFooterReference as o, createTransformation as ot, PageBorderOffsetFrom as p, TextWrappingType as q, stringifySectionPropertiesXml as r, createBodyProperties as rt, SectionType as s, parseSectionPropertiesEl as t, TextVerticalType as tt, createLineNumberType as u, createDocumentGrid as v, DocumentAttributeNamespaces as w, PageTextDirectionType as x, sectionMarginDefaults as y, VerticalPositionRelativeFrom as z };
4403
4455
 
4404
- //# sourceMappingURL=document-CWr8C_OX.mjs.map
4456
+ //# sourceMappingURL=document-Ch4dyBB4.mjs.map