Preserve QWord line spacing in DOCX
This commit is contained in:
@@ -381,4 +381,22 @@ describe("wordOffice DOCX import", () => {
|
||||
{ type: "paragraph", text: "Paragraph spacing", runs: [{ text: "Paragraph spacing" }], spacing: { before: 240, after: 360 } }
|
||||
]);
|
||||
});
|
||||
|
||||
it("imports DOCX paragraph line spacing from OOXML", async () => {
|
||||
const blob = await exportDocxBlob(
|
||||
"LineSpacing.docx",
|
||||
'<p style="line-height: 1.5;">Auto line height</p><p style="line-height: 24pt;">Exact line height</p>'
|
||||
);
|
||||
const file = new File([blob], "LineSpacing.docx", {
|
||||
type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
||||
});
|
||||
const imported = await importDocxFile(file);
|
||||
|
||||
expect(imported.html).toContain("line-height: 1.5;");
|
||||
expect(imported.html).toContain("line-height: 24pt;");
|
||||
expect(htmlToWordBlocks(imported.html)).toEqual([
|
||||
{ type: "paragraph", text: "Auto line height", runs: [{ text: "Auto line height" }], spacing: { line: 360, lineRule: "auto" } },
|
||||
{ type: "paragraph", text: "Exact line height", runs: [{ text: "Exact line height" }], spacing: { line: 480, lineRule: "exact" } }
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user