@cj-tech-master/excelts 5.1.1 → 5.1.2-canary.20260211105222.3da3461
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/modules/excel/cell.js +1 -1
- package/dist/browser/modules/excel/xlsx/xform/sheet/worksheet-xform.js +17 -4
- package/dist/cjs/modules/excel/cell.js +1 -1
- package/dist/cjs/modules/excel/xlsx/xform/sheet/worksheet-xform.js +17 -4
- package/dist/esm/modules/excel/cell.js +1 -1
- package/dist/esm/modules/excel/xlsx/xform/sheet/worksheet-xform.js +17 -4
- package/dist/iife/excelts.iife.js +5 -2
- package/dist/iife/excelts.iife.js.map +1 -1
- package/dist/iife/excelts.iife.min.js +3 -3
- package/package.json +1 -1
|
@@ -147,7 +147,7 @@ class Cell {
|
|
|
147
147
|
if (this.type === Cell.Types.Merge) {
|
|
148
148
|
this._value.release();
|
|
149
149
|
this._value = Value.create(Cell.Types.Null, this);
|
|
150
|
-
this.style = this._mergeStyle(this._row.style, this._column.style, {});
|
|
150
|
+
this.style = this._mergeStyle(this._row.style, this._column.style, { ...this.style });
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
isMergedTo(master) {
|
|
@@ -188,16 +188,29 @@ class WorkSheetXform extends BaseXform {
|
|
|
188
188
|
vmlDrawing: `vmlDrawing${model.id}`
|
|
189
189
|
});
|
|
190
190
|
}
|
|
191
|
-
// Handle pre-loaded drawing (from file read) that may contain charts or other non-image content
|
|
192
|
-
//
|
|
193
|
-
//
|
|
191
|
+
// Handle pre-loaded drawing (from file read) that may contain charts or other non-image content.
|
|
192
|
+
// Reset anchors and rels so they are rebuilt cleanly from model.media (images) and
|
|
193
|
+
// model.formControls (shapes) below. Without this reset, every read-write cycle would
|
|
194
|
+
// duplicate image anchors because the same images exist in both model.drawing.anchors
|
|
195
|
+
// (preserved for round-trip) and model.media (the canonical image list).
|
|
196
|
+
// For chart drawings, rels are preserved because the raw XML passthrough references
|
|
197
|
+
// original rIds; anchors are still cleared since they are unused for chart drawings.
|
|
194
198
|
if (model.drawing && model.drawing.anchors) {
|
|
195
|
-
// This is a loaded drawing that needs to be added to relationships
|
|
196
199
|
const drawing = model.drawing;
|
|
197
200
|
drawing.rId = nextRid(rels);
|
|
198
201
|
if (!drawing.name) {
|
|
199
202
|
drawing.name = `drawing${++options.drawingsCount}`;
|
|
200
203
|
}
|
|
204
|
+
const hasChartRels = (drawing.rels ?? []).some((rel) => rel.Target && rel.Target.includes("/charts/"));
|
|
205
|
+
// Anchors are always reset: for chart drawings they are unused (raw XML passthrough),
|
|
206
|
+
// for normal drawings they are rebuilt from model.media below.
|
|
207
|
+
drawing.anchors = [];
|
|
208
|
+
if (!hasChartRels) {
|
|
209
|
+
// Non-chart drawings: clear rels so image rels are rebuilt from scratch.
|
|
210
|
+
drawing.rels = [];
|
|
211
|
+
}
|
|
212
|
+
// Chart drawings keep their original rels intact since the raw drawing XML
|
|
213
|
+
// references those rIds directly.
|
|
201
214
|
options.drawings.push(drawing);
|
|
202
215
|
rels.push({
|
|
203
216
|
Id: drawing.rId,
|
|
@@ -150,7 +150,7 @@ class Cell {
|
|
|
150
150
|
if (this.type === Cell.Types.Merge) {
|
|
151
151
|
this._value.release();
|
|
152
152
|
this._value = Value.create(Cell.Types.Null, this);
|
|
153
|
-
this.style = this._mergeStyle(this._row.style, this._column.style, {});
|
|
153
|
+
this.style = this._mergeStyle(this._row.style, this._column.style, { ...this.style });
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
isMergedTo(master) {
|
|
@@ -191,16 +191,29 @@ class WorkSheetXform extends base_xform_1.BaseXform {
|
|
|
191
191
|
vmlDrawing: `vmlDrawing${model.id}`
|
|
192
192
|
});
|
|
193
193
|
}
|
|
194
|
-
// Handle pre-loaded drawing (from file read) that may contain charts or other non-image content
|
|
195
|
-
//
|
|
196
|
-
//
|
|
194
|
+
// Handle pre-loaded drawing (from file read) that may contain charts or other non-image content.
|
|
195
|
+
// Reset anchors and rels so they are rebuilt cleanly from model.media (images) and
|
|
196
|
+
// model.formControls (shapes) below. Without this reset, every read-write cycle would
|
|
197
|
+
// duplicate image anchors because the same images exist in both model.drawing.anchors
|
|
198
|
+
// (preserved for round-trip) and model.media (the canonical image list).
|
|
199
|
+
// For chart drawings, rels are preserved because the raw XML passthrough references
|
|
200
|
+
// original rIds; anchors are still cleared since they are unused for chart drawings.
|
|
197
201
|
if (model.drawing && model.drawing.anchors) {
|
|
198
|
-
// This is a loaded drawing that needs to be added to relationships
|
|
199
202
|
const drawing = model.drawing;
|
|
200
203
|
drawing.rId = nextRid(rels);
|
|
201
204
|
if (!drawing.name) {
|
|
202
205
|
drawing.name = `drawing${++options.drawingsCount}`;
|
|
203
206
|
}
|
|
207
|
+
const hasChartRels = (drawing.rels ?? []).some((rel) => rel.Target && rel.Target.includes("/charts/"));
|
|
208
|
+
// Anchors are always reset: for chart drawings they are unused (raw XML passthrough),
|
|
209
|
+
// for normal drawings they are rebuilt from model.media below.
|
|
210
|
+
drawing.anchors = [];
|
|
211
|
+
if (!hasChartRels) {
|
|
212
|
+
// Non-chart drawings: clear rels so image rels are rebuilt from scratch.
|
|
213
|
+
drawing.rels = [];
|
|
214
|
+
}
|
|
215
|
+
// Chart drawings keep their original rels intact since the raw drawing XML
|
|
216
|
+
// references those rIds directly.
|
|
204
217
|
options.drawings.push(drawing);
|
|
205
218
|
rels.push({
|
|
206
219
|
Id: drawing.rId,
|
|
@@ -147,7 +147,7 @@ class Cell {
|
|
|
147
147
|
if (this.type === Cell.Types.Merge) {
|
|
148
148
|
this._value.release();
|
|
149
149
|
this._value = Value.create(Cell.Types.Null, this);
|
|
150
|
-
this.style = this._mergeStyle(this._row.style, this._column.style, {});
|
|
150
|
+
this.style = this._mergeStyle(this._row.style, this._column.style, { ...this.style });
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
isMergedTo(master) {
|
|
@@ -188,16 +188,29 @@ class WorkSheetXform extends BaseXform {
|
|
|
188
188
|
vmlDrawing: `vmlDrawing${model.id}`
|
|
189
189
|
});
|
|
190
190
|
}
|
|
191
|
-
// Handle pre-loaded drawing (from file read) that may contain charts or other non-image content
|
|
192
|
-
//
|
|
193
|
-
//
|
|
191
|
+
// Handle pre-loaded drawing (from file read) that may contain charts or other non-image content.
|
|
192
|
+
// Reset anchors and rels so they are rebuilt cleanly from model.media (images) and
|
|
193
|
+
// model.formControls (shapes) below. Without this reset, every read-write cycle would
|
|
194
|
+
// duplicate image anchors because the same images exist in both model.drawing.anchors
|
|
195
|
+
// (preserved for round-trip) and model.media (the canonical image list).
|
|
196
|
+
// For chart drawings, rels are preserved because the raw XML passthrough references
|
|
197
|
+
// original rIds; anchors are still cleared since they are unused for chart drawings.
|
|
194
198
|
if (model.drawing && model.drawing.anchors) {
|
|
195
|
-
// This is a loaded drawing that needs to be added to relationships
|
|
196
199
|
const drawing = model.drawing;
|
|
197
200
|
drawing.rId = nextRid(rels);
|
|
198
201
|
if (!drawing.name) {
|
|
199
202
|
drawing.name = `drawing${++options.drawingsCount}`;
|
|
200
203
|
}
|
|
204
|
+
const hasChartRels = (drawing.rels ?? []).some((rel) => rel.Target && rel.Target.includes("/charts/"));
|
|
205
|
+
// Anchors are always reset: for chart drawings they are unused (raw XML passthrough),
|
|
206
|
+
// for normal drawings they are rebuilt from model.media below.
|
|
207
|
+
drawing.anchors = [];
|
|
208
|
+
if (!hasChartRels) {
|
|
209
|
+
// Non-chart drawings: clear rels so image rels are rebuilt from scratch.
|
|
210
|
+
drawing.rels = [];
|
|
211
|
+
}
|
|
212
|
+
// Chart drawings keep their original rels intact since the raw drawing XML
|
|
213
|
+
// references those rIds directly.
|
|
201
214
|
options.drawings.push(drawing);
|
|
202
215
|
rels.push({
|
|
203
216
|
Id: drawing.rId,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @cj-tech-master/excelts v5.1.
|
|
2
|
+
* @cj-tech-master/excelts v5.1.2-canary.20260211105222.3da3461
|
|
3
3
|
* TypeScript Excel Workbook Manager - Read and Write xlsx and csv Files.
|
|
4
4
|
* (c) 2026 cjnoname
|
|
5
5
|
* Released under the MIT License
|
|
@@ -768,7 +768,7 @@ var ExcelTS = (function(exports) {
|
|
|
768
768
|
if (this.type === Cell.Types.Merge) {
|
|
769
769
|
this._value.release();
|
|
770
770
|
this._value = Value.create(Cell.Types.Null, this);
|
|
771
|
-
this.style = this._mergeStyle(this._row.style, this._column.style, {});
|
|
771
|
+
this.style = this._mergeStyle(this._row.style, this._column.style, { ...this.style });
|
|
772
772
|
}
|
|
773
773
|
}
|
|
774
774
|
isMergedTo(master) {
|
|
@@ -14219,6 +14219,9 @@ var ExcelTS = (function(exports) {
|
|
|
14219
14219
|
const drawing = model.drawing;
|
|
14220
14220
|
drawing.rId = nextRid(rels);
|
|
14221
14221
|
if (!drawing.name) drawing.name = `drawing${++options.drawingsCount}`;
|
|
14222
|
+
const hasChartRels = (drawing.rels ?? []).some((rel) => rel.Target && rel.Target.includes("/charts/"));
|
|
14223
|
+
drawing.anchors = [];
|
|
14224
|
+
if (!hasChartRels) drawing.rels = [];
|
|
14222
14225
|
options.drawings.push(drawing);
|
|
14223
14226
|
rels.push({
|
|
14224
14227
|
Id: drawing.rId,
|