@evotecit/officeimo 0.1.9 → 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 (43) hide show
  1. package/README.md +6 -3
  2. package/bundles/officeimo-canopyx-adapter.js +123 -61
  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 +109 -48
  6. package/bundles/officeimo-canopyx.js +179 -102
  7. package/bundles/officeimo-canopyx.min.js +1 -1
  8. package/bundles/officeimo-canopyx.min.mjs +1 -1
  9. package/bundles/officeimo-canopyx.mjs +145 -69
  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/metadata.js +1 -1
  28. package/dist/integrations/canopyx/pdf-number.js +9 -6
  29. package/dist/integrations/canopyx/rule-predicates.d.ts +1 -1
  30. package/dist/integrations/canopyx/rule-predicates.js +2 -1
  31. package/dist/integrations/canopyx/rules.d.ts +1 -1
  32. package/dist/integrations/canopyx/rules.js +11 -13
  33. package/dist/integrations/canopyx/source.js +44 -7
  34. package/dist/integrations/canopyx/tones.d.ts +10 -0
  35. package/dist/integrations/canopyx/tones.js +12 -0
  36. package/dist/integrations/canopyx/types.d.ts +10 -2
  37. package/dist/xlsx/options.js +1 -1
  38. package/dist/xlsx/portable.js +1 -1
  39. package/dist/xlsx/styles.js +28 -18
  40. package/dist/xlsx/types.d.ts +5 -1
  41. package/dist/xlsx/workbook.js +3 -1
  42. package/dist/xlsx/worksheet.js +5 -2
  43. package/package.json +1 -1
@@ -2199,6 +2199,24 @@ const { DifferentialStyles } = _m31;
2199
2199
 
2200
2200
 
2201
2201
  const spreadsheetNamespace = "http://schemas.openxmlformats.org/spreadsheetml/2006/main";
2202
+ const borderStyles = ["thin", "medium", "dashed", "dotted", "thick", "double", "hair", "dashDot", "dashDotDot", "slantDashDot", "mediumDashed", "mediumDashDot", "mediumDashDotDot"];
2203
+ /** @internal Validate and normalize border edges without registering a workbook style. */
2204
+ function normalizeBorder(border) {
2205
+ if (!border || typeof border !== "object")
2206
+ throw new TypeError("A border must be an object of edges.");
2207
+ const result = {};
2208
+ for (const side of ["left", "right", "top", "bottom"]) {
2209
+ const edge = border[side];
2210
+ if (edge) {
2211
+ // Read each property once, so the validated edge is the one that is stored.
2212
+ const { style, color } = edge;
2213
+ if (!borderStyles.includes(style))
2214
+ throw new TypeError("Invalid border style.");
2215
+ result[side] = { style, ...(color ? { color: colorArgb(color) } : {}) };
2216
+ }
2217
+ }
2218
+ return result;
2219
+ }
2202
2220
  const NumberFormats = { General: "General", Integer: "0", Decimal: "0.00", Percent: "0.00%", Date: "yyyy-mm-dd", DateTime: "yyyy-mm-dd hh:mm:ss" };
