diff --git a/src/lib/export/docx.ts b/src/lib/export/docx.ts index 9b497f6..8d4b77b 100644 --- a/src/lib/export/docx.ts +++ b/src/lib/export/docx.ts @@ -1258,7 +1258,9 @@ function bibSourceXml(s: BibSource): string { // part of their own, which needs its properties part, two relationships and a content // type — none of which the package knows about, so all four are minted here. function applyBibliographyDocx(bytes: Uint8Array, sources: BibSource[], cite: CitationStyle): Uint8Array { - if (!sources.length) return bytes; + // The part is also the citation style's only carrier (its StyleName attribute), so a + // non-default style still writes it with no sources in it. + if (!sources.length && cite === 'key') return bytes; const files = unzipSync(bytes); const relsPath = 'word/_rels/document.xml.rels'; const rels = files[relsPath] ? strFromU8(files[relsPath]) : ''; diff --git a/src/lib/import/docx.ts b/src/lib/import/docx.ts index eadaba1..2f1aa91 100644 --- a/src/lib/import/docx.ts +++ b/src/lib/import/docx.ts @@ -2359,8 +2359,9 @@ function buildTable(tbl: Element, ctx: Ctx): Node | null { if (hdr && onOff(hdr)) attrs.repeatHeader = true; if (named) { attrs.tableStyle = named; + // '' is a declared all-off look — dropping it would revert to the default look. const look = docxTableLook(fc(tbl, 'tblPr')); - if (look) attrs.tableLook = look; + if (look != null) attrs.tableLook = look; } return Object.keys(attrs).length ? { type: 'table', attrs, content: rows } : { type: 'table', content: rows }; }