@cj-tech-master/excelts 5.0.0-canary.20260123012457.1fdf506 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/browser/modules/excel/column.d.ts +0 -5
  2. package/dist/browser/modules/excel/column.js +2 -10
  3. package/dist/browser/modules/excel/row.d.ts +0 -2
  4. package/dist/browser/modules/excel/row.js +1 -3
  5. package/dist/browser/modules/excel/workbook.d.ts +0 -4
  6. package/dist/browser/modules/excel/workbook.js +1 -4
  7. package/dist/browser/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.d.ts +0 -1
  8. package/dist/browser/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.js +10 -17
  9. package/dist/browser/modules/excel/xlsx/xform/sheet/row-xform.d.ts +0 -1
  10. package/dist/browser/modules/excel/xlsx/xform/sheet/row-xform.js +1 -7
  11. package/dist/browser/modules/excel/xlsx/xform/sheet/sheet-format-properties-xform.d.ts +0 -1
  12. package/dist/browser/modules/excel/xlsx/xform/sheet/sheet-format-properties-xform.js +4 -9
  13. package/dist/browser/modules/excel/xlsx/xform/sheet/sheet-view-xform.js +2 -4
  14. package/dist/browser/modules/excel/xlsx/xform/sheet/worksheet-xform.js +1 -2
  15. package/dist/browser/modules/excel/xlsx/xform/style/style-xform.d.ts +0 -7
  16. package/dist/browser/modules/excel/xlsx/xform/style/style-xform.js +6 -26
  17. package/dist/browser/modules/excel/xlsx/xform/style/styles-xform.d.ts +0 -6
  18. package/dist/browser/modules/excel/xlsx/xform/style/styles-xform.js +4 -52
  19. package/dist/browser/modules/excel/xlsx/xlsx.browser.js +0 -7
  20. package/dist/cjs/modules/excel/column.js +2 -10
  21. package/dist/cjs/modules/excel/row.js +1 -3
  22. package/dist/cjs/modules/excel/workbook.js +1 -4
  23. package/dist/cjs/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.js +10 -17
  24. package/dist/cjs/modules/excel/xlsx/xform/sheet/row-xform.js +1 -7
  25. package/dist/cjs/modules/excel/xlsx/xform/sheet/sheet-format-properties-xform.js +4 -9
  26. package/dist/cjs/modules/excel/xlsx/xform/sheet/sheet-view-xform.js +2 -4
  27. package/dist/cjs/modules/excel/xlsx/xform/sheet/worksheet-xform.js +1 -2
  28. package/dist/cjs/modules/excel/xlsx/xform/style/style-xform.js +6 -26
  29. package/dist/cjs/modules/excel/xlsx/xform/style/styles-xform.js +4 -52
  30. package/dist/cjs/modules/excel/xlsx/xlsx.browser.js +0 -7
  31. package/dist/esm/modules/excel/column.js +2 -10
  32. package/dist/esm/modules/excel/row.js +1 -3
  33. package/dist/esm/modules/excel/workbook.js +1 -4
  34. package/dist/esm/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.js +10 -17
  35. package/dist/esm/modules/excel/xlsx/xform/sheet/row-xform.js +1 -7
  36. package/dist/esm/modules/excel/xlsx/xform/sheet/sheet-format-properties-xform.js +4 -9
  37. package/dist/esm/modules/excel/xlsx/xform/sheet/sheet-view-xform.js +2 -4
  38. package/dist/esm/modules/excel/xlsx/xform/sheet/worksheet-xform.js +1 -2
  39. package/dist/esm/modules/excel/xlsx/xform/style/style-xform.js +6 -26
  40. package/dist/esm/modules/excel/xlsx/xform/style/styles-xform.js +4 -52
  41. package/dist/esm/modules/excel/xlsx/xlsx.browser.js +0 -7
  42. package/dist/iife/excelts.iife.js +394 -450
  43. package/dist/iife/excelts.iife.js.map +1 -1
  44. package/dist/iife/excelts.iife.min.js +7 -7
  45. package/dist/types/modules/excel/column.d.ts +0 -5
  46. package/dist/types/modules/excel/row.d.ts +0 -2
  47. package/dist/types/modules/excel/workbook.d.ts +0 -4
  48. package/dist/types/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.d.ts +0 -1
  49. package/dist/types/modules/excel/xlsx/xform/sheet/row-xform.d.ts +0 -1
  50. package/dist/types/modules/excel/xlsx/xform/sheet/sheet-format-properties-xform.d.ts +0 -1
  51. package/dist/types/modules/excel/xlsx/xform/style/style-xform.d.ts +0 -7
  52. package/dist/types/modules/excel/xlsx/xform/style/styles-xform.d.ts +0 -6
  53. package/package.json +14 -14
@@ -11,8 +11,6 @@ export interface ColumnDefn {
11
11
  outlineLevel?: number;
12
12
  hidden?: boolean;
13
13
  style?: Partial<Style>;
14
- /** Whether the column width is auto-fitted to content */
15
- bestFit?: boolean;
16
14
  }
17
15
  export interface ColumnModel {
18
16
  min: number;
@@ -23,7 +21,6 @@ export interface ColumnModel {
23
21
  hidden?: boolean;
24
22
  outlineLevel?: number;
25
23
  collapsed?: boolean;
26
- bestFit?: boolean;
27
24
  }
28
25
  /**
29
26
  * Column defines the column properties for 1 column.
@@ -39,8 +36,6 @@ declare class Column {
39
36
  width?: number;
40
37
  private _hidden;
41
38
  private _outlineLevel;
42
- /** Whether the column width is auto-fitted to content */
43
- bestFit?: boolean;
44
39
  /** Styles applied to the column */
45
40
  style: Partial<Style>;
46
41
  constructor(worksheet: Worksheet, number: number, defn?: ColumnDefn | false);
@@ -38,8 +38,7 @@ class Column {
38
38
  width: this.width,
39
39
  style: this.style,
40
40
  hidden: this.hidden,
41
- outlineLevel: this.outlineLevel,
42
- bestFit: this.bestFit
41
+ outlineLevel: this.outlineLevel
43
42
  };
44
43
  }
45
44
  set defn(value) {
@@ -56,7 +55,6 @@ class Column {
56
55
  // headers must be set after style
57
56
  this.header = value.header;
58
57
  this._hidden = !!value.hidden;
59
- this.bestFit = value.bestFit;
60
58
  }
61
59
  else {
62
60
  delete this._header;
@@ -64,7 +62,6 @@ class Column {
64
62
  delete this.width;
65
63
  this.style = {};
66
64
  this.outlineLevel = 0;
67
- delete this.bestFit;
68
65
  }
69
66
  }
70
67
  /**
@@ -154,7 +151,6 @@ class Column {
154
151
  return (this.width === model.width &&
155
152
  this.hidden === model.hidden &&
156
153
  this.outlineLevel === model.outlineLevel &&
157
- this.bestFit === model.bestFit &&
158
154
  isEqual(this.style, model.style));
159
155
  }
160
156
  get isDefault() {
@@ -167,9 +163,6 @@ class Column {
167
163
  if (this.outlineLevel) {
168
164
  return false;
169
165
  }
170
- if (this.bestFit) {
171
- return false;
172
- }
173
166
  const s = this.style;
174
167
  if (s && (s.font || s.numFmt || s.alignment || s.border || s.fill || s.protection)) {
175
168
  return false;
@@ -320,8 +313,7 @@ class Column {
320
313
  isCustomWidth: column.isCustomWidth,
321
314
  hidden: column.hidden,
322
315
  outlineLevel: column.outlineLevel,
323
- collapsed: column.collapsed,
324
- bestFit: column.bestFit
316
+ collapsed: column.collapsed
325
317
  };
326
318
  cols.push(col);
327
319
  }
@@ -15,7 +15,6 @@ export interface RowModel {
15
15
  hidden: boolean;
16
16
  outlineLevel: number;
17
17
  collapsed: boolean;
18
- dyDescent?: number;
19
18
  }
20
19
  declare class Row {
21
20
  private _worksheet;
@@ -25,7 +24,6 @@ declare class Row {
25
24
  private _hidden?;
26
25
  private _outlineLevel?;
27
26
  height?: number;
28
- dyDescent?: number;
29
27
  constructor(worksheet: Worksheet, number: number);
30
28
  /**
31
29
  * The row number
@@ -388,8 +388,7 @@ class Row {
388
388
  style: this.style,
389
389
  hidden: this.hidden,
390
390
  outlineLevel: this.outlineLevel,
391
- collapsed: this.collapsed,
392
- dyDescent: this.dyDescent
391
+ collapsed: this.collapsed
393
392
  }
394
393
  : null;
395
394
  }
@@ -436,7 +435,6 @@ class Row {
436
435
  }
437
436
  this.hidden = value.hidden;
438
437
  this.outlineLevel = value.outlineLevel || 0;
439
- this.dyDescent = value.dyDescent;
440
438
  this.style = (value.style && JSON.parse(JSON.stringify(value.style))) || {};
441
439
  }
442
440
  }
@@ -59,8 +59,6 @@ export interface WorkbookModel {
59
59
  passthrough?: Record<string, Uint8Array>;
60
60
  /** Raw drawing XML data for passthrough (when drawing contains chart references) */
61
61
  rawDrawings?: Record<string, Uint8Array>;
62
- /** Default font preserved from the original file for round-trip fidelity */
63
- defaultFont?: any;
64
62
  }
65
63
  declare class Workbook {
66
64
  /**
@@ -104,8 +102,6 @@ declare class Workbook {
104
102
  private _passthrough;
105
103
  /** Raw drawing XML data for passthrough (when drawing contains chart references) */
106
104
  private _rawDrawings;
107
- /** Default font preserved from original file for round-trip fidelity */
108
- private _defaultFont?;
109
105
  private _xlsx?;
110
106
  private _csv?;
111
107
  constructor();
@@ -255,8 +255,7 @@ class Workbook {
255
255
  pivotTables: this.pivotTables,
256
256
  calcProperties: this.calcProperties,
257
257
  passthrough: this._passthrough,
258
- rawDrawings: this._rawDrawings,
259
- defaultFont: this._defaultFont
258
+ rawDrawings: this._rawDrawings
260
259
  };
261
260
  }
262
261
  set model(value) {
@@ -301,8 +300,6 @@ class Workbook {
301
300
  this._passthrough = value.passthrough || {};
302
301
  // Preserve raw drawing data for drawings with chart references
303
302
  this._rawDrawings = value.rawDrawings || {};
304
- // Preserve default font for round-trip fidelity
305
- this._defaultFont = value.defaultFont;
306
303
  }
307
304
  }
308
305
  // ===========================================================================
@@ -72,7 +72,6 @@ interface ParsedPivotTableModel {
72
72
  chartFormat?: number;
73
73
  rowItems?: RowColItem[];
74
74
  colItems?: RowColItem[];
75
- hasColFields?: boolean;
76
75
  chartFormats?: ChartFormatItem[];
77
76
  isLoaded?: boolean;
78
77
  extensions?: any[];
@@ -245,21 +245,18 @@ class PivotTableXform extends BaseXform {
245
245
  xmlStream.writeXml('<rowItems count="1"><i t="grand"><x/></i></rowItems>');
246
246
  }
247
247
  // Col fields
248
- // Only render colFields if it was present in the original file or if there are actual column fields
249
- // Some pivot tables don't have colFields element at all
250
- if (model.hasColFields || model.colFields.length > 0) {
251
- const colFieldCount = model.colFields.length === 0 ? 1 : model.colFields.length;
252
- xmlStream.openNode("colFields", { count: colFieldCount });
253
- if (model.colFields.length === 0) {
254
- xmlStream.leafNode("field", { x: -2 });
255
- }
256
- else {
257
- for (const fieldIndex of model.colFields) {
258
- xmlStream.leafNode("field", { x: fieldIndex });
259
- }
248
+ // Excel commonly emits a synthetic field x=-2 when there are no column fields.
249
+ const colFieldCount = model.colFields.length === 0 ? 1 : model.colFields.length;
250
+ xmlStream.openNode("colFields", { count: colFieldCount });
251
+ if (model.colFields.length === 0) {
252
+ xmlStream.leafNode("field", { x: -2 });
253
+ }
254
+ else {
255
+ for (const fieldIndex of model.colFields) {
256
+ xmlStream.leafNode("field", { x: fieldIndex });
260
257
  }
261
- xmlStream.closeNode();
262
258
  }
259
+ xmlStream.closeNode();
263
260
  // Col items - use parsed items if available
264
261
  if (model.colItems && model.colItems.length > 0) {
265
262
  xmlStream.openNode("colItems", { count: model.colItems.length });
@@ -462,10 +459,6 @@ class PivotTableXform extends BaseXform {
462
459
  break;
463
460
  case "colFields":
464
461
  this.state.inColFields = true;
465
- // Track that colFields element was present in original file
466
- if (this.model) {
467
- this.model.hasColFields = true;
468
- }
469
462
  break;
470
463
  case "dataFields":
471
464
  this.state.inDataFields = true;
@@ -14,7 +14,6 @@ interface RowModel {
14
14
  outlineLevel?: number;
15
15
  collapsed?: boolean;
16
16
  style?: any;
17
- dyDescent?: number;
18
17
  }
19
18
  declare class RowXform extends BaseXform {
20
19
  private maxItems?;
@@ -48,10 +48,7 @@ class RowXform extends BaseXform {
48
48
  xmlStream.addAttribute("s", model.styleId);
49
49
  xmlStream.addAttribute("customFormat", "1");
50
50
  }
51
- // Output dyDescent if present (MS extension for font descent)
52
- if (model.dyDescent !== undefined) {
53
- xmlStream.addAttribute("x14ac:dyDescent", model.dyDescent);
54
- }
51
+ // Note: dyDescent is MS extension, not output by default (Excel auto-calculates)
55
52
  if (model.outlineLevel) {
56
53
  xmlStream.addAttribute("outlineLevel", model.outlineLevel);
57
54
  }
@@ -102,9 +99,6 @@ class RowXform extends BaseXform {
102
99
  if (parseBoolean(node.attributes.collapsed)) {
103
100
  model.collapsed = true;
104
101
  }
105
- if (node.attributes["x14ac:dyDescent"] !== undefined) {
106
- model.dyDescent = parseFloat(node.attributes["x14ac:dyDescent"]);
107
- }
108
102
  return true;
109
103
  }
110
104
  this.parser = this.map[node.name];
@@ -5,7 +5,6 @@ interface SheetFormatPropertiesModel {
5
5
  outlineLevelRow: number;
6
6
  outlineLevelCol: number;
7
7
  defaultColWidth?: number;
8
- customHeight?: boolean;
9
8
  }
10
9
  declare class SheetFormatPropertiesXform extends BaseXform {
11
10
  get tag(): string;
@@ -11,14 +11,14 @@ class SheetFormatPropertiesXform extends BaseXform {
11
11
  outlineLevelRow: model.outlineLevelRow || undefined,
12
12
  outlineLevelCol: model.outlineLevelCol || undefined,
13
13
  // Only output dyDescent if explicitly set (MS extension, not ECMA-376 standard)
14
- "x14ac:dyDescent": model.dyDescent !== undefined && model.dyDescent !== 0 ? model.dyDescent : undefined
14
+ "x14ac:dyDescent": model.dyDescent || undefined
15
15
  };
16
16
  // Only output defaultColWidth if explicitly set
17
17
  if (model.defaultColWidth) {
18
18
  attributes.defaultColWidth = model.defaultColWidth;
19
19
  }
20
- // Only output customHeight if it was present in the original file
21
- if (model.customHeight) {
20
+ // default value for 'defaultRowHeight' is 15, this should not be 'custom'
21
+ if (!model.defaultRowHeight || model.defaultRowHeight !== 15) {
22
22
  attributes.customHeight = "1";
23
23
  }
24
24
  if (Object.values(attributes).some((value) => value !== undefined)) {
@@ -30,18 +30,13 @@ class SheetFormatPropertiesXform extends BaseXform {
30
30
  if (node.name === "sheetFormatPr") {
31
31
  this.model = {
32
32
  defaultRowHeight: parseFloat(node.attributes.defaultRowHeight || "0"),
33
- dyDescent: node.attributes["x14ac:dyDescent"] !== undefined
34
- ? parseFloat(node.attributes["x14ac:dyDescent"])
35
- : undefined,
33
+ dyDescent: parseFloat(node.attributes["x14ac:dyDescent"] || "0"),
36
34
  outlineLevelRow: parseInt(node.attributes.outlineLevelRow || "0", 10),
37
35
  outlineLevelCol: parseInt(node.attributes.outlineLevelCol || "0", 10)
38
36
  };
39
37
  if (node.attributes.defaultColWidth) {
40
38
  this.model.defaultColWidth = parseFloat(node.attributes.defaultColWidth);
41
39
  }
42
- if (node.attributes.customHeight === "1") {
43
- this.model.customHeight = true;
44
- }
45
40
  return true;
46
41
  }
47
42
  return false;
@@ -37,8 +37,8 @@ class SheetViewXform extends BaseXform {
37
37
  add("showRuler", "0", model.showRuler === false);
38
38
  add("showRowColHeaders", "0", model.showRowColHeaders === false);
39
39
  add("showGridLines", "0", model.showGridLines === false);
40
- add("zoomScale", model.zoomScale, model.zoomScale !== undefined && model.zoomScale !== 100);
41
- add("zoomScaleNormal", model.zoomScaleNormal, model.zoomScaleNormal !== undefined && model.zoomScaleNormal !== 100);
40
+ add("zoomScale", model.zoomScale, model.zoomScale);
41
+ add("zoomScaleNormal", model.zoomScaleNormal, model.zoomScaleNormal);
42
42
  add("view", model.style, model.style);
43
43
  let topLeftCell;
44
44
  let xSplit;
@@ -143,7 +143,6 @@ class SheetViewXform extends BaseXform {
143
143
  model = this.model = {
144
144
  workbookViewId: this.sheetView.workbookViewId,
145
145
  rightToLeft: this.sheetView.rightToLeft,
146
- tabSelected: this.sheetView.tabSelected,
147
146
  state: VIEW_STATES[this.pane.state] || "split", // split is default
148
147
  xSplit: this.pane.xSplit,
149
148
  ySplit: this.pane.ySplit,
@@ -169,7 +168,6 @@ class SheetViewXform extends BaseXform {
169
168
  model = this.model = {
170
169
  workbookViewId: this.sheetView.workbookViewId,
171
170
  rightToLeft: this.sheetView.rightToLeft,
172
- tabSelected: this.sheetView.tabSelected,
173
171
  state: "normal",
174
172
  showRuler: this.sheetView.showRuler,
175
173
  showRowColHeaders: this.sheetView.showRowColHeaders,
@@ -384,8 +384,7 @@ class WorkSheetXform extends BaseXform {
384
384
  defaultRowHeight: model.properties.defaultRowHeight,
385
385
  dyDescent: model.properties.dyDescent,
386
386
  outlineLevelCol: model.properties.outlineLevelCol,
387
- outlineLevelRow: model.properties.outlineLevelRow,
388
- customHeight: model.properties.customHeight
387
+ outlineLevelRow: model.properties.outlineLevelRow
389
388
  }
390
389
  : undefined;
391
390
  if (model.properties && model.properties.defaultColWidth) {
@@ -11,13 +11,6 @@ interface StyleModel {
11
11
  protection?: any;
12
12
  checkbox?: boolean;
13
13
  xfComplementIndex?: number;
14
- pivotButton?: boolean;
15
- applyNumberFormat?: boolean;
16
- applyFont?: boolean;
17
- applyFill?: boolean;
18
- applyBorder?: boolean;
19
- applyAlignment?: boolean;
20
- applyProtection?: boolean;
21
14
  }
22
15
  interface StyleOptions {
23
16
  xfId?: boolean;
@@ -24,27 +24,24 @@ class StyleXform extends BaseXform {
24
24
  if (this.xfId) {
25
25
  xmlStream.addAttribute("xfId", model.xfId || 0);
26
26
  }
27
- if (model.applyNumberFormat || model.numFmtId) {
27
+ if (model.numFmtId) {
28
28
  xmlStream.addAttribute("applyNumberFormat", "1");
29
29
  }
30
- if (model.applyFont || model.fontId) {
30
+ if (model.fontId) {
31
31
  xmlStream.addAttribute("applyFont", "1");
32
32
  }
33
- if (model.applyFill || model.fillId) {
33
+ if (model.fillId) {
34
34
  xmlStream.addAttribute("applyFill", "1");
35
35
  }
36
- if (model.applyBorder || model.borderId) {
36
+ if (model.borderId) {
37
37
  xmlStream.addAttribute("applyBorder", "1");
38
38
  }
39
- if (model.applyAlignment || model.alignment) {
39
+ if (model.alignment) {
40
40
  xmlStream.addAttribute("applyAlignment", "1");
41
41
  }
42
- if (model.applyProtection || model.protection) {
42
+ if (model.protection) {
43
43
  xmlStream.addAttribute("applyProtection", "1");
44
44
  }
45
- if (model.pivotButton) {
46
- xmlStream.addAttribute("pivotButton", "1");
47
- }
48
45
  /**
49
46
  * Rendering tags causes close of XML stream.
50
47
  * Therefore adding attributes must be done before rendering tags.
@@ -85,23 +82,6 @@ class StyleXform extends BaseXform {
85
82
  if (this.xfId) {
86
83
  this.model.xfId = parseInt(node.attributes.xfId, 10);
87
84
  }
88
- if (node.attributes.pivotButton === "1") {
89
- this.model.pivotButton = true;
90
- }
91
- // Preserve apply* flags from original file
92
- const applyFlags = [
93
- "applyNumberFormat",
94
- "applyFont",
95
- "applyFill",
96
- "applyBorder",
97
- "applyAlignment",
98
- "applyProtection"
99
- ];
100
- for (const flag of applyFlags) {
101
- if (node.attributes[flag] === "1") {
102
- this.model[flag] = true;
103
- }
104
- }
105
85
  return true;
106
86
  case "alignment":
107
87
  this.parser = this.map.alignment;
@@ -12,17 +12,11 @@ declare class StylesXform extends BaseXform {
12
12
  private index?;
13
13
  private weakMap?;
14
14
  private _hasCheckboxes?;
15
- defaultFont?: any;
16
15
  parser: any;
17
16
  static Mock: typeof StylesXform;
18
17
  constructor(initialise?: boolean);
19
18
  initIndex(): void;
20
19
  init(): void;
21
- /**
22
- * Set the default font to use when no font is explicitly specified.
23
- * This preserves the original file's default font during round-trip.
24
- */
25
- setDefaultFont(font: any): void;
26
20
  render(xmlStream: any, model?: StylesModel): void;
27
21
  parseOpen(node: any): boolean;
28
22
  parseText(text: string): void;
@@ -84,13 +84,6 @@ class StylesXform extends BaseXform {
84
84
  this.weakMap = new WeakMap();
85
85
  this._hasCheckboxes = false;
86
86
  }
87
- /**
88
- * Set the default font to use when no font is explicitly specified.
89
- * This preserves the original file's default font during round-trip.
90
- */
91
- setDefaultFont(font) {
92
- this.defaultFont = font;
93
- }
94
87
  render(xmlStream, model) {
95
88
  const renderModel = model || this.model;
96
89
  //
@@ -107,8 +100,8 @@ class StylesXform extends BaseXform {
107
100
  xmlStream.closeNode();
108
101
  }
109
102
  if (!renderModel.fonts.length) {
110
- // default (zero) font - use preserved font or fallback to Calibri
111
- this._addFont(this.defaultFont || {
103
+ // default (zero) font
104
+ this._addFont({
112
105
  size: 11,
113
106
  color: { theme: 1 },
114
107
  name: "Calibri",
@@ -200,10 +193,6 @@ class StylesXform extends BaseXform {
200
193
  add("borders", this.map.borders);
201
194
  add("styles", this.map.cellXfs);
202
195
  add("dxfs", this.map.dxfs);
203
- // preserve the default (first) font from the original file
204
- if (this.map.fonts.model && this.map.fonts.model.length > 0) {
205
- this.defaultFont = this.map.fonts.model[0];
206
- }
207
196
  // index numFmts
208
197
  this.index = {
209
198
  model: [],
@@ -231,14 +220,8 @@ class StylesXform extends BaseXform {
231
220
  }
232
221
  // if we have no default font, add it here now
233
222
  if (!this.model.fonts.length) {
234
- // default (zero) font - use preserved font or fallback to Calibri
235
- this._addFont(this.defaultFont || {
236
- size: 11,
237
- color: { theme: 1 },
238
- name: "Calibri",
239
- family: 2,
240
- scheme: "minor"
241
- });
223
+ // default (zero) font
224
+ this._addFont({ size: 11, color: { theme: 1 }, name: "Calibri", family: 2, scheme: "minor" });
242
225
  }
243
226
  const type = cellType || Enums.ValueType.Number;
244
227
  // If we have seen this style object before, assume it has the same styleId.
@@ -279,21 +262,6 @@ class StylesXform extends BaseXform {
279
262
  if (model.protection) {
280
263
  style.protection = model.protection;
281
264
  }
282
- // Preserve xf-level attributes (pivotButton, apply* flags)
283
- const xfFlags = [
284
- "pivotButton",
285
- "applyNumberFormat",
286
- "applyFont",
287
- "applyFill",
288
- "applyBorder",
289
- "applyAlignment",
290
- "applyProtection"
291
- ];
292
- for (const flag of xfFlags) {
293
- if (model[flag]) {
294
- style[flag] = true;
295
- }
296
- }
297
265
  if (type === Enums.ValueType.Checkbox) {
298
266
  // Checkbox rendering relies on style extensions (extLst) and workbook-level parts.
299
267
  // Force applyAlignment="1" (without emitting an <alignment/> node) by providing
@@ -354,22 +322,6 @@ class StylesXform extends BaseXform {
354
322
  if (style.protection) {
355
323
  model.protection = style.protection;
356
324
  }
357
- // -------------------------------------------------------
358
- // xf-level attributes (pivotButton, apply* flags)
359
- const xfFlags = [
360
- "pivotButton",
361
- "applyNumberFormat",
362
- "applyFont",
363
- "applyFill",
364
- "applyBorder",
365
- "applyAlignment",
366
- "applyProtection"
367
- ];
368
- for (const flag of xfFlags) {
369
- if (style[flag]) {
370
- model[flag] = true;
371
- }
372
- }
373
325
  return model;
374
326
  }
375
327
  addDxfStyle(style) {
@@ -600,8 +600,6 @@ class XLSX {
600
600
  delete model.sharedStrings;
601
601
  delete model.workbookRels;
602
602
  delete model.sheetDefs;
603
- // Preserve default font before deleting styles
604
- model.defaultFont = model.styles?.defaultFont;
605
603
  delete model.styles;
606
604
  delete model.mediaIndex;
607
605
  delete model.drawings;
@@ -1237,12 +1235,7 @@ class XLSX {
1237
1235
  options.useSharedStrings !== undefined ? options.useSharedStrings : true;
1238
1236
  model.useStyles = options.useStyles !== undefined ? options.useStyles : true;
1239
1237
  model.sharedStrings = new SharedStringsXform();
1240
- // Preserve default font from parsed styles if available
1241
- const oldDefaultFont = model.defaultFont;
1242
1238
  model.styles = model.useStyles ? new StylesXform(true) : new StylesXform.Mock();
1243
- if (oldDefaultFont && model.styles.setDefaultFont) {
1244
- model.styles.setDefaultFont(oldDefaultFont);
1245
- }
1246
1239
  const workbookXform = new WorkbookXform();
1247
1240
  const worksheetXform = new WorkSheetXform();
1248
1241
  workbookXform.prepare(model);
@@ -41,8 +41,7 @@ class Column {
41
41
  width: this.width,
42
42
  style: this.style,
43
43
  hidden: this.hidden,
44
- outlineLevel: this.outlineLevel,
45
- bestFit: this.bestFit
44
+ outlineLevel: this.outlineLevel
46
45
  };
47
46
  }
48
47
  set defn(value) {
@@ -59,7 +58,6 @@ class Column {
59
58
  // headers must be set after style
60
59
  this.header = value.header;
61
60
  this._hidden = !!value.hidden;
62
- this.bestFit = value.bestFit;
63
61
  }
64
62
  else {
65
63
  delete this._header;
@@ -67,7 +65,6 @@ class Column {
67
65
  delete this.width;
68
66
  this.style = {};
69
67
  this.outlineLevel = 0;
70
- delete this.bestFit;
71
68
  }
72
69
  }
73
70
  /**
@@ -157,7 +154,6 @@ class Column {
157
154
  return (this.width === model.width &&
158
155
  this.hidden === model.hidden &&
159
156
  this.outlineLevel === model.outlineLevel &&
160
- this.bestFit === model.bestFit &&
161
157
  (0, under_dash_1.isEqual)(this.style, model.style));
162
158
  }
163
159
  get isDefault() {
@@ -170,9 +166,6 @@ class Column {
170
166
  if (this.outlineLevel) {
171
167
  return false;
172
168
  }
173
- if (this.bestFit) {
174
- return false;
175
- }
176
169
  const s = this.style;
177
170
  if (s && (s.font || s.numFmt || s.alignment || s.border || s.fill || s.protection)) {
178
171
  return false;
@@ -323,8 +316,7 @@ class Column {
323
316
  isCustomWidth: column.isCustomWidth,
324
317
  hidden: column.hidden,
325
318
  outlineLevel: column.outlineLevel,
326
- collapsed: column.collapsed,
327
- bestFit: column.bestFit
319
+ collapsed: column.collapsed
328
320
  };
329
321
  cols.push(col);
330
322
  }
@@ -391,8 +391,7 @@ class Row {
391
391
  style: this.style,
392
392
  hidden: this.hidden,
393
393
  outlineLevel: this.outlineLevel,
394
- collapsed: this.collapsed,
395
- dyDescent: this.dyDescent
394
+ collapsed: this.collapsed
396
395
  }
397
396
  : null;
398
397
  }
@@ -439,7 +438,6 @@ class Row {
439
438
  }
440
439
  this.hidden = value.hidden;
441
440
  this.outlineLevel = value.outlineLevel || 0;
442
- this.dyDescent = value.dyDescent;
443
441
  this.style = (value.style && JSON.parse(JSON.stringify(value.style))) || {};
444
442
  }
445
443
  }
@@ -258,8 +258,7 @@ class Workbook {
258
258
  pivotTables: this.pivotTables,
259
259
  calcProperties: this.calcProperties,
260
260
  passthrough: this._passthrough,
261
- rawDrawings: this._rawDrawings,
262
- defaultFont: this._defaultFont
261
+ rawDrawings: this._rawDrawings
263
262
  };
264
263
  }
265
264
  set model(value) {
@@ -304,8 +303,6 @@ class Workbook {
304
303
  this._passthrough = value.passthrough || {};
305
304
  // Preserve raw drawing data for drawings with chart references
306
305
  this._rawDrawings = value.rawDrawings || {};
307
- // Preserve default font for round-trip fidelity
308
- this._defaultFont = value.defaultFont;
309
306
  }
310
307
  }
311
308
  exports.Workbook = Workbook;