diff --git a/lib/xlsx/xform/sheet/cell-xform.js b/lib/xlsx/xform/sheet/cell-xform.js index b748eb458..d233b6f51 100644 --- a/lib/xlsx/xform/sheet/cell-xform.js +++ b/lib/xlsx/xform/sheet/cell-xform.js @@ -65,6 +65,7 @@ class CellXform extends BaseXform { switch (model.type) { case Enums.ValueType.String: + case Enums.ValueType.RichText: if (options.sharedStrings) { model.ssId = options.sharedStrings.add(model.value); } @@ -225,6 +226,7 @@ class CellXform extends BaseXform { break; case Enums.ValueType.String: + case Enums.ValueType.RichText: if (model.ssId !== undefined) { xmlStream.addAttribute('t', 's'); xmlStream.leafNode('v', null, model.ssId); diff --git a/spec/unit/xlsx/xform/sheet/cell-xform.spec.js b/spec/unit/xlsx/xform/sheet/cell-xform.spec.js index 2ddb88c35..1d72a8459 100644 --- a/spec/unit/xlsx/xform/sheet/cell-xform.spec.js +++ b/spec/unit/xlsx/xform/sheet/cell-xform.spec.js @@ -173,6 +173,55 @@ const expectations = [ styles: fakeStyles, }, }, + { + title: 'Shared String with RichText', + create() { + return new CellXform(); + }, + initialModel: { + address: 'A1', + type: Enums.ValueType.RichText, + value: { + richText: [ + {font: {color: {argb: 'FF0000'}}, text: 'red'}, + {font: {color: {argb: '00FF00'}}, text: 'green'}, + ], + }, + }, + preparedModel: { + address: 'A1', + type: Enums.ValueType.RichText, + value: { + richText: [ + {font: {color: {argb: 'FF0000'}}, text: 'red'}, + {font: {color: {argb: '00FF00'}}, text: 'green'}, + ], + }, + ssId: 0, + }, + xml: '0', + parsedModel: { + address: 'A1', + type: Enums.ValueType.String, + value: 0, + }, + reconciledModel: { + address: 'A1', + type: Enums.ValueType.RichText, + value: { + richText: [ + {font: {color: {argb: 'FF0000'}}, text: 'red'}, + {font: {color: {argb: '00FF00'}}, text: 'green'}, + ], + }, + }, + tests: ['prepare', 'render', 'renderIn', 'parse', 'reconcile'], + options: { + sharedStrings: new SharedStringsXform(), + hyperlinkMap: fakeHyperlinkMap, + styles: fakeStyles, + }, + }, { title: 'Date', create() { pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy