Preserve QWord page breaks in DOCX

This commit is contained in:
Курнат Андрей
2026-06-01 19:35:11 +03:00
parent a2de721fc4
commit 6204d59418
6 changed files with 134 additions and 17 deletions
+17
View File
@@ -112,6 +112,23 @@ describe("wordOffice DOCX import", () => {
]);
});
it("imports DOCX page breaks from OOXML", async () => {
const blob = await exportDocxBlob("PageBreak.docx", '<p>Before<span data-qoffice-page-break="true"></span>After</p>');
const file = new File([blob], "PageBreak.docx", {
type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
});
const imported = await importDocxFile(file);
expect(imported.html).toContain('data-qoffice-page-break="true"');
expect(htmlToWordBlocks(imported.html)).toEqual([
{
type: "paragraph",
text: "Before After",
runs: [{ text: "Before\fAfter" }]
}
]);
});
it("imports DOCX tabs from OOXML", async () => {
const blob = await exportDocxBlob("Tab.docx", '<p>Before<span data-qoffice-tab="true" style="white-space: pre;">\t</span>After</p>');
const file = new File([blob], "Tab.docx", {