Add QExcell cell text colors

This commit is contained in:
Курнат Андрей
2026-06-01 06:19:24 +03:00
parent 08fe16bdf6
commit 9c48e1d8b1
6 changed files with 51 additions and 13 deletions
+6 -6
View File
@@ -76,7 +76,7 @@ describe("excellOffice OOXML helpers", () => {
it("сохраняет базовое форматирование ячеек XLSX в XML листа", () => {
const cellFormats = {
A1: { bold: true, fillColor: "fff2cc" },
A1: { bold: true, textColor: "0f5fae", fillColor: "fff2cc" },
B2: { italics: true, underline: true },
C3: { fillColor: "bad-color" }
};
@@ -97,7 +97,7 @@ describe("excellOffice OOXML helpers", () => {
numFmt: { numFmtId: "164", formatCode: "dd.mm.yyyy" }
},
fonts: {
font: [{}, { b: {}, i: {}, u: {} }]
font: [{}, { b: {}, i: {}, u: {}, color: { rgb: "FF0F5FAE" } }]
},
fills: {
fill: [{}, {}, { patternFill: { fgColor: { rgb: "FFFFF2CC" } } }]
@@ -108,7 +108,7 @@ describe("excellOffice OOXML helpers", () => {
}
});
expect(styleTable[1]).toEqual({ bold: true, italics: true, underline: true, fillColor: "FFF2CC", numberFormat: "dd.mm.yyyy" });
expect(styleTable[1]).toEqual({ bold: true, italics: true, underline: true, textColor: "0F5FAE", fillColor: "FFF2CC", numberFormat: "dd.mm.yyyy" });
expect(styleTable[2]).toEqual({ numberFormat: "m/d/yy" });
expect(
worksheetXmlToCellFormats(
@@ -124,7 +124,7 @@ describe("excellOffice OOXML helpers", () => {
},
styleTable
)
).toEqual({ A1: { bold: true, italics: true, underline: true, fillColor: "FFF2CC", numberFormat: "dd.mm.yyyy" } });
).toEqual({ A1: { bold: true, italics: true, underline: true, textColor: "0F5FAE", fillColor: "FFF2CC", numberFormat: "dd.mm.yyyy" } });
});
it("преобразует XML листа в модель QExcell", () => {
@@ -323,7 +323,7 @@ describe("excellOffice OOXML helpers", () => {
mergedCells: [{ start: "A1", end: "C1" }],
hyperlinks: { A1: "https://example.com/budget" },
cellFormats: {
A1: { bold: true, fillColor: "FFF2CC" },
A1: { bold: true, textColor: "0F5FAE", fillColor: "FFF2CC" },
AC20: { underline: true },
D20: { numberFormat: "dd.mm.yyyy" },
E20: { numberFormat: "0%" }
@@ -357,7 +357,7 @@ describe("excellOffice OOXML helpers", () => {
expect(imported.sheets[0].mergedCells).toEqual([{ start: "A1", end: "C1" }]);
expect(imported.sheets[0].hyperlinks).toEqual({ A1: "https://example.com/budget" });
expect(imported.sheets[0].cellFormats).toEqual({
A1: { bold: true, fillColor: "FFF2CC" },
A1: { bold: true, textColor: "0F5FAE", fillColor: "FFF2CC" },
AC20: { underline: true },
D20: { numberFormat: "dd.mm.yyyy" },
E20: { numberFormat: "0%" }