Preserve QExcell gridline visibility in XLSX

This commit is contained in:
Курнат Андрей
2026-06-01 17:38:08 +03:00
parent f72c79d5e9
commit 1117d8bbf0
4 changed files with 76 additions and 9 deletions
+38
View File
@@ -27,6 +27,7 @@ import {
worksheetXmlToHyperlinks,
worksheetXmlToMergedCells,
worksheetXmlToRowHeights,
worksheetXmlToShowGridLines,
worksheetXmlToTabColor,
xlsxStylesXmlToCellFormatTable,
xlsxThemeXmlToColors,
@@ -650,6 +651,43 @@ describe("excellOffice OOXML helpers", () => {
expect(imported.sheets[0].frozenPane).toEqual({ columns: 1, rows: 1, topLeftCell: "B2", activePane: "bottomRight" });
});
it("читает и записывает скрытие сетки листа XLSX через sheetView showGridLines", async () => {
expect(
worksheetXmlToShowGridLines({
worksheet: {
sheetViews: {
sheetView: { showGridLines: "0" }
}
}
})
).toBe(false);
expect(buildSheetViewsXml(undefined, false)).toBe('<sheetViews><sheetView workbookViewId="0" showGridLines="0"/></sheetViews>');
expect(buildSheetViewsXml({ rows: 1 }, false)).toBe(
'<sheetViews><sheetView workbookViewId="0" showGridLines="0"><pane ySplit="1" topLeftCell="A2" activePane="bottomLeft" state="frozen"/></sheetView></sheetViews>'
);
const blob = await exportXlsxBlob({
id: "book-1",
title: "Grid lines.xlsx",
updatedAt: "2026-06-01T00:00:00.000Z",
activeSheet: "sheet-1",
sheets: [
{
id: "sheet-1",
name: "Grid",
showGridLines: false,
cells: { A1: "No grid" }
}
]
});
const zip = await JSZip.loadAsync(await blob.arrayBuffer());
const sheetXml = (await zip.file("xl/worksheets/sheet1.xml")?.async("string")) ?? "";
const imported = await importXlsxFile(new File([blob], "Grid lines.xlsx", { type: blob.type }));
expect(sheetXml).toContain('<sheetViews><sheetView workbookViewId="0" showGridLines="0"/></sheetViews>');
expect(imported.sheets[0].showGridLines).toBe(false);
});
it("читает и записывает автофильтр XLSX через autoFilter ref", async () => {
expect(
worksheetXmlToAutoFilter({