Preserve QWord DOCX tables on import
This commit is contained in:
@@ -112,4 +112,30 @@ describe("wordOffice DOCX import", () => {
|
||||
}
|
||||
]);
|
||||
});
|
||||
|
||||
it("imports simple DOCX tables from OOXML", async () => {
|
||||
const blob = await exportDocxBlob(
|
||||
"Table.docx",
|
||||
"<p>Before table</p><table><tr><th>Stage</th><th>Owner</th></tr><tr><td>Plan</td><td>Anna</td></tr></table><p>After table</p>"
|
||||
);
|
||||
const file = new File([blob], "Table.docx", {
|
||||
type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
||||
});
|
||||
const imported = await importDocxFile(file);
|
||||
|
||||
expect(imported.html).toContain("<table>");
|
||||
expect(imported.html).toContain("<td><p>Stage</p></td>");
|
||||
expect(imported.html).toContain("<td><p>Anna</p></td>");
|
||||
expect(htmlToWordBlocks(imported.html)).toEqual([
|
||||
{ type: "paragraph", text: "Before table", runs: [{ text: "Before table" }] },
|
||||
{
|
||||
type: "table",
|
||||
rows: [
|
||||
["Stage", "Owner"],
|
||||
["Plan", "Anna"]
|
||||
]
|
||||
},
|
||||
{ type: "paragraph", text: "After table", runs: [{ text: "After table" }] }
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user