Preserve QWord paragraph indentation in DOCX
This commit is contained in:
@@ -256,4 +256,22 @@ describe("wordOffice DOCX import", () => {
|
||||
rows: [["Stage", "Done"]]
|
||||
});
|
||||
});
|
||||
|
||||
it("imports DOCX paragraph indentation from OOXML", async () => {
|
||||
const blob = await exportDocxBlob(
|
||||
"Indent.docx",
|
||||
'<p style="margin-left: 36pt; text-indent: 18pt;">Indented</p><p style="margin-left: 48px; text-indent: -12pt;">Hanging</p>'
|
||||
);
|
||||
const file = new File([blob], "Indent.docx", {
|
||||
type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
||||
});
|
||||
const imported = await importDocxFile(file);
|
||||
|
||||
expect(imported.html).toContain("margin-left: 36pt; text-indent: 18pt;");
|
||||
expect(imported.html).toContain("margin-left: 36pt; text-indent: -12pt;");
|
||||
expect(htmlToWordBlocks(imported.html)).toEqual([
|
||||
{ type: "paragraph", text: "Indented", runs: [{ text: "Indented" }], indent: { left: 720, firstLine: 360 } },
|
||||
{ type: "paragraph", text: "Hanging", runs: [{ text: "Hanging" }], indent: { left: 720, hanging: 240 } }
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user