Preserve QWord bookmarks in DOCX
This commit is contained in:
@@ -184,6 +184,21 @@ describe("wordOffice DOCX import", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it("imports DOCX bookmarks as HTML ids", async () => {
|
||||
const blob = await exportDocxBlob("Bookmark.docx", '<h1 id="Section1">Section</h1><p><a href="#Section1">Open section</a></p>');
|
||||
const file = new File([blob], "Bookmark.docx", {
|
||||
type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
||||
});
|
||||
const imported = await importDocxFile(file);
|
||||
|
||||
expect(imported.html).toContain('<h1 id="Section1">Section</h1>');
|
||||
expect(imported.html).toContain('<a href="#Section1">Open section</a>');
|
||||
expect(htmlToWordBlocks(imported.html)).toEqual([
|
||||
{ type: "heading", level: 1, text: "Section", runs: [{ text: "Section" }], bookmark: "Section1" },
|
||||
{ type: "paragraph", text: "Open section", runs: [{ text: "Open section", href: "#Section1" }] }
|
||||
]);
|
||||
});
|
||||
|
||||
it("imports simple DOCX tables from OOXML", async () => {
|
||||
const blob = await exportDocxBlob(
|
||||
"Table.docx",
|
||||
|
||||
Reference in New Issue
Block a user