2203
2221
  function index(value, count, kind) {
2204
2222
  if (!Number.isInteger(value) || value < 0 || value >= count)
@@ -2271,32 +2289,24 @@ class StyleRegistry {
2271
2289
  /** @internal */
2272
2290
  addDifferentials(styles) { this.checkDifferentials(styles); return this.differential.add(styles); }
2273
2291
  addFont(font) {
2274
- if (font.name !== undefined && typeof font.name !== "string")
2292
+ const { name: requested, size: requestedSize, bold, italic, underline, strike, color } = font;
2293
+ if (requested !== undefined && typeof requested !== "string")
2275
2294
  throw new TypeError("Font name must be a string.");
2276
- const name = cleanXml(font.name ?? "Calibri", this.policy), size = font.size ?? 11;
2295
+ const name = cleanXml(requested ?? "Calibri", this.policy), size = requestedSize ?? 11;
2277
2296
  if (typeof name !== "string" || !name || name.length > 31)
2278
2297
  throw new TypeError("Font name must contain 1 through 31 characters.");
2279
2298
  if (!Number.isFinite(size) || size <= 0 || size > 409)
2280
2299
  throw new RangeError("Font size must be positive and at most 409.");
2281
- 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);
2300
+ return deduplicate(this.fonts, this.fontIndexes, { name, size, bold: !!bold, italic: !!italic, underline: !!underline, strike: !!strike, color: color ? colorArgb(color) : "" }, this.maximum);
2282
2301
  }
2283
2302
  addFill(fill) {
2284
- const pattern = fill.pattern ?? (fill.color ? "solid" : "none");
2285
- if (!["none", "gray125", "solid"].includes(pattern) || (pattern === "solid" && !fill.color) || (pattern !== "solid" && fill.color))
2303
+ const { color } = fill, pattern = fill.pattern ?? (color ? "solid" : "none");
2304
+ if (!["none", "gray125", "solid"].includes(pattern) || (pattern === "solid" && !color) || (pattern !== "solid" && color))
2286
2305
  throw new TypeError("A solid fill requires a color; none and gray125 have no color.");
2287
- return deduplicate(this.fills, this.fillIndexes, { pattern, color: fill.color ? colorArgb(fill.color) : "" }, this.maximum + 1);
2306
+ return deduplicate(this.fills, this.fillIndexes, { pattern, color: color ? colorArgb(color) : "" }, this.maximum + 1);
2288
2307
  }
2289
2308
  addBorder(border) {
2290
- const result = {};
2291
- for (const side of ["left", "right", "top", "bottom"]) {
2292
- const edge = border[side];
2293
- if (edge) {
2294
- if (!["thin", "medium", "dashed", "dotted", "thick", "double", "hair", "dashDot", "dashDotDot", "slantDashDot", "mediumDashed", "mediumDashDot", "mediumDashDotDot"].includes(edge.style))
2295
- throw new TypeError("Invalid border style.");
2296
- result[side] = { style: edge.style, ...(edge.color ? { color: colorArgb(edge.color) } : {}) };
2297
- }
2298
- }
2299
- return deduplicate(this.borders, this.borderIndexes, result, this.maximum);
2309
+ return deduplicate(this.borders, this.borderIndexes, normalizeBorder(border), this.maximum);
2300
2310
  }
2301
2311
  addNumberFormat(format) {
2302
2312
  if (typeof format !== "string" || !format || format.length > 255)
@@ -2362,7 +2372,7 @@ class StyleRegistry {
2362
2372
  return this.compose(base, { numberFormat: this.styles[this.validateStyle(dateStyle)].numberFormat });
2363
2373
  }
2364
2374
  /** @internal Column shorthand and header style composition. */
2365
- forColumn(column, header = false, fill, date = false) {
2375
+ forColumn(column, header = false, fill, date = false, border) {
2366
2376
  const base = !header && column.style !== undefined ? this.styles[this.validateStyle(column.style)] : undefined;
2367
2377
  const format = column.format !== undefined ? column.format || NumberFormats.General : base?.numberFormat || (column.type === "date" || date ? NumberFormats.DateTime : NumberFormats.General);
2368
2378
  return this.add({
@@ -2371,7 +2381,7 @@ class StyleRegistry {
2371
2381
  wrapText: column.wrapText ?? base?.wrapText ?? false,
2372
2382
  ...(column.alignment ? { alignment: column.alignment } : base?.alignment ? { alignment: base.alignment } : {}),
2373
2383
  ...(base?.verticalAlignment ? { verticalAlignment: base.verticalAlignment } : {}),
2374
- ...(header ? { font: { bold: true } } : {}), ...(fill ? { fill: { color: fill } } : {})
2384
+ ...(header ? { font: { bold: true } } : {}), ...(fill ? { fill: { color: fill } } : {}), ...(border ? { border } : {})
2375
2385
  });
2376
2386
  }
2377
2387
  toXml() {
@@ -2396,7 +2406,7 @@ class StyleRegistry {
2396
2406
  }).join("") + '</cellXfs><cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles>' + this.differential.toXml() + '</styleSheet>';
2397
2407
  }
2398
2408
  }
2399
- const _exports = Object.freeze({ colorArgb: _m30.colorArgb, spreadsheetNamespace: spreadsheetNamespace, NumberFormats: NumberFormats, validateStylePatch: validateStylePatch, copyStylePatch: copyStylePatch, StyleRegistry: StyleRegistry });
2409
+ const _exports = Object.freeze({ colorArgb: _m30.colorArgb, spreadsheetNamespace: spreadsheetNamespace, normalizeBorder: normalizeBorder, NumberFormats: NumberFormats, validateStylePatch: validateStylePatch, copyStylePatch: copyStylePatch, StyleRegistry: StyleRegistry });
2400
2410
  return _exports;
2401
2411
  })();
2402
2412
 
@@ -3649,8 +3659,9 @@ class Worksheet {
3649
3659
  book.checkLinks(this.links.length);
3650
3660
  this.declared = this.columns.map((column, i) => ({ column, letter: columnName(i + 1),
3651
3661
  style: book.styles.forColumn(column), dateStyle: book.styles.forColumn(column, false, undefined, true),
3652
- headerStyle: this.headerRows ? options.headerStyle ?? book.styles.forColumn({ header: column.header, ...(column.wrapText === undefined ? {} : { wrapText: column.wrapText }),
3653
- ...(column.alignment === undefined ? {} : { alignment: column.alignment }) }, options.boldHeader !== false, options.headerFill) : 0
3662
+ headerStyle: this.headerRows ? options.headerStyle ?? book.styles.forColumn({ header: column.header,
3663
+ ...((options.headerWrap ?? column.wrapText) === undefined ? {} : { wrapText: options.headerWrap ?? column.wrapText }),
3664
+ ...(column.alignment === undefined ? {} : { alignment: column.alignment }) }, options.boldHeader !== false, options.headerFill, false, options.headerBorder) : 0
3654
3665
  }));
3655
3666
  // Register conditional styles only after worksheet construction can no longer reject its options.
3656
3667
  this.conditional = new ConditionalFormats(conditional, book.styles);
@@ -3702,6 +3713,8 @@ class Worksheet {
3702
3713
  throw new TypeError("A frozen header or autofilter requires a header row.");
3703
3714
  if (options.headerFill !== undefined)
3704
3715
  colorArgb(options.headerFill);
3716
+ if (options.headerWrap !== undefined && typeof options.headerWrap !== "boolean")
3717
+ throw new TypeError("headerWrap must be boolean.");
3705
3718
  if (options.headerStyle !== undefined)
3706
3719
  book.styles.validateStyle(options.headerStyle);
3707
3720
  if (options.alternatingRowStyle !== undefined)
@@ -4392,7 +4405,7 @@ const { captureFields } = _m10;
4392
4405
  /** @internal The workbook owner captures these settings before validation or adapter merging. */
4393
4406
  const workbookOptionFields = ["signal", "onProgress", "limits", "sink", "dateMode", "compression", "invalidCharacterPolicy", "appProperties", "cellValueWriters", "oversizedText", "creator", "title", "subject", "description", "created", "modified"];
4394
4407
  /** @internal Worksheet settings also used by the portable sheet owner. */
4395
- 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"];
4408
+ 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"];
4396
4409
  /** @internal Includes inherited format-specific ceilings before a wrapper combines stream settings. */
4397
4410
  const workbookLimitFields = ["maxRows", "maxCells", "maxTextCharacters", "maxOutputBytes", "maxStyles", "maxSheets", "maxOverflowCharacters", "maxHyperlinks", "maxImageBytes", "maxBufferedCells", "maxBufferedCharacters", "maxMergedRanges", "maxConditionalFormats", "maxDifferentialStyles", "maxCharts", "maxChartPoints", "maxChartTextCharacters", "maxFormulaCharacters", "maxDataValidations", "maxValidationTextCharacters"];
4398
4411
  /** @internal Capture the workbook's known ceilings without dropping supported prototype fields. */
@@ -4724,7 +4737,7 @@ const { OpcPackage, officeRelationshipsNamespace, relationshipTypes, corePropert
4724
4737
 
4725
4738
  const { escapeOoxmlAttribute, cleanXml, xmlDeclaration } = _m25;
4726
4739
 
4727
- const { StyleRegistry, spreadsheetNamespace } = _m29;
4740
+ const { StyleRegistry, spreadsheetNamespace, normalizeBorder } = _m29;
4728
4741
 
4729
4742
  const { sheetName, assertXlsxValue, copyValue } = _m32;
4730
4743
 
@@ -4765,6 +4778,8 @@ function captureSheet(options, policy) {
4765
4778
  return { ...captured, columns,
4766
4779
  ...(captured.columnOutlines === undefined ? {} : { columnOutlines: captureColumnOutlines(captured.columnOutlines, columns.length) }),
4767
4780
  ...(captured.headerRows === undefined ? {} : { headerRows: captureTableSpans(captured.headerRows, columns.length) }),
4781
+ // Preflight and every header style read this one snapshot of the edges.
4782
+ ...(captured.headerBorder === undefined ? {} : { headerBorder: normalizeBorder(captured.headerBorder) }),
4768
4783
  ...(footer ? { footer: { ...footer,
4769
4784
  ...(footer.rows === undefined ? {} : { rows: captureTableSpans(footer.rows, columns.length) }),
4770
4785
  ...(footer.values === undefined ? {} : { values: footer.values.map(copyValue) }) } } : {}),
@@ -5215,7 +5230,7 @@ function value(result) {
5215
5230
  function portableSheet(options = {}) {
5216
5231
  options = captureFields(options, sheetOptionFields);
5217
5232
  if (options.headerStyle !== undefined)
5218
- throw new TypeError("Workbook-local header styles require the advanced Workbook API; use boldHeader and headerFill.");
5233
+ throw new TypeError("Workbook-local header styles require the advanced Workbook API; use boldHeader, headerFill, headerBorder and headerWrap.");
5219
5234
  style(options.alternatingRowStyle);
5220
5235
  style(options.title?.style);
5221
5236
  style(options.footer?.style);
@@ -1386,7 +1386,7 @@ _modules.set("6ae88f25e1c09d00fbb828917498569f883fae88ec25d37caebaf8a2b802b148",
1386
1386
  return _exports;
1387
1387
  })();
1388
1388
 
1389
- const _m16 = _modules.get("077c3c668f1457253dba044e6f6be7f7afd28a8976ed20c764bd5d5dc7c41889") ?? (() => {
1389
+ const _m16 = _modules.get("8d96d0024443ac9aeaea70e9324b53aacef098c2385d4e6a89a76d184e28556a") ?? (() => {
1390
1390
  const { escapeOoxmlAttribute, cleanXml, xmlDeclaration } = _m11;
1391
1391
 
1392
1392
  const { OfficeIMOError } = _m3;
@@ -1398,6 +1398,24 @@ const { DifferentialStyles } = _m18;
1398
1398
 
1399
1399
 
1400
1400
  const spreadsheetNamespace = "http://schemas.openxmlformats.org/spreadsheetml/2006/main";
1401
+ const borderStyles = ["thin", "medium", "dashed", "dotted", "thick", "double", "hair", "dashDot", "dashDotDot", "slantDashDot", "mediumDashed", "mediumDashDot", "mediumDashDotDot"];
1402
+ /** @internal Validate and normalize border edges without registering a workbook style. */
1403
+ function normalizeBorder(border) {
1404
+ if (!border || typeof border !== "object")
1405
+ throw new TypeError("A border must be an object of edges.");
1406
+ const result = {};
1407
+ for (const side of ["left", "right", "top", "bottom"]) {
1408
+ const edge = border[side];
1409
+ if (edge) {
1410
+ // Read each property once, so the validated edge is the one that is stored.
1411
+ const { style, color } = edge;
1412
+ if (!borderStyles.includes(style))
1413
+ throw new TypeError("Invalid border style.");
1414
+ result[side] = { style, ...(color ? { color: colorArgb(color) } : {}) };
1415
+ }
1416
+ }
1417
+ return result;
1418
+ }
1401
1419
  const NumberFormats = { General: "General", Integer: "0", Decimal: "0.00", Percent: "0.00%", Date: "yyyy-mm-dd", DateTime: "yyyy-mm-dd hh:mm:ss" };
1402
1420
  function index(value, count, kind) {
1403
1421
  if (!Number.isInteger(value) || value < 0 || value >= count)
@@ -1470,32 +1488,24 @@ class StyleRegistry {
1470
1488
  /** @internal */
1471
1489
  addDifferentials(styles) { this.checkDifferentials(styles); return this.differential.add(styles); }
1472
1490
  addFont(font) {
1473
- if (font.name !== undefined && typeof font.name !== "string")
1491
+ const { name: requested, size: requestedSize, bold, italic, underline, strike, color } = font;
1492
+ if (requested !== undefined && typeof requested !== "string")
1474
1493
  throw new TypeError("Font name must be a string.");
1475
- const name = cleanXml(font.name ?? "Calibri", this.policy), size = font.size ?? 11;
1494
+ const name = cleanXml(requested ?? "Calibri", this.policy), size = requestedSize ?? 11;
1476
1495
  if (typeof name !== "string" || !name || name.length > 31)
1477
1496
  throw new TypeError("Font name must contain 1 through 31 characters.");
1478
1497
  if (!Number.isFinite(size) || size <= 0 || size > 409)
1479
1498
  throw new RangeError("Font size must be positive and at most 409.");
1480
- 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);
1499
+ return deduplicate(this.fonts, this.fontIndexes, { name, size, bold: !!bold, italic: !!italic, underline: !!underline, strike: !!strike, color: color ? colorArgb(color) : "" }, this.maximum);
1481
1500
  }
1482
1501
  addFill(fill) {
1483
- const pattern = fill.pattern ?? (fill.color ? "solid" : "none");
1484
- if (!["none", "gray125", "solid"].includes(pattern) || (pattern === "solid" && !fill.color) || (pattern !== "solid" && fill.color))
1502
+ const { color } = fill, pattern = fill.pattern ?? (color ? "solid" : "none");
1503
+ if (!["none", "gray125", "solid"].includes(pattern) || (pattern === "solid" && !color) || (pattern !== "solid" && color))
1485
1504
  throw new TypeError("A solid fill requires a color; none and gray125 have no color.");
1486
- return deduplicate(this.fills, this.fillIndexes, { pattern, color: fill.color ? colorArgb(fill.color) : "" }, this.maximum + 1);
1505
+ return deduplicate(this.fills, this.fillIndexes, { pattern, color: color ? colorArgb(color) : "" }, this.maximum + 1);
1487
1506
  }
1488
1507
  addBorder(border) {
1489
- const result = {};
1490
- for (const side of ["left", "right", "top", "bottom"]) {
1491
- const edge = border[side];
1492
- if (edge) {
1493
- if (!["thin", "medium", "dashed", "dotted", "thick", "double", "hair", "dashDot", "dashDotDot", "slantDashDot", "mediumDashed", "mediumDashDot", "mediumDashDotDot"].includes(edge.style))
1494
- throw new TypeError("Invalid border style.");
1495
- result[side] = { style: edge.style, ...(edge.color ? { color: colorArgb(edge.color) } : {}) };
1496
- }
1497
- }
1498
- return deduplicate(this.borders, this.borderIndexes, result, this.maximum);
1508
+ return deduplicate(this.borders, this.borderIndexes, normalizeBorder(border), this.maximum);
1499
1509
  }
1500
1510
  addNumberFormat(format) {
1501
1511
  if (typeof format !== "string" || !format || format.length > 255)
@@ -1561,7 +1571,7 @@ class StyleRegistry {
1561
1571
  return this.compose(base, { numberFormat: this.styles[this.validateStyle(dateStyle)].numberFormat });
1562
1572
  }
1563
1573
  /** @internal Column shorthand and header style composition. */
1564
- forColumn(column, header = false, fill, date = false) {
1574
+ forColumn(column, header = false, fill, date = false, border) {
1565
1575
  const base = !header && column.style !== undefined ? this.styles[this.validateStyle(column.style)] : undefined;
1566
1576
  const format = column.format !== undefined ? column.format || NumberFormats.General : base?.numberFormat || (column.type === "date" || date ? NumberFormats.DateTime : NumberFormats.General);
1567
1577
  return this.add({
@@ -1570,7 +1580,7 @@ class StyleRegistry {
1570
1580
  wrapText: column.wrapText ?? base?.wrapText ?? false,
1571
1581
  ...(column.alignment ? { alignment: column.alignment } : base?.alignment ? { alignment: base.alignment } : {}),
1572
1582
  ...(base?.verticalAlignment ? { verticalAlignment: base.verticalAlignment } : {}),
1573
- ...(header ? { font: { bold: true } } : {}), ...(fill ? { fill: { color: fill } } : {})
1583
+ ...(header ? { font: { bold: true } } : {}), ...(fill ? { fill: { color: fill } } : {}), ...(border ? { border } : {})
1574
1584
  });
1575
1585
  }
1576
1586
  toXml() {
@@ -1595,8 +1605,8 @@ class StyleRegistry {
1595
1605
  }).join("") + '</cellXfs><cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles>' + this.differential.toXml() + '</styleSheet>';
1596
1606
  }
1597
1607
  }
1598
- const _exports = Object.freeze({ colorArgb: _m17.colorArgb, spreadsheetNamespace: spreadsheetNamespace, NumberFormats: NumberFormats, validateStylePatch: validateStylePatch, copyStylePatch: copyStylePatch, StyleRegistry: StyleRegistry });
1599
- _modules.set("077c3c668f1457253dba044e6f6be7f7afd28a8976ed20c764bd5d5dc7c41889", _exports);
1608
+ const _exports = Object.freeze({ colorArgb: _m17.colorArgb, spreadsheetNamespace: spreadsheetNamespace, normalizeBorder: normalizeBorder, NumberFormats: NumberFormats, validateStylePatch: validateStylePatch, copyStylePatch: copyStylePatch, StyleRegistry: StyleRegistry });
1609
+ _modules.set("8d96d0024443ac9aeaea70e9324b53aacef098c2385d4e6a89a76d184e28556a", _exports);
1600
1610
  return _exports;
1601
1611
  })();
1602
1612
 
@@ -3060,7 +3070,7 @@ _modules.set("13fa96d976e4dec7343dd3a392829567f1fcb574324a98f5a5d3a61c9a0dc27d",
3060
3070
  return _exports;
3061
3071
  })();
3062
3072
 
3063
- const _m27 = _modules.get("a61e744201bb537b635b367b1764bd85892101d55e00b8c78faec8be89577376") ?? (() => {
3073
+ const _m27 = _modules.get("151a5a04c5f57081eb7df9705d62fc75f098c719c8fc832c59ef3ab0c4305b6a") ?? (() => {
3064
3074
  const { checkAbort, consumeRows, inputRows, pause, taskYieldDue } = _m2;
3065
3075
 
3066
3076
  const { ChunkedTextSink, BlobByteSink } = _m5;
@@ -3171,8 +3181,9 @@ class Worksheet {
3171
3181
  book.checkLinks(this.links.length);
3172
3182
  this.declared = this.columns.map((column, i) => ({ column, letter: columnName(i + 1),
3173
3183
  style: book.styles.forColumn(column), dateStyle: book.styles.forColumn(column, false, undefined, true),
3174
- headerStyle: this.headerRows ? options.headerStyle ?? book.styles.forColumn({ header: column.header, ...(column.wrapText === undefined ? {} : { wrapText: column.wrapText }),
3175
- ...(column.alignment === undefined ? {} : { alignment: column.alignment }) }, options.boldHeader !== false, options.headerFill) : 0
3184
+ headerStyle: this.headerRows ? options.headerStyle ?? book.styles.forColumn({ header: column.header,
3185
+ ...((options.headerWrap ?? column.wrapText) === undefined ? {} : { wrapText: options.headerWrap ?? column.wrapText }),
3186
+ ...(column.alignment === undefined ? {} : { alignment: column.alignment }) }, options.boldHeader !== false, options.headerFill, false, options.headerBorder) : 0
3176
3187
  }));
3177
3188
  // Register conditional styles only after worksheet construction can no longer reject its options.
3178
3189
  this.conditional = new ConditionalFormats(conditional, book.styles);
@@ -3224,6 +3235,8 @@ class Worksheet {
3224
3235
  throw new TypeError("A frozen header or autofilter requires a header row.");
3225
3236
  if (options.headerFill !== undefined)
3226
3237
  colorArgb(options.headerFill);
3238
+ if (options.headerWrap !== undefined && typeof options.headerWrap !== "boolean")
3239
+ throw new TypeError("headerWrap must be boolean.");
3227
3240
  if (options.headerStyle !== undefined)
3228
3241
  book.styles.validateStyle(options.headerStyle);
3229
3242
  if (options.alternatingRowStyle !== undefined)
@@ -3792,11 +3805,11 @@ class Worksheet {
3792
3805
  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); }
3793
3806
  }
3794
3807
  const _exports = Object.freeze({ Worksheet: Worksheet });
3795
- _modules.set("a61e744201bb537b635b367b1764bd85892101d55e00b8c78faec8be89577376", _exports);
3808
+ _modules.set("151a5a04c5f57081eb7df9705d62fc75f098c719c8fc832c59ef3ab0c4305b6a", _exports);
3796
3809
  return _exports;
3797
3810
  })();
3798
3811
 
3799
- const _m38 = _modules.get("1b4698baf9a9c9b3505988abac9f83967c32cf37483d70a949ae89c4485532a4") ?? (() => {
3812
+ const _m38 = _modules.get("c84eae41cd3066f5463d88a1f467117b37dd9e9c9ccd8c0f8a106aa41631fea0") ?? (() => {
3800
3813
  const { escapeOoxmlAttribute, escapeXml, xmlDeclaration } = _m11;
3801
3814
 
3802
3815
  const { cellText, columnName } = _m19;
@@ -3839,7 +3852,7 @@ function tableXml(table, rowCount, policy, headerRow = 1, footer) {
3839
3852
  '" showColumnStripes="' + (options.bandedColumns ? 1 : 0) + '"/></table>';
3840
3853
  }
3841
3854
  const _exports = Object.freeze({ defineTable: defineTable, tableXml: tableXml });
3842
- _modules.set("1b4698baf9a9c9b3505988abac9f83967c32cf37483d70a949ae89c4485532a4", _exports);
3855
+ _modules.set("c84eae41cd3066f5463d88a1f467117b37dd9e9c9ccd8c0f8a106aa41631fea0", _exports);
3843
3856
  return _exports;
3844
3857
  })();
3845
3858
 
@@ -3911,13 +3924,13 @@ _modules.set("0c395783b9d7cc62dd39a21adeb698ad4a61e2c89f7b1fc8712e2eb2ccfe9d92",
3911
3924
  return _exports;
3912
3925
  })();
3913
3926
 
3914
- const _m40 = _modules.get("477ff98f49343b8ec4213008254b57a60dd42d07cb9843b3791d5e5f8e295865") ?? (() => {
3927
+ const _m40 = _modules.get("8f13b484030aa6b921e616d803614fd061f718241692003633375fab4c36045e") ?? (() => {
3915
3928
  const { captureFields } = _m7;
3916
3929
 
3917
3930
  /** @internal The workbook owner captures these settings before validation or adapter merging. */
3918
3931
  const workbookOptionFields = ["signal", "onProgress", "limits", "sink", "dateMode", "compression", "invalidCharacterPolicy", "appProperties", "cellValueWriters", "oversizedText", "creator", "title", "subject", "description", "created", "modified"];
3919
3932
  /** @internal Worksheet settings also used by the portable sheet owner. */
3920
- 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"];
3933
+ 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"];
3921
3934
  /** @internal Includes inherited format-specific ceilings before a wrapper combines stream settings. */
3922
3935
  const workbookLimitFields = ["maxRows", "maxCells", "maxTextCharacters", "maxOutputBytes", "maxStyles", "maxSheets", "maxOverflowCharacters", "maxHyperlinks", "maxImageBytes", "maxBufferedCells", "maxBufferedCharacters", "maxMergedRanges", "maxConditionalFormats", "maxDifferentialStyles", "maxCharts", "maxChartPoints", "maxChartTextCharacters", "maxFormulaCharacters", "maxDataValidations", "maxValidationTextCharacters"];
3923
3936
  /** @internal Capture the workbook's known ceilings without dropping supported prototype fields. */
@@ -3930,7 +3943,7 @@ function captureWorkbookOptions(options) {
3930
3943
  return { ...captured, ...(captured.limits === undefined ? {} : { limits: captureWorkbookLimits(captured.limits) }) };
3931
3944
  }
3932
3945
  const _exports = Object.freeze({ workbookOptionFields: workbookOptionFields, sheetOptionFields: sheetOptionFields, workbookLimitFields: workbookLimitFields, captureWorkbookLimits: captureWorkbookLimits, captureWorkbookOptions: captureWorkbookOptions });
3933
- _modules.set("477ff98f49343b8ec4213008254b57a60dd42d07cb9843b3791d5e5f8e295865", _exports);
3946
+ _modules.set("8f13b484030aa6b921e616d803614fd061f718241692003633375fab4c36045e", _exports);
3934
3947
  return _exports;
3935
3948
  })();
3936
3949
 
@@ -4237,7 +4250,7 @@ _modules.set("24f1417c3c320a8a41137c28f70b72091256c63010be0c88b684dce85f54950c",
4237
4250
  return _exports;
4238
4251
  })();
4239
4252
 
4240
- const _m1 = _modules.get("e89ecd2f5e1738c6e88f72ac2bcac70dfaa81b4aa86edf333e9b395cf2212e2a") ?? (() => {
4253
+ const _m1 = _modules.get("fe4b78533e92385c8af50681c6a1273e1f9ec6f4f9ae8342684c06e904cfb8e0") ?? (() => {
4241
4254
  const { beginTask, checkAbort, pause, taskYieldDue } = _m2;
4242
4255
 
4243
4256
  const { OfficeIMOError } = _m3;
@@ -4252,7 +4265,7 @@ const { OpcPackage, officeRelationshipsNamespace, relationshipTypes, corePropert
4252
4265
 
4253
4266
  const { escapeOoxmlAttribute, cleanXml, xmlDeclaration } = _m11;
4254
4267
 
4255
- const { StyleRegistry, spreadsheetNamespace } = _m16;
4268
+ const { StyleRegistry, spreadsheetNamespace, normalizeBorder } = _m16;
4256
4269
 
4257
4270
  const { sheetName, assertXlsxValue, copyValue } = _m19;
4258
4271
 
@@ -4293,6 +4306,8 @@ function captureSheet(options, policy) {
4293
4306
  return { ...captured, columns,
4294
4307
  ...(captured.columnOutlines === undefined ? {} : { columnOutlines: captureColumnOutlines(captured.columnOutlines, columns.length) }),
4295
4308
  ...(captured.headerRows === undefined ? {} : { headerRows: captureTableSpans(captured.headerRows, columns.length) }),
4309
+ // Preflight and every header style read this one snapshot of the edges.
4310
+ ...(captured.headerBorder === undefined ? {} : { headerBorder: normalizeBorder(captured.headerBorder) }),
4296
4311
  ...(footer ? { footer: { ...footer,
4297
4312
  ...(footer.rows === undefined ? {} : { rows: captureTableSpans(footer.rows, columns.length) }),
4298
4313
  ...(footer.values === undefined ? {} : { values: footer.values.map(copyValue) }) } } : {}),
@@ -4718,11 +4733,11 @@ class Workbook {
4718
4733
  }
4719
4734
  }
4720
4735
  const _exports = Object.freeze({ Workbook: Workbook });
4721
- _modules.set("e89ecd2f5e1738c6e88f72ac2bcac70dfaa81b4aa86edf333e9b395cf2212e2a", _exports);
4736
+ _modules.set("fe4b78533e92385c8af50681c6a1273e1f9ec6f4f9ae8342684c06e904cfb8e0", _exports);
4722
4737
  return _exports;
4723
4738
  })();
4724
4739
 
4725
- const _m44 = _modules.get("a10003e971cd5ec2cee127bc9b029a0aa06fe3d50112838929d7a04a55e177c0") ?? (() => {
4740
+ const _m44 = _modules.get("62ff1bcbf8ca07e8ab92cd1f6afbd54049346193e18160ab0afec48e03950bba") ?? (() => {
4726
4741
  const { ExportCell, assertScalar } = _m20;
4727
4742
 
4728
4743
  const { captureWorkbookOptions, sheetOptionFields } = _m40;
@@ -4744,7 +4759,7 @@ function value(result) {
4744
4759
  function portableSheet(options = {}) {
4745
4760
  options = captureFields(options, sheetOptionFields);
4746
4761
  if (options.headerStyle !== undefined)
4747
- throw new TypeError("Workbook-local header styles require the advanced Workbook API; use boldHeader and headerFill.");
4762
+ throw new TypeError("Workbook-local header styles require the advanced Workbook API; use boldHeader, headerFill, headerBorder and headerWrap.");
4748
4763
  style(options.alternatingRowStyle);
4749
4764
  style(options.title?.style);
4750
4765
  style(options.footer?.style);
@@ -4771,11 +4786,11 @@ function portableWorkbook(options = {}) {
4771
4786
  return { ...options, cellValueWriters: wrapped };
4772
4787
  }
4773
4788
  const _exports = Object.freeze({ portableSheet: portableSheet, portableWorkbook: portableWorkbook });
4774
- _modules.set("a10003e971cd5ec2cee127bc9b029a0aa06fe3d50112838929d7a04a55e177c0", _exports);
4789
+ _modules.set("62ff1bcbf8ca07e8ab92cd1f6afbd54049346193e18160ab0afec48e03950bba", _exports);
4775
4790
  return _exports;
4776
4791
  })();
4777
4792
 
4778
- const _m43 = _modules.get("5bfd5c9c5e179305b9bebd6cb0d6a0d75e974b223e119e0fd4fbb773325f1e63") ?? (() => {
4793
+ const _m43 = _modules.get("05d6afb9e04ef4bfee413c0cee45f432de701dd04c8673077e711f82ed4a3471") ?? (() => {
4779
4794
  const { withDestination } = _m5;
4780
4795
 
4781
4796
  const { copyColumns } = _m24;
@@ -4830,7 +4845,7 @@ async function writeXlsxTo(rows, destination, configuration) {
4830
4845
  });
4831
4846
  }
4832
4847
  const _exports = Object.freeze({ writeXlsx: writeXlsx, writeXlsxTo: writeXlsxTo });
4833
- _modules.set("5bfd5c9c5e179305b9bebd6cb0d6a0d75e974b223e119e0fd4fbb773325f1e63", _exports);
4848
+ _modules.set("05d6afb9e04ef4bfee413c0cee45f432de701dd04c8673077e711f82ed4a3471", _exports);
4834
4849
  return _exports;
4835
4850
  })();
4836
4851
 
@@ -5100,7 +5115,7 @@ _modules.set("046b305cdccf817d847addb75a778131622de23f2840830bbe1c0c26053a68c0",
5100
5115
  return _exports;
5101
5116
  })();
5102
5117
 
5103
- const _m47 = _modules.get("dd34d5fd89869a0f953f3f2b3fd27ac83be29e68f76c9087fae3d33095aeda7c") ?? (() => {
5118
+ const _m47 = _modules.get("8df3d4472935cf1e82313946c2473abf41dd8c539922d3283439958b72548576") ?? (() => {
5104
5119
  const { assertGroupedReportSource } = _m46;
5105
5120
 
5106
5121
  const { captureFields } = _m7;
@@ -5189,11 +5204,11 @@ function prepareGroupedSheet(report, configuration, maxConditionalFormats = 1000
5189
5204
  ...(options.grandTotalStyle ? { grandTotalStyle: copyStylePatch(options.grandTotalStyle) } : {}) };
5190
5205
  }
5191
5206
  const _exports = Object.freeze({ groupedOptionFields: groupedOptionFields, prepareGroupedSheet: prepareGroupedSheet });
5192
- _modules.set("dd34d5fd89869a0f953f3f2b3fd27ac83be29e68f76c9087fae3d33095aeda7c", _exports);
5207
+ _modules.set("8df3d4472935cf1e82313946c2473abf41dd8c539922d3283439958b72548576", _exports);
5193
5208
  return _exports;
5194
5209
  })();
5195
5210
 
5196
- const _m45 = _modules.get("2ba62cdf88d559804bb84b20e9816b2de0f232401b7431ac414699a607d554a4") ?? (() => {
5211
+ const _m45 = _modules.get("26f5f707c4feb95052da5c9787df79bf6a94178780b276c4f74677ce0f96e87a") ?? (() => {
5197
5212
  const { groupedReportOperation } = _m46;
5198
5213
 
5199
5214
  const { checkAbort, withAbort } = _m2;
@@ -5366,7 +5381,7 @@ async function writeGroupedXlsxTo(report, destination, options) {
5366
5381
  return withDestination(destination, async (sink) => (await write(report, prepared, sink)).result);
5367
5382
  }
5368
5383
  const _exports = Object.freeze({ addGroupedXlsx: addGroupedXlsx, writeGroupedXlsx: writeGroupedXlsx, writeGroupedXlsxTo: writeGroupedXlsxTo });
5369
- _modules.set("2ba62cdf88d559804bb84b20e9816b2de0f232401b7431ac414699a607d554a4", _exports);
5384
+ _modules.set("26f5f707c4feb95052da5c9787df79bf6a94178780b276c4f74677ce0f96e87a", _exports);
5370
5385
  return _exports;
5371
5386
  })();
5372
5387
 
@@ -5419,10 +5434,10 @@ _modules.set("81b3d47c02b7d8443b79e02b3cfb52032d6b73d9a3fb592b777ebe028ad0ef00",
5419
5434
  return _exports;
5420
5435
  })();
5421
5436
 
5422
- const _m0 = _modules.get("d6587a933b36ccfdba9a2a252389924ac8461f672b3a500082cceb5e53c8b0b6") ?? (() => {
5437
+ const _m0 = _modules.get("e5310c591178a3de9292f150e2e6f1477b94b895ef0c90840c72adef00f75974") ?? (() => {
5423
5438
 
5424
5439
  const _exports = Object.freeze({ Workbook: _m1.Workbook, writeXlsx: _m43.writeXlsx, writeXlsxTo: _m43.writeXlsxTo, writeGroupedXlsx: _m45.writeGroupedXlsx, writeGroupedXlsxTo: _m45.writeGroupedXlsxTo, addGroupedXlsx: _m45.addGroupedXlsx, createGroupedReport: _m46.createGroupedReport, Worksheet: _m27.Worksheet, Cell: _m19.Cell, FormulaCell: _m22.FormulaCell, StyleRegistry: _m16.StyleRegistry, NumberFormats: _m16.NumberFormats, saveBlob: _m48.saveBlob, ExportCell: _m20.ExportCell });
5425
- _modules.set("d6587a933b36ccfdba9a2a252389924ac8461f672b3a500082cceb5e53c8b0b6", _exports);
5440
+ _modules.set("e5310c591178a3de9292f150e2e6f1477b94b895ef0c90840c72adef00f75974", _exports);
5426
5441
  return _exports;
5427
5442
  })();
5428
5443
  Object.assign(officeimo, _m0, { core: _m48, zip: _m13, xml: _m11, opc: _m8, xlsx: _m0 });