BlockNote icon indicating copy to clipboard operation
BlockNote copied to clipboard

DOCX Export: list items of different list types are not part of the same numbering instance

Open StephanMeijer opened this issue 2 months ago • 0 comments

Very related to #2225 and #2226

Exported material

bn-lists.docx

BlockNoteLibreOfficeGoogle Docs
Lists that are exported Image Image

Unconventionalness

For the same reason as described in #2225, the numId differs between different list type (ordered/unordered), even when it is a subitem under the same list.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:document ...>
  <w:body>
    <!-- ... -->
    <w:p>
      <w:pPr>
        <w:pStyle w:val="ListParagraph"/>
        <w:numPr>
          <w:ilvl w:val="0"/>
          <w:numId w:val="3"/>
        </w:numPr>
      </w:pPr>
      <w:r>
        <w:t xml:space="preserve">List 3 item 3 (unordered)</w:t>
      </w:r>
    </w:p>
    <w:p>
      <w:pPr>
        <w:pStyle w:val="ListParagraph"/>
        <w:numPr>
          <w:ilvl w:val="1"/>
          <w:numId w:val="2"/>
        </w:numPr>
      </w:pPr>
      <w:r>
        <w:t xml:space="preserve">List 3 item 3 subitem 1 (ordered)</w:t>
      </w:r>
    </w:p>
    <w:p>
      <w:pPr>
        <w:pStyle w:val="ListParagraph"/>
        <w:numPr>
          <w:ilvl w:val="1"/>
          <w:numId w:val="2"/>
        </w:numPr>
      </w:pPr>
      <w:r>
        <w:t xml:space="preserve">List 3 item 3 subitem 2 (ordered)</w:t>
      </w:r>
    </w:p>
    <!--- ... -->
  </w:body>
</w:document>

This is unwanted behavior. This explicitly defines the subitems to be a different numbering instance than it's 'parent'.

Conventional method

Define in word/numberings.xml if level 2 needs to be a ordered/numeric or unorderd/bullet. Give every list a different numId as described in #2225 (you can reuse the abstract numberings). This method is compatible with ECMA-376 and with all major editors. To do this properly, word/numberings.xml must be calculated, not be a fixed and static file injected.

Example

(from Google Docs)

word-numbering.xml word-document.xml gd.docx

StephanMeijer avatar Dec 03 '25 16:12 StephanMeijer