Preserve QWord DOCX font size

This commit is contained in:
Курнат Андрей
2026-06-01 06:53:02 +03:00
parent 024f208538
commit 9f5a003bae
4 changed files with 107 additions and 7 deletions
+17
View File
@@ -40,4 +40,21 @@ describe("wordOffice DOCX import", () => {
{ type: "paragraph", text: "Justified", runs: [{ text: "Justified" }], alignment: "both" }
]);
});
it("imports DOCX font size from OOXML", async () => {
const blob = await exportDocxBlob("FontSize.docx", '<p><span style="font-size: 18pt;">Large text</span></p>');
const file = new File([blob], "FontSize.docx", {
type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
});
const imported = await importDocxFile(file);
expect(imported.html).toContain("font-size: 18pt;");
expect(htmlToWordBlocks(imported.html)).toEqual([
{
type: "paragraph",
text: "Large text",
runs: [{ text: "Large text", fontSize: 18 }]
}
]);
});
});