Preserve QWord tabs in DOCX

This commit is contained in:
Курнат Андрей
2026-06-01 12:40:37 +03:00
parent 3700a39434
commit 8517bd6391
4 changed files with 93 additions and 16 deletions
+17
View File
@@ -112,6 +112,23 @@ describe("wordOffice DOCX import", () => {
]);
});
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", {
type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
});
const imported = await importDocxFile(file);
expect(imported.html).toContain('data-qoffice-tab="true"');
expect(htmlToWordBlocks(imported.html)).toEqual([
{
type: "paragraph",
text: "Before After",
runs: [{ text: "Before\tAfter" }]
}
]);
});
it("imports DOCX external hyperlinks from OOXML relationships", async () => {
const blob = await exportDocxBlob("Hyperlink.docx", '<p>Open <a href="https://example.com/report"><strong>report</strong></a>.</p>');
const file = new File([blob], "Hyperlink.docx", {