@evotecit/officeimo 0.1.19 → 0.1.21

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.
Files changed (42) hide show
  1. package/README.md +6 -3
  2. package/bundles/officeimo-canopyx-adapter.js +121 -59
  3. package/bundles/officeimo-canopyx-adapter.min.js +1 -1
  4. package/bundles/officeimo-canopyx-adapter.min.mjs +1 -1
  5. package/bundles/officeimo-canopyx-adapter.mjs +108 -47
  6. package/bundles/officeimo-canopyx.js +177 -100
  7. package/bundles/officeimo-canopyx.min.js +1 -1
  8. package/bundles/officeimo-canopyx.min.mjs +1 -1
  9. package/bundles/officeimo-canopyx.mjs +144 -68
  10. package/bundles/officeimo-datatables-adapter.js +7 -7
  11. package/bundles/officeimo-datatables-adapter.min.js +1 -1
  12. package/bundles/officeimo-datatables-adapter.min.mjs +1 -1
  13. package/bundles/officeimo-datatables-adapter.mjs +3 -3
  14. package/bundles/officeimo-datatables.js +63 -48
  15. package/bundles/officeimo-datatables.min.js +1 -1
  16. package/bundles/officeimo-datatables.min.mjs +1 -1
  17. package/bundles/officeimo-datatables.mjs +39 -24
  18. package/bundles/officeimo-xlsx.js +59 -44
  19. package/bundles/officeimo-xlsx.min.js +1 -1
  20. package/bundles/officeimo-xlsx.min.mjs +1 -1
  21. package/bundles/officeimo-xlsx.mjs +39 -24
  22. package/bundles/officeimo.js +61 -46
  23. package/bundles/officeimo.min.js +1 -1
  24. package/bundles/officeimo.min.mjs +1 -1
  25. package/bundles/officeimo.mjs +40 -25
  26. package/dist/integrations/canopyx/index.js +4 -2
  27. package/dist/integrations/canopyx/pdf-number.js +9 -6
  28. package/dist/integrations/canopyx/rule-predicates.d.ts +1 -1
  29. package/dist/integrations/canopyx/rule-predicates.js +2 -1
  30. package/dist/integrations/canopyx/rules.d.ts +1 -1
  31. package/dist/integrations/canopyx/rules.js +11 -13
  32. package/dist/integrations/canopyx/source.js +44 -7
  33. package/dist/integrations/canopyx/tones.d.ts +10 -0
  34. package/dist/integrations/canopyx/tones.js +12 -0
  35. package/dist/integrations/canopyx/types.d.ts +8 -1
  36. package/dist/xlsx/options.js +1 -1
  37. package/dist/xlsx/portable.js +1 -1
  38. package/dist/xlsx/styles.js +28 -18
  39. package/dist/xlsx/types.d.ts +5 -1
  40. package/dist/xlsx/workbook.js +3 -1
  41. package/dist/xlsx/worksheet.js +5 -2
  42. package/package.json +1 -1
@@ -1376,6 +1376,24 @@ const { DifferentialStyles } = _m18;
1376
1376
 
1377
1377
 
1378
1378
  const spreadsheetNamespace = "http://schemas.openxmlformats.org/spreadsheetml/2006/main";
1379
+ const borderStyles = ["thin", "medium", "dashed", "dotted", "thick", "double", "hair", "dashDot", "dashDotDot", "slantDashDot", "mediumDashed", "mediumDashDot", "mediumDashDotDot"];
1380
+ /** @internal Validate and normalize border edges without registering a workbook style. */
1381
+ function normalizeBorder(border) {
1382
+ if (!border || typeof border !== "object")
1383
+ throw new TypeError("A border must be an object of edges.");
1384
+ const result = {};
1385
+ for (const side of ["left", "right", "top", "bottom"]) {
1386
+ const edge = border[side];
1387
+ if (edge) {
1388
+ // Read each property once, so the validated edge is the one that is stored.
1389
+ const { style, color } = edge;
1390
+ if (!borderStyles.includes(style))
1391
+ throw new TypeError("Invalid border style.");
1392
+ result[side] = { style, ...(color ? { color: colorArgb(color) } : {}) };
1393
+ }
1394
+ }
1395
+ return result;
1396
+ }
1379
1397
  const NumberFormats = { General: "General", Integer: "0", Decimal: "0.00", Percent: "0.00%", Date: "yyyy-mm-dd", DateTime: "yyyy-mm-dd hh:mm:ss" };
1380
1398
  function index(value, count, kind) {
1381
1399
  if (!Number.isInteger(value) || value < 0 || value >= count)
@@ -1448,32 +1466,24 @@ class StyleRegistry {
1448
1466
  /** @internal */
1449
1467
  addDifferentials(styles) { this.checkDifferentials(styles); return this.differential.add(styles); }
1450
1468
  addFont(font) {
1451
- if (font.name !== undefined && typeof font.name !== "string")
1469
+ const { name: requested, size: requestedSize, bold, italic, underline, strike, color } = font;
1470
+ if (requested !== undefined && typeof requested !== "string")
1452
1471
  throw new TypeError("Font name must be a string.");
1453
- const name = cleanXml(font.name ?? "Calibri", this.policy), size = font.size ?? 11;
1472
+ const name = cleanXml(requested ?? "Calibri", this.policy), size = requestedSize ?? 11;
1454
1473
  if (typeof name !== "string" || !name || name.length > 31)
1455
1474
  throw new TypeError("Font name must contain 1 through 31 characters.");
1456
1475
  if (!Number.isFinite(size) || size <= 0 || size > 409)
1457
1476
  throw new RangeError("Font size must be positive and at most 409.");
1458
- return deduplicate(this.fonts, this.fontIndexes, { name, size, bold: !!font.bold, italic: !!font.italic, underline: !!font.underline, strike: !!font.strike, color: font.color ? colorArgb(font.color) : "" }, this.maximum);
1477
+ return deduplicate(this.fonts, this.fontIndexes, { name, size, bold: !!bold, italic: !!italic, underline: !!underline, strike: !!strike, color: color ? colorArgb(color) : "" }, this.maximum);
1459
1478
  }
1460
1479
  addFill(fill) {
1461
- const pattern = fill.pattern ?? (fill.color ? "solid" : "none");
1462
- if (!["none", "gray125", "solid"].includes(pattern) || (pattern === "solid" && !fill.color) || (pattern !== "solid" && fill.color))
1480
+ const { color } = fill, pattern = fill.pattern ?? (color ? "solid" : "none");
1481
+ if (!["none", "gray125", "solid"].includes(pattern) || (pattern === "solid" && !color) || (pattern !== "solid" && color))
1463
1482
  throw new TypeError("A solid fill requires a color; none and gray125 have no color.");
1464
- return deduplicate(this.fills, this.fillIndexes, { pattern, color: fill.color ? colorArgb(fill.color) : "" }, this.maximum + 1);
1483
+ return deduplicate(this.fills, this.fillIndexes, { pattern, color: color ? colorArgb(color) : "" }, this.maximum + 1);
1465
1484
  }
1466
1485
  addBorder(border) {
1467
- const result = {};
1468
- for (const side of ["left", "right", "top", "bottom"]) {
1469
- const edge = border[side];
1470
- if (edge) {
1471
- if (!["thin", "medium", "dashed", "dotted", "thick", "double", "hair", "dashDot", "dashDotDot", "slantDashDot", "mediumDashed", "mediumDashDot", "mediumDashDotDot"].includes(edge.style))
1472
- throw new TypeError("Invalid border style.");
1473
- result[side] = { style: edge.style, ...(edge.color ? { color: colorArgb(edge.color) } : {}) };
1474
- }
1475
- }
1476
- return deduplicate(this.borders, this.borderIndexes, result, this.maximum);
1486
+ return deduplicate(this.borders, this.borderIndexes, normalizeBorder(border), this.maximum);
1477
1487
  }
1478
1488
  addNumberFormat(format) {
1479
1489
  if (typeof format !== "string" || !format || format.length > 255)
@@ -1539,7 +1549,7 @@ class StyleRegistry {
1539
1549
  return this.compose(base, { numberFormat: this.styles[this.validateStyle(dateStyle)].numberFormat });
1540
1550
  }
1541
1551
  /** @internal Column shorthand and header style composition. */
1542
- forColumn(column, header = false, fill, date = false) {
1552
+ forColumn(column, header = false, fill, date = false, border) {
1543
1553
  const base = !header && column.style !== undefined ? this.styles[this.validateStyle(column.style)] : undefined;
1544
1554
  const format = column.format !== undefined ? column.format || NumberFormats.General : base?.numberFormat || (column.type === "date" || date ? NumberFormats.DateTime : NumberFormats.General);
1545
1555
  return this.add({
@@ -1548,7 +1558,7 @@ class StyleRegistry {
1548
1558
  wrapText: column.wrapText ?? base?.wrapText ?? false,
1549
1559
  ...(column.alignment ? { alignment: column.alignment } : base?.alignment ? { alignment: base.alignment } : {}),
1550
1560
  ...(base?.verticalAlignment ? { verticalAlignment: base.verticalAlignment } : {}),
1551
- ...(header ? { font: { bold: true } } : {}), ...(fill ? { fill: { color: fill } } : {})
1561
+ ...(header ? { font: { bold: true } } : {}), ...(fill ? { fill: { color: fill } } : {}), ...(border ? { border } : {})
1552
1562
  });
1553
1563
  }
1554
1564
  toXml() {
@@ -1573,7 +1583,7 @@ class StyleRegistry {
1573
1583
  }).join("") + '</cellXfs><cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles>' + this.differential.toXml() + '</styleSheet>';
1574
1584
  }
1575
1585
  }
1576
- const _exports = Object.freeze({ colorArgb: _m17.colorArgb, spreadsheetNamespace: spreadsheetNamespace, NumberFormats: NumberFormats, validateStylePatch: validateStylePatch, copyStylePatch: copyStylePatch, StyleRegistry: StyleRegistry });
1586
+ const _exports = Object.freeze({ colorArgb: _m17.colorArgb, spreadsheetNamespace: spreadsheetNamespace, normalizeBorder: normalizeBorder, NumberFormats: NumberFormats, validateStylePatch: validateStylePatch, copyStylePatch: copyStylePatch, StyleRegistry: StyleRegistry });
1577
1587
  return _exports;
1578
1588
  })();
1579
1589
 
@@ -3130,8 +3140,9 @@ class Worksheet {
3130
3140
  book.checkLinks(this.links.length);
3131
3141
  this.declared = this.columns.map((column, i) => ({ column, letter: columnName(i + 1),
3132
3142
  style: book.styles.forColumn(column), dateStyle: book.styles.forColumn(column, false, undefined, true),
3133
- headerStyle: this.headerRows ? options.headerStyle ?? book.styles.forColumn({ header: column.header, ...(column.wrapText === undefined ? {} : { wrapText: column.wrapText }),
3134
- ...(column.alignment === undefined ? {} : { alignment: column.alignment }) }, options.boldHeader !== false, options.headerFill) : 0
3143
+ headerStyle: this.headerRows ? options.headerStyle ?? book.styles.forColumn({ header: column.header,
3144
+ ...((options.headerWrap ?? column.wrapText) === undefined ? {} : { wrapText: options.headerWrap ?? column.wrapText }),
3145
+ ...(column.alignment === undefined ? {} : { alignment: column.alignment }) }, options.boldHeader !== false, options.headerFill, false, options.headerBorder) : 0
3135
3146
  }));
3136
3147
  // Register conditional styles only after worksheet construction can no longer reject its options.
3137
3148
  this.conditional = new ConditionalFormats(conditional, book.styles);
@@ -3183,6 +3194,8 @@ class Worksheet {
3183
3194
  throw new TypeError("A frozen header or autofilter requires a header row.");
3184
3195
  if (options.headerFill !== undefined)
3185
3196
  colorArgb(options.headerFill);
3197
+ if (options.headerWrap !== undefined && typeof options.headerWrap !== "boolean")
3198
+ throw new TypeError("headerWrap must be boolean.");
3186
3199
  if (options.headerStyle !== undefined)
3187
3200
  book.styles.validateStyle(options.headerStyle);
3188
3201
  if (options.alternatingRowStyle !== undefined)
@@ -3873,7 +3886,7 @@ const { captureFields } = _m7;
3873
3886
  /** @internal The workbook owner captures these settings before validation or adapter merging. */
3874
3887
  const workbookOptionFields = ["signal", "onProgress", "limits", "sink", "dateMode", "compression", "invalidCharacterPolicy", "appProperties", "cellValueWriters", "oversizedText", "creator", "title", "subject", "description", "created", "modified"];
3875
3888
  /** @internal Worksheet settings also used by the portable sheet owner. */
3876
- const sheetOptionFields = ["columns", "includeHeader", "headerRows", "freezeHeader", "autoFilter", "boldHeader", "headerFill", "headerStyle", "alternatingRowStyle", "rowStyle", "cellStyle", "rowOutline", "maxOutlineLevel", "outlineSummaryBelow", "outlineSummaryRight", "columnOutlines", "rowHeight", "headerHeight", "defaultColumnWidth", "freezeColumns", "table", "autoSize", "footer", "print", "title", "mergedCells", "hyperlinks", "conditionalFormats", "dataValidation"];
3889
+ const sheetOptionFields = ["columns", "includeHeader", "headerRows", "freezeHeader", "autoFilter", "boldHeader", "headerFill", "headerBorder", "headerWrap", "headerStyle", "alternatingRowStyle", "rowStyle", "cellStyle", "rowOutline", "maxOutlineLevel", "outlineSummaryBelow", "outlineSummaryRight", "columnOutlines", "rowHeight", "headerHeight", "defaultColumnWidth", "freezeColumns", "table", "autoSize", "footer", "print", "title", "mergedCells", "hyperlinks", "conditionalFormats", "dataValidation"];
3877
3890
  /** @internal Includes inherited format-specific ceilings before a wrapper combines stream settings. */
3878
3891
  const workbookLimitFields = ["maxRows", "maxCells", "maxTextCharacters", "maxOutputBytes", "maxStyles", "maxSheets", "maxOverflowCharacters", "maxHyperlinks", "maxImageBytes", "maxBufferedCells", "maxBufferedCharacters", "maxMergedRanges", "maxConditionalFormats", "maxDifferentialStyles", "maxCharts", "maxChartPoints", "maxChartTextCharacters", "maxFormulaCharacters", "maxDataValidations", "maxValidationTextCharacters"];
3879
3892
  /** @internal Capture the workbook's known ceilings without dropping supported prototype fields. */
@@ -4205,7 +4218,7 @@ const { OpcPackage, officeRelationshipsNamespace, relationshipTypes, corePropert
4205
4218
 
4206
4219
  const { escapeOoxmlAttribute, cleanXml, xmlDeclaration } = _m11;
4207
4220
 
4208
- const { StyleRegistry, spreadsheetNamespace } = _m16;
4221
+ const { StyleRegistry, spreadsheetNamespace, normalizeBorder } = _m16;
4209
4222
 
4210
4223
  const { sheetName, assertXlsxValue, copyValue } = _m19;
4211
4224
 
@@ -4246,6 +4259,8 @@ function captureSheet(options, policy) {
4246
4259
  return { ...captured, columns,
4247
4260
  ...(captured.columnOutlines === undefined ? {} : { columnOutlines: captureColumnOutlines(captured.columnOutlines, columns.length) }),
4248
4261
  ...(captured.headerRows === undefined ? {} : { headerRows: captureTableSpans(captured.headerRows, columns.length) }),
4262
+ // Preflight and every header style read this one snapshot of the edges.
4263
+ ...(captured.headerBorder === undefined ? {} : { headerBorder: normalizeBorder(captured.headerBorder) }),
4249
4264
  ...(footer ? { footer: { ...footer,
4250
4265
  ...(footer.rows === undefined ? {} : { rows: captureTableSpans(footer.rows, columns.length) }),
4251
4266
  ...(footer.values === undefined ? {} : { values: footer.values.map(copyValue) }) } } : {}),
@@ -4696,7 +4711,7 @@ function value(result) {
4696
4711
  function portableSheet(options = {}) {
4697
4712
  options = captureFields(options, sheetOptionFields);
4698
4713
  if (options.headerStyle !== undefined)
4699
- throw new TypeError("Workbook-local header styles require the advanced Workbook API; use boldHeader and headerFill.");
4714
+ throw new TypeError("Workbook-local header styles require the advanced Workbook API; use boldHeader, headerFill, headerBorder and headerWrap.");
4700
4715
  style(options.alternatingRowStyle);
4701
4716
  style(options.title?.style);
4702
4717
  style(options.footer?.style);
@@ -1945,7 +1945,7 @@ _modules.set("6ae88f25e1c09d00fbb828917498569f883fae88ec25d37caebaf8a2b802b148",
1945
1945
  return _exports;
1946
1946
  })();
1947
1947
 
1948
- const _m24 = _modules.get("077c3c668f1457253dba044e6f6be7f7afd28a8976ed20c764bd5d5dc7c41889") ?? (() => {
1948
+ const _m24 = _modules.get("8d96d0024443ac9aeaea70e9324b53aacef098c2385d4e6a89a76d184e28556a") ?? (() => {
1949
1949
  const { escapeOoxmlAttribute, cleanXml, xmlDeclaration } = _m17;
1950
1950
 
1951
1951
  const { OfficeIMOError } = _m2;
@@ -1957,6 +1957,24 @@ const { DifferentialStyles } = _m26;
1957
1957
 
1958
1958
 
1959
1959
  const spreadsheetNamespace = "http://schemas.openxmlformats.org/spreadsheetml/2006/main";
1960
+ const borderStyles = ["thin", "medium", "dashed", "dotted", "thick", "double", "hair", "dashDot", "dashDotDot", "slantDashDot", "mediumDashed", "mediumDashDot", "mediumDashDotDot"];
1961
+ /** @internal Validate and normalize border edges without registering a workbook style. */
1962
+ function normalizeBorder(border) {
1963
+ if (!border || typeof border !== "object")
1964
+ throw new TypeError("A border must be an object of edges.");
1965
+ const result = {};
1966
+ for (const side of ["left", "right", "top", "bottom"]) {
1967
+ const edge = border[side];
1968
+ if (edge) {
1969
+ // Read each property once, so the validated edge is the one that is stored.
1970
+ const { style, color } = edge;
1971
+ if (!borderStyles.includes(style))
1972
+ throw new TypeError("Invalid border style.");
1973
+ result[side] = { style, ...(color ? { color: colorArgb(color) } : {}) };
1974
+ }
1975
+ }
1976
+ return result;
1977
+ }
1960
1978
  const NumberFormats = { General: "General", Integer: "0", Decimal: "0.00", Percent: "0.00%", Date: "yyyy-mm-dd", DateTime: "yyyy-mm-dd hh:mm:ss" };
1961
1979
  function index(value, count, kind) {
1962
1980
  if (!Number.isInteger(value) || value < 0 || value >= count)
@@ -2029,32 +2047,24 @@ class StyleRegistry {
2029
2047
  /** @internal */
2030
2048
  addDifferentials(styles) { this.checkDifferentials(styles); return this.differential.add(styles); }
2031
2049
  addFont(font) {
2032
- if (font.name !== undefined && typeof font.name !== "string")
2050
+ const { name: requested, size: requestedSize, bold, italic, underline, strike, color } = font;
2051
+ if (requested !== undefined && typeof requested !== "string")
2033
2052
  throw new TypeError("Font name must be a string.");
2034
- const name = cleanXml(font.name ?? "Calibri", this.policy), size = font.size ?? 11;
2053
+ const name = cleanXml(requested ?? "Calibri", this.policy), size = requestedSize ?? 11;
2035
2054
  if (typeof name !== "string" || !name || name.length > 31)
2036
2055
  throw new TypeError("Font name must contain 1 through 31 characters.");
2037
2056
  if (!Number.isFinite(size) || size <= 0 || size > 409)
2038
2057
  throw new RangeError("Font size must be positive and at most 409.");
2039
- return deduplicate(this.fonts, this.fontIndexes, { name, size, bold: !!font.bold, italic: !!font.italic, underline: !!font.underline, strike: !!font.strike, color: font.color ? colorArgb(font.color) : "" }, this.maximum);
2058
+ return deduplicate(this.fonts, this.fontIndexes, { name, size, bold: !!bold, italic: !!italic, underline: !!underline, strike: !!strike, color: color ? colorArgb(color) : "" }, this.maximum);
2040
2059
  }
2041
2060
  addFill(fill) {
2042
- const pattern = fill.pattern ?? (fill.color ? "solid" : "none");
2043
- if (!["none", "gray125", "solid"].includes(pattern) || (pattern === "solid" && !fill.color) || (pattern !== "solid" && fill.color))
2061
+ const { color } = fill, pattern = fill.pattern ?? (color ? "solid" : "none");
2062
+ if (!["none", "gray125", "solid"].includes(pattern) || (pattern === "solid" && !color) || (pattern !== "solid" && color))
2044
2063
  throw new TypeError("A solid fill requires a color; none and gray125 have no color.");
2045
- return deduplicate(this.fills, this.fillIndexes, { pattern, color: fill.color ? colorArgb(fill.color) : "" }, this.maximum + 1);
2064
+ return deduplicate(this.fills, this.fillIndexes, { pattern, color: color ? colorArgb(color) : "" }, this.maximum + 1);
2046
2065
  }
2047
2066
  addBorder(border) {
2048
- const result = {};
2049
- for (const side of ["left", "right", "top", "bottom"]) {
2050
- const edge = border[side];
2051
- if (edge) {
2052
- if (!["thin", "medium", "dashed", "dotted", "thick", "double", "hair", "dashDot", "dashDotDot", "slantDashDot", "mediumDashed", "mediumDashDot", "mediumDashDotDot"].includes(edge.style))
2053
- throw new TypeError("Invalid border style.");
2054
- result[side] = { style: edge.style, ...(edge.color ? { color: colorArgb(edge.color) } : {}) };
2055
- }
2056
- }
2057
- return deduplicate(this.borders, this.borderIndexes, result, this.maximum);
2067
+ return deduplicate(this.borders, this.borderIndexes, normalizeBorder(border), this.maximum);
2058
2068
  }
2059
2069
  addNumberFormat(format) {
2060
2070
  if (typeof format !== "string" || !format || format.length > 255)
@@ -2120,7 +2130,7 @@ class StyleRegistry {
2120
2130
  return this.compose(base, { numberFormat: this.styles[this.validateStyle(dateStyle)].numberFormat });
2121
2131
  }
2122
2132
  /** @internal Column shorthand and header style composition. */
2123
- forColumn(column, header = false, fill, date = false) {
2133
+ forColumn(column, header = false, fill, date = false, border) {
2124
2134
  const base = !header && column.style !== undefined ? this.styles[this.validateStyle(column.style)] : undefined;
2125
2135
  const format = column.format !== undefined ? column.format || NumberFormats.General : base?.numberFormat || (column.type === "date" || date ? NumberFormats.DateTime : NumberFormats.General);
2126
2136
  return this.add({
@@ -2129,7 +2139,7 @@ class StyleRegistry {
2129
2139
  wrapText: column.wrapText ?? base?.wrapText ?? false,
2130
2140
  ...(column.alignment ? { alignment: column.alignment } : base?.alignment ? { alignment: base.alignment } : {}),
2131
2141
  ...(base?.verticalAlignment ? { verticalAlignment: base.verticalAlignment } : {}),
2132
- ...(header ? { font: { bold: true } } : {}), ...(fill ? { fill: { color: fill } } : {})
2142
+ ...(header ? { font: { bold: true } } : {}), ...(fill ? { fill: { color: fill } } : {}), ...(border ? { border } : {})
2133
2143
  });
2134
2144
  }
2135
2145
  toXml() {
@@ -2154,8 +2164,8 @@ class StyleRegistry {
2154
2164
  }).join("") + '</cellXfs><cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles>' + this.differential.toXml() + '</styleSheet>';
2155
2165
  }
2156
2166
  }
2157
- const _exports = Object.freeze({ colorArgb: _m25.colorArgb, spreadsheetNamespace: spreadsheetNamespace, NumberFormats: NumberFormats, validateStylePatch: validateStylePatch, copyStylePatch: copyStylePatch, StyleRegistry: StyleRegistry });
2158
- _modules.set("077c3c668f1457253dba044e6f6be7f7afd28a8976ed20c764bd5d5dc7c41889", _exports);
2167
+ const _exports = Object.freeze({ colorArgb: _m25.colorArgb, spreadsheetNamespace: spreadsheetNamespace, normalizeBorder: normalizeBorder, NumberFormats: NumberFormats, validateStylePatch: validateStylePatch, copyStylePatch: copyStylePatch, StyleRegistry: StyleRegistry });
2168
+ _modules.set("8d96d0024443ac9aeaea70e9324b53aacef098c2385d4e6a89a76d184e28556a", _exports);
2159
2169
  return _exports;
2160
2170
  })();
2161
2171
 
@@ -3375,7 +3385,7 @@ _modules.set("13fa96d976e4dec7343dd3a392829567f1fcb574324a98f5a5d3a61c9a0dc27d",
3375
3385
  return _exports;
3376
3386
  })();
3377
3387
 
3378
- const _m31 = _modules.get("a61e744201bb537b635b367b1764bd85892101d55e00b8c78faec8be89577376") ?? (() => {
3388
+ const _m31 = _modules.get("151a5a04c5f57081eb7df9705d62fc75f098c719c8fc832c59ef3ab0c4305b6a") ?? (() => {
3379
3389
  const { checkAbort, consumeRows, inputRows, pause, taskYieldDue } = _m4;
3380
3390
 
3381
3391
  const { ChunkedTextSink, BlobByteSink } = _m3;
@@ -3486,8 +3496,9 @@ class Worksheet {
3486
3496
  book.checkLinks(this.links.length);
3487
3497
  this.declared = this.columns.map((column, i) => ({ column, letter: columnName(i + 1),
3488
3498
  style: book.styles.forColumn(column), dateStyle: book.styles.forColumn(column, false, undefined, true),
3489
- headerStyle: this.headerRows ? options.headerStyle ?? book.styles.forColumn({ header: column.header, ...(column.wrapText === undefined ? {} : { wrapText: column.wrapText }),
3490
- ...(column.alignment === undefined ? {} : { alignment: column.alignment }) }, options.boldHeader !== false, options.headerFill) : 0
3499
+ headerStyle: this.headerRows ? options.headerStyle ?? book.styles.forColumn({ header: column.header,
3500
+ ...((options.headerWrap ?? column.wrapText) === undefined ? {} : { wrapText: options.headerWrap ?? column.wrapText }),
3501
+ ...(column.alignment === undefined ? {} : { alignment: column.alignment }) }, options.boldHeader !== false, options.headerFill, false, options.headerBorder) : 0
3491
3502
  }));
3492
3503
  // Register conditional styles only after worksheet construction can no longer reject its options.
3493
3504
  this.conditional = new ConditionalFormats(conditional, book.styles);
@@ -3539,6 +3550,8 @@ class Worksheet {
3539
3550
  throw new TypeError("A frozen header or autofilter requires a header row.");
3540
3551
  if (options.headerFill !== undefined)
3541
3552
  colorArgb(options.headerFill);
3553
+ if (options.headerWrap !== undefined && typeof options.headerWrap !== "boolean")
3554
+ throw new TypeError("headerWrap must be boolean.");
3542
3555
  if (options.headerStyle !== undefined)
3543
3556
  book.styles.validateStyle(options.headerStyle);
3544
3557
  if (options.alternatingRowStyle !== undefined)
@@ -4107,11 +4120,11 @@ class Worksheet {
4107
4120
  async discard(error) { this.failed = true; this.error = error; this.pending = []; this.pendingCharacters = 0; this.prepared = undefined; this.buffer = undefined; this.nativeCharts.length = 0; this.chartSources.length = 0; this.output.discard(); await this.entry?.discard(error); }
4108
4121
  }
4109
4122
  const _exports = Object.freeze({ Worksheet: Worksheet });
4110
- _modules.set("a61e744201bb537b635b367b1764bd85892101d55e00b8c78faec8be89577376", _exports);
4123
+ _modules.set("151a5a04c5f57081eb7df9705d62fc75f098c719c8fc832c59ef3ab0c4305b6a", _exports);
4111
4124
  return _exports;
4112
4125
  })();
4113
4126
 
4114
- const _m41 = _modules.get("1b4698baf9a9c9b3505988abac9f83967c32cf37483d70a949ae89c4485532a4") ?? (() => {
4127
+ const _m41 = _modules.get("c84eae41cd3066f5463d88a1f467117b37dd9e9c9ccd8c0f8a106aa41631fea0") ?? (() => {
4115
4128
  const { escapeOoxmlAttribute, escapeXml, xmlDeclaration } = _m17;
4116
4129
 
4117
4130
  const { cellText, columnName } = _m27;
@@ -4154,7 +4167,7 @@ function tableXml(table, rowCount, policy, headerRow = 1, footer) {
4154
4167
  '" showColumnStripes="' + (options.bandedColumns ? 1 : 0) + '"/></table>';
4155
4168
  }
4156
4169
  const _exports = Object.freeze({ defineTable: defineTable, tableXml: tableXml });
4157
- _modules.set("1b4698baf9a9c9b3505988abac9f83967c32cf37483d70a949ae89c4485532a4", _exports);
4170
+ _modules.set("c84eae41cd3066f5463d88a1f467117b37dd9e9c9ccd8c0f8a106aa41631fea0", _exports);
4158
4171
  return _exports;
4159
4172
  })();
4160
4173
 
@@ -4226,13 +4239,13 @@ _modules.set("0c395783b9d7cc62dd39a21adeb698ad4a61e2c89f7b1fc8712e2eb2ccfe9d92",
4226
4239
  return _exports;
4227
4240
  })();
4228
4241
 
4229
- const _m43 = _modules.get("477ff98f49343b8ec4213008254b57a60dd42d07cb9843b3791d5e5f8e295865") ?? (() => {
4242
+ const _m43 = _modules.get("8f13b484030aa6b921e616d803614fd061f718241692003633375fab4c36045e") ?? (() => {
4230
4243
  const { captureFields } = _m10;
4231
4244
 
4232
4245
  /** @internal The workbook owner captures these settings before validation or adapter merging. */
4233
4246
  const workbookOptionFields = ["signal", "onProgress", "limits", "sink", "dateMode", "compression", "invalidCharacterPolicy", "appProperties", "cellValueWriters", "oversizedText", "creator", "title", "subject", "description", "created", "modified"];
4234
4247
  /** @internal Worksheet settings also used by the portable sheet owner. */
4235
- const sheetOptionFields = ["columns", "includeHeader", "headerRows", "freezeHeader", "autoFilter", "boldHeader", "headerFill", "headerStyle", "alternatingRowStyle", "rowStyle", "cellStyle", "rowOutline", "maxOutlineLevel", "outlineSummaryBelow", "outlineSummaryRight", "columnOutlines", "rowHeight", "headerHeight", "defaultColumnWidth", "freezeColumns", "table", "autoSize", "footer", "print", "title", "mergedCells", "hyperlinks", "conditionalFormats", "dataValidation"];
4248
+ const sheetOptionFields = ["columns", "includeHeader", "headerRows", "freezeHeader", "autoFilter", "boldHeader", "headerFill", "headerBorder", "headerWrap", "headerStyle", "alternatingRowStyle", "rowStyle", "cellStyle", "rowOutline", "maxOutlineLevel", "outlineSummaryBelow", "outlineSummaryRight", "columnOutlines", "rowHeight", "headerHeight", "defaultColumnWidth", "freezeColumns", "table", "autoSize", "footer", "print", "title", "mergedCells", "hyperlinks", "conditionalFormats", "dataValidation"];
4236
4249
  /** @internal Includes inherited format-specific ceilings before a wrapper combines stream settings. */
4237
4250
  const workbookLimitFields = ["maxRows", "maxCells", "maxTextCharacters", "maxOutputBytes", "maxStyles", "maxSheets", "maxOverflowCharacters", "maxHyperlinks", "maxImageBytes", "maxBufferedCells", "maxBufferedCharacters", "maxMergedRanges", "maxConditionalFormats", "maxDifferentialStyles", "maxCharts", "maxChartPoints", "maxChartTextCharacters", "maxFormulaCharacters", "maxDataValidations", "maxValidationTextCharacters"];
4238
4251
  /** @internal Capture the workbook's known ceilings without dropping supported prototype fields. */
@@ -4245,7 +4258,7 @@ function captureWorkbookOptions(options) {
4245
4258
  return { ...captured, ...(captured.limits === undefined ? {} : { limits: captureWorkbookLimits(captured.limits) }) };
4246
4259
  }
4247
4260
  const _exports = Object.freeze({ workbookOptionFields: workbookOptionFields, sheetOptionFields: sheetOptionFields, workbookLimitFields: workbookLimitFields, captureWorkbookLimits: captureWorkbookLimits, captureWorkbookOptions: captureWorkbookOptions });
4248
- _modules.set("477ff98f49343b8ec4213008254b57a60dd42d07cb9843b3791d5e5f8e295865", _exports);
4261
+ _modules.set("8f13b484030aa6b921e616d803614fd061f718241692003633375fab4c36045e", _exports);
4249
4262
  return _exports;
4250
4263
  })();
4251
4264
 
@@ -4552,7 +4565,7 @@ _modules.set("24f1417c3c320a8a41137c28f70b72091256c63010be0c88b684dce85f54950c",
4552
4565
  return _exports;
4553
4566
  })();
4554
4567
 
4555
- const _m22 = _modules.get("e89ecd2f5e1738c6e88f72ac2bcac70dfaa81b4aa86edf333e9b395cf2212e2a") ?? (() => {
4568
+ const _m22 = _modules.get("fe4b78533e92385c8af50681c6a1273e1f9ec6f4f9ae8342684c06e904cfb8e0") ?? (() => {
4556
4569
  const { beginTask, checkAbort, pause, taskYieldDue } = _m4;
4557
4570
 
4558
4571
  const { OfficeIMOError } = _m2;
@@ -4567,7 +4580,7 @@ const { OpcPackage, officeRelationshipsNamespace, relationshipTypes, corePropert
4567
4580
 
4568
4581
  const { escapeOoxmlAttribute, cleanXml, xmlDeclaration } = _m17;
4569
4582
 
4570
- const { StyleRegistry, spreadsheetNamespace } = _m24;
4583
+ const { StyleRegistry, spreadsheetNamespace, normalizeBorder } = _m24;
4571
4584
 
4572
4585
  const { sheetName, assertXlsxValue, copyValue } = _m27;
4573
4586
 
@@ -4608,6 +4621,8 @@ function captureSheet(options, policy) {
4608
4621
  return { ...captured, columns,
4609
4622
  ...(captured.columnOutlines === undefined ? {} : { columnOutlines: captureColumnOutlines(captured.columnOutlines, columns.length) }),
4610
4623
  ...(captured.headerRows === undefined ? {} : { headerRows: captureTableSpans(captured.headerRows, columns.length) }),
4624
+ // Preflight and every header style read this one snapshot of the edges.
4625
+ ...(captured.headerBorder === undefined ? {} : { headerBorder: normalizeBorder(captured.headerBorder) }),
4611
4626
  ...(footer ? { footer: { ...footer,
4612
4627
  ...(footer.rows === undefined ? {} : { rows: captureTableSpans(footer.rows, columns.length) }),
4613
4628
  ...(footer.values === undefined ? {} : { values: footer.values.map(copyValue) }) } } : {}),
@@ -5033,11 +5048,11 @@ class Workbook {
5033
5048
  }
5034
5049
  }
5035
5050
  const _exports = Object.freeze({ Workbook: Workbook });
5036
- _modules.set("e89ecd2f5e1738c6e88f72ac2bcac70dfaa81b4aa86edf333e9b395cf2212e2a", _exports);
5051
+ _modules.set("fe4b78533e92385c8af50681c6a1273e1f9ec6f4f9ae8342684c06e904cfb8e0", _exports);
5037
5052
  return _exports;
5038
5053
  })();
5039
5054
 
5040
- const _m47 = _modules.get("a10003e971cd5ec2cee127bc9b029a0aa06fe3d50112838929d7a04a55e177c0") ?? (() => {
5055
+ const _m47 = _modules.get("62ff1bcbf8ca07e8ab92cd1f6afbd54049346193e18160ab0afec48e03950bba") ?? (() => {
5041
5056
  const { ExportCell, assertScalar } = _m5;
5042
5057
 
5043
5058
  const { captureWorkbookOptions, sheetOptionFields } = _m43;
@@ -5059,7 +5074,7 @@ function value(result) {
5059
5074
  function portableSheet(options = {}) {
5060
5075
  options = captureFields(options, sheetOptionFields);
5061
5076
  if (options.headerStyle !== undefined)
5062
- throw new TypeError("Workbook-local header styles require the advanced Workbook API; use boldHeader and headerFill.");
5077
+ throw new TypeError("Workbook-local header styles require the advanced Workbook API; use boldHeader, headerFill, headerBorder and headerWrap.");
5063
5078
  style(options.alternatingRowStyle);
5064
5079
  style(options.title?.style);
5065
5080
  style(options.footer?.style);
@@ -5086,11 +5101,11 @@ function portableWorkbook(options = {}) {
5086
5101
  return { ...options, cellValueWriters: wrapped };
5087
5102
  }
5088
5103
  const _exports = Object.freeze({ portableSheet: portableSheet, portableWorkbook: portableWorkbook });
5089
- _modules.set("a10003e971cd5ec2cee127bc9b029a0aa06fe3d50112838929d7a04a55e177c0", _exports);
5104
+ _modules.set("62ff1bcbf8ca07e8ab92cd1f6afbd54049346193e18160ab0afec48e03950bba", _exports);
5090
5105
  return _exports;
5091
5106
  })();
5092
5107
 
5093
- const _m46 = _modules.get("5bfd5c9c5e179305b9bebd6cb0d6a0d75e974b223e119e0fd4fbb773325f1e63") ?? (() => {
5108
+ const _m46 = _modules.get("05d6afb9e04ef4bfee413c0cee45f432de701dd04c8673077e711f82ed4a3471") ?? (() => {
5094
5109
  const { withDestination } = _m3;
5095
5110
 
5096
5111
  const { copyColumns } = _m11;
@@ -5145,11 +5160,11 @@ async function writeXlsxTo(rows, destination, configuration) {
5145
5160
  });
5146
5161
  }
5147
5162
  const _exports = Object.freeze({ writeXlsx: writeXlsx, writeXlsxTo: writeXlsxTo });
5148
- _modules.set("5bfd5c9c5e179305b9bebd6cb0d6a0d75e974b223e119e0fd4fbb773325f1e63", _exports);
5163
+ _modules.set("05d6afb9e04ef4bfee413c0cee45f432de701dd04c8673077e711f82ed4a3471", _exports);
5149
5164
  return _exports;
5150
5165
  })();
5151
5166
 
5152
- const _m49 = _modules.get("dd34d5fd89869a0f953f3f2b3fd27ac83be29e68f76c9087fae3d33095aeda7c") ?? (() => {
5167
+ const _m49 = _modules.get("8df3d4472935cf1e82313946c2473abf41dd8c539922d3283439958b72548576") ?? (() => {
5153
5168
  const { assertGroupedReportSource } = _m8;
5154
5169
 
5155
5170
  const { captureFields } = _m10;
@@ -5238,11 +5253,11 @@ function prepareGroupedSheet(report, configuration, maxConditionalFormats = 1000
5238
5253
  ...(options.grandTotalStyle ? { grandTotalStyle: copyStylePatch(options.grandTotalStyle) } : {}) };
5239
5254
  }
5240
5255
  const _exports = Object.freeze({ groupedOptionFields: groupedOptionFields, prepareGroupedSheet: prepareGroupedSheet });
5241
- _modules.set("dd34d5fd89869a0f953f3f2b3fd27ac83be29e68f76c9087fae3d33095aeda7c", _exports);
5256
+ _modules.set("8df3d4472935cf1e82313946c2473abf41dd8c539922d3283439958b72548576", _exports);
5242
5257
  return _exports;
5243
5258
  })();
5244
5259
 
5245
- const _m48 = _modules.get("2ba62cdf88d559804bb84b20e9816b2de0f232401b7431ac414699a607d554a4") ?? (() => {
5260
+ const _m48 = _modules.get("26f5f707c4feb95052da5c9787df79bf6a94178780b276c4f74677ce0f96e87a") ?? (() => {
5246
5261
  const { groupedReportOperation } = _m8;
5247
5262
 
5248
5263
  const { checkAbort, withAbort } = _m4;
@@ -5415,14 +5430,14 @@ async function writeGroupedXlsxTo(report, destination, options) {
5415
5430
  return withDestination(destination, async (sink) => (await write(report, prepared, sink)).result);
5416
5431
  }
5417
5432
  const _exports = Object.freeze({ addGroupedXlsx: addGroupedXlsx, writeGroupedXlsx: writeGroupedXlsx, writeGroupedXlsxTo: writeGroupedXlsxTo });
5418
- _modules.set("2ba62cdf88d559804bb84b20e9816b2de0f232401b7431ac414699a607d554a4", _exports);
5433
+ _modules.set("26f5f707c4feb95052da5c9787df79bf6a94178780b276c4f74677ce0f96e87a", _exports);
5419
5434
  return _exports;
5420
5435
  })();
5421
5436
 
5422
- const _m21 = _modules.get("d6587a933b36ccfdba9a2a252389924ac8461f672b3a500082cceb5e53c8b0b6") ?? (() => {
5437
+ const _m21 = _modules.get("e5310c591178a3de9292f150e2e6f1477b94b895ef0c90840c72adef00f75974") ?? (() => {
5423
5438
 
5424
5439
  const _exports = Object.freeze({ Workbook: _m22.Workbook, writeXlsx: _m46.writeXlsx, writeXlsxTo: _m46.writeXlsxTo, writeGroupedXlsx: _m48.writeGroupedXlsx, writeGroupedXlsxTo: _m48.writeGroupedXlsxTo, addGroupedXlsx: _m48.addGroupedXlsx, createGroupedReport: _m8.createGroupedReport, Worksheet: _m31.Worksheet, Cell: _m27.Cell, FormulaCell: _m28.FormulaCell, StyleRegistry: _m24.StyleRegistry, NumberFormats: _m24.NumberFormats, saveBlob: _m1.saveBlob, ExportCell: _m5.ExportCell });
5425
- _modules.set("d6587a933b36ccfdba9a2a252389924ac8461f672b3a500082cceb5e53c8b0b6", _exports);
5440
+ _modules.set("e5310c591178a3de9292f150e2e6f1477b94b895ef0c90840c72adef00f75974", _exports);
5426
5441
  return _exports;
5427
5442
  })();
5428
5443
 
@@ -11630,10 +11645,10 @@ _modules.set("027aafa08408056b10d7d717d63d1f7c0ee20ecfc68213aa66feacc75ec525fe",
11630
11645
  return _exports;
11631
11646
  })();
11632
11647
 
11633
- const _m0 = _modules.get("24797253ebcf6e25ce43ac76d1f16d0ce85b477a461faa1d167dabbea8e43968") ?? (() => {
11648
+ const _m0 = _modules.get("110c4a3e9a69d6b2bb50ac123a355f60aaa1d1e37e572c919bc19f4f4ec2782e") ?? (() => {
11634
11649
 
11635
11650
  const _exports = Object.freeze({ core: _m1, zip: _m14, xml: _m17, opc: _m18, xlsx: _m21, csv: _m50, pdf: _m54, Workbook: _m21.Workbook, Worksheet: _m21.Worksheet, Cell: _m21.Cell, FormulaCell: _m21.FormulaCell, StyleRegistry: _m21.StyleRegistry, NumberFormats: _m21.NumberFormats, writeXlsx: _m21.writeXlsx, writeXlsxTo: _m21.writeXlsxTo, writeCsv: _m50.writeCsv, writeCsvTo: _m50.writeCsvTo, createGroupedReport: _m8.createGroupedReport, writeGroupedXlsx: _m48.writeGroupedXlsx, writeGroupedXlsxTo: _m48.writeGroupedXlsxTo, addGroupedXlsx: _m48.addGroupedXlsx, writeGroupedPdf: _m83.writeGroupedPdf, writeGroupedPdfTo: _m83.writeGroupedPdfTo, pdfGroupedTable: _m83.pdfGroupedTable, writePdf: _m54.writePdf, writePdfTo: _m54.writePdfTo, writePdfDocument: _m54.writePdfDocument, writePdfDocumentTo: _m54.writePdfDocumentTo, pdfTable: _m54.pdfTable, PdfFont: _m54.PdfFont, preflightPdfText: _m54.preflightPdfText, OfficeIMOError: _m1.OfficeIMOError, NotSupportedError: _m1.NotSupportedError, detectFeatures: _m1.detectFeatures, saveBlob: _m1.saveBlob, ExportCell: _m1.ExportCell });
11636
- _modules.set("24797253ebcf6e25ce43ac76d1f16d0ce85b477a461faa1d167dabbea8e43968", _exports);
11651
+ _modules.set("110c4a3e9a69d6b2bb50ac123a355f60aaa1d1e37e572c919bc19f4f4ec2782e", _exports);
11637
11652
  return _exports;
11638
11653
  })();
11639
11654
  Object.assign(officeimo, _m0);