Preserve QExcell hidden sheets in XLSX
This commit is contained in:
@@ -513,6 +513,16 @@ describe("excellOffice OOXML helpers", () => {
|
||||
})
|
||||
).toEqual([{ id: "sheet-7", name: "Бюджет", relationshipId: "rId3" }]);
|
||||
|
||||
expect(
|
||||
workbookSheetRefs({
|
||||
workbook: {
|
||||
sheets: {
|
||||
sheet: { name: "Архив", sheetId: "8", "r:id": "rId4", state: "hidden" }
|
||||
}
|
||||
}
|
||||
})
|
||||
).toEqual([{ id: "sheet-8", name: "Архив", visibility: "hidden", relationshipId: "rId4" }]);
|
||||
|
||||
expect(
|
||||
workbookRelationshipTargets({
|
||||
Relationships: {
|
||||
@@ -555,6 +565,28 @@ describe("excellOffice OOXML helpers", () => {
|
||||
expect(imported.activeSheet).toBe("sheet-2");
|
||||
});
|
||||
|
||||
it("сохраняет и импортирует скрытые листы XLSX через sheet state", async () => {
|
||||
const blob = await exportXlsxBlob({
|
||||
id: "book-1",
|
||||
title: "Скрытые листы.xlsx",
|
||||
updatedAt: "2026-06-01T00:00:00.000Z",
|
||||
activeSheet: "sheet-1",
|
||||
sheets: [
|
||||
{ id: "sheet-1", name: "Рабочий", cells: { A1: "Открыт" } },
|
||||
{ id: "sheet-2", name: "Архив", visibility: "hidden", cells: { A1: "Скрыт" } },
|
||||
{ id: "sheet-3", name: "Служебный", visibility: "veryHidden", cells: { A1: "Очень скрыт" } }
|
||||
]
|
||||
});
|
||||
const zip = await JSZip.loadAsync(await blob.arrayBuffer());
|
||||
const workbookXml = await zip.file("xl/workbook.xml")?.async("string");
|
||||
const imported = await importXlsxFile(new File([blob], "Скрытые листы.xlsx", { type: blob.type }));
|
||||
|
||||
expect(workbookXml).toContain('<sheet name="Архив" sheetId="2" r:id="rId2" state="hidden"/>');
|
||||
expect(workbookXml).toContain('<sheet name="Служебный" sheetId="3" r:id="rId3" state="veryHidden"/>');
|
||||
expect(imported.sheets[1]).toMatchObject({ id: "sheet-2", name: "Архив", visibility: "hidden" });
|
||||
expect(imported.sheets[2]).toMatchObject({ id: "sheet-3", name: "Служебный", visibility: "veryHidden" });
|
||||
});
|
||||
|
||||
it("создает OOXML chart part для диаграммы XLSX", () => {
|
||||
const xml = buildChartXml(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user