I think I discovered an issue with the paragraph indentation that I added to a previous issue. I'm not sure if closed issues are are monitored, so I'm creating this.
Description
The SetNumberingDefinition
and SetNumberingDefinitionByID
methods on Paragraph
set the PPr.NumPr.NumId
property but the value that they set it to is the ID of the abstractNum
. I believe they should be setting the value to the ID of a CT_Num.NumIdAttr
which references an abstractNum
.
Expected Behavior/Actual Behaviour
In document.xml
, paragraphs look like this (second indented item):
<w:p w14:paraId="1D8F95A7" w14:textId="294F4857" w:rsidP="00BD6BD9" w:rsidR="00BD6BD9" w:rsidRDefault="00BD6BD9">
<w:pPr>
<w:pStyle w:val="ListOrdered"/>
<w:numPr>
<w:ilvl w:val="1"/>
<w:numId w:val="2"/>
</w:numPr>
</w:pPr>
<w:r>
<w:t>List Item Text Here</w:t>
</w:r>
</w:p>
In numbering.xml
, there are num
's and abstractNum
's. Mine looks like this:
<w:abstractNum w15:restartNumberingAfterBreak="0" w:abstractNumId="0">
...
</w:abstractNum>
<w:abstractNum w15:restartNumberingAfterBreak="0" w:abstractNumId="1">
...
</w:abstractNum>
<w:num w:numId="1">
<w:abstractNumId w:val="0"/>
</w:num>
<w:num w:numId="2">
<w:abstractNumId w:val="1"/>
</w:num>
The numId
value in the paragraph looks like it points to a <w:num>
, not an abstractNum
.
The helper methods on the paragraph, SetNumberingDefinition
and SetNumberingDefinitionByID
both essentially operate on a NumberingDefinition
which is a CT_AbstractNum
. This sets the NumId
on the NumPr
of the paragraph properties PPr.NumPr.NumId
, but they set it equal to the id of the abstractNum
that is passed in.
I believe the PPr.NumPr.NumId
should point to a CT_Num.NumIdAttr
which is an entry in doc.Numbering.X().Num
. CT_Num
then contains the reference to the AbstractNumId
that you want to use.
I don't think the function signatures for the paragraph helpers needs to change since any lookups or creations would take place against the abstractNum
, but the CT_Num
would probably need to be looked up or created based on the abstractNum
so that the CT_Num
could then be referenced.
I noticed in my XML there are two abstractNums
with ids 0
and 1
, but the paragraph references use IDs 1
and 2
which match the <w:num>
tags. The naming also seems to line up.
Let me know if I have something wrong.