Preserve QExcell border colors

This commit is contained in:
Курнат Андрей
2026-06-01 08:00:09 +03:00
parent 56f2a4d6e4
commit 95be5e3a8a
5 changed files with 74 additions and 17 deletions
+15 -4
View File
@@ -188,7 +188,7 @@ describe("excellOffice OOXML helpers", () => {
id: "sheet-1",
name: "Sheet 1",
cells: { A1: "Bordered" },
cellFormats: { A1: { border: true } }
cellFormats: { A1: { border: true, borderColor: "C2410C" } }
}
]
});
@@ -201,6 +201,7 @@ describe("excellOffice OOXML helpers", () => {
expect(stylesXml).toContain('<right style="thin">');
expect(stylesXml).toContain('<top style="thin">');
expect(stylesXml).toContain('<bottom style="thin">');
expect(stylesXml).toContain('<color rgb="FFC2410C"/>');
});
it("читает базовое форматирование ячеек XLSX из styles.xml и XML листа", () => {
@@ -216,7 +217,15 @@ describe("excellOffice OOXML helpers", () => {
fill: [{}, {}, { patternFill: { fgColor: { rgb: "FFFFF2CC" } } }]
},
borders: {
border: [{}, { left: { style: "thin" }, right: { style: "thin" }, top: { style: "thin" }, bottom: { style: "thin" } }]
border: [
{},
{
left: { style: "thin", color: { rgb: "FFC2410C" } },
right: { style: "thin", color: { rgb: "FFC2410C" } },
top: { style: "thin", color: { rgb: "FFC2410C" } },
bottom: { style: "thin", color: { rgb: "FFC2410C" } }
}
]
},
cellXfs: {
xf: [
@@ -241,6 +250,7 @@ describe("excellOffice OOXML helpers", () => {
verticalAlign: "middle",
wrapText: true,
border: true,
borderColor: "C2410C",
numberFormat: "dd.mm.yyyy"
});
expect(styleTable[2]).toEqual({ numberFormat: "m/d/yy" });
@@ -272,6 +282,7 @@ describe("excellOffice OOXML helpers", () => {
verticalAlign: "middle",
wrapText: true,
border: true,
borderColor: "C2410C",
numberFormat: "dd.mm.yyyy"
}
});
@@ -473,7 +484,7 @@ describe("excellOffice OOXML helpers", () => {
mergedCells: [{ start: "A1", end: "C1" }],
hyperlinks: { A1: "https://example.com/budget" },
cellFormats: {
A1: { bold: true, strike: true, fontSize: 14, fontFamily: "Arial", textColor: "0F5FAE", fillColor: "FFF2CC", horizontalAlign: "center", verticalAlign: "middle", wrapText: true, border: true },
A1: { bold: true, strike: true, fontSize: 14, fontFamily: "Arial", textColor: "0F5FAE", fillColor: "FFF2CC", horizontalAlign: "center", verticalAlign: "middle", wrapText: true, border: true, borderColor: "C2410C" },
AC20: { underline: true },
D20: { numberFormat: "dd.mm.yyyy" },
E20: { numberFormat: "0%" }
@@ -507,7 +518,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, strike: true, fontSize: 14, fontFamily: "Arial", textColor: "0F5FAE", fillColor: "FFF2CC", horizontalAlign: "center", verticalAlign: "middle", wrapText: true, border: true },
A1: { bold: true, strike: true, fontSize: 14, fontFamily: "Arial", textColor: "0F5FAE", fillColor: "FFF2CC", horizontalAlign: "center", verticalAlign: "middle", wrapText: true, border: true, borderColor: "C2410C" },
AC20: { underline: true },
D20: { numberFormat: "dd.mm.yyyy" },
E20: { numberFormat: "0%" }