Read QExcell theme colors from XLSX styles

This commit is contained in:
Курнат Андрей
2026-06-01 12:07:13 +03:00
parent 1df1b1114e
commit c751fda372
3 changed files with 114 additions and 8 deletions
+32
View File
@@ -342,6 +342,38 @@ describe("excellOffice OOXML helpers", () => {
});
});
it("читает theme, tint и indexed цвета XLSX из styles.xml", () => {
const styleTable = xlsxStylesXmlToCellFormatTable({
styleSheet: {
fonts: {
font: [{ color: { theme: "1" } }, { color: { theme: "4", tint: "0.5" } }, { color: { indexed: "22" } }]
},
fills: {
fill: [{}, {}, { patternFill: { fgColor: { theme: "6" } } }]
},
borders: {
border: [{}, { left: { style: "thin", color: { indexed: "4" } } }]
},
cellXfs: {
xf: [
{ fontId: "0", fillId: "0", borderId: "0" },
{ fontId: "1", fillId: "2", borderId: "1" },
{ fontId: "2", fillId: "0", borderId: "0" }
]
}
}
});
expect(styleTable[0]).toBeUndefined();
expect(styleTable[1]).toEqual({
textColor: "A7C0DE",
fillColor: "9BBB59",
border: true,
borderColor: "0000FF"
});
expect(styleTable[2]).toEqual({ textColor: "C0C0C0" });
});
it("преобразует XML листа в модель QExcell", () => {
const cells = worksheetXmlToCells(
{