Place the field before the list paragraph

Hi there,
Suppose given a list based paragraph in the word doc, we need to insert the field just before such a paragraph.

For instance -

  1. We recorded 2013.

This would be represented in /word/document.xml as -

<w:p w:rsidR="00BE74DC" w:rsidP="00BE74DC">
 <w:pPr>
<w:pStyle w:val="ListParagraph" />
 <w:numPr>
<w:ilvl w:val="0" />
<w:numId w:val="2" />
</w:numPr>
 <w:rPr>
<w:color w:val="FF0000" />
<w:sz w:val="16" />
<w:szCs w:val="16" />
</w:rPr>
</w:pPr>
 <w:r w:rsidRPr="00BE74DC">
 <w:rPr>
<w:color w:val="FF0000" />
<w:sz w:val="16" />
<w:szCs w:val="16" />
</w:rPr>
<w:t xml:space="preserve">We recorded 2013.</w:t>
</w:r>
</w:p>

We are in the assumption that the xml snippet -

<w:numPr>
<w:ilvl w:val="0" />
<w:numId w:val="2" />
</w:numPr>

determines the list label (1., a. *. etc.).

We don’t want to insert the field at the end of paragraph just before it, neither we want to create new paragraph before it.

So, we think DocumentBuilder needs to move just before

<w:numPr>
<w:ilvl w:val="0" />
<w:numId w:val="2" />
</w:numPr>

and we need to insert the field just before it and within the paragraph.

Could you please help us for the same?
Thanks.

Hi Praneeth,

Thanks for your inquiry. Please attach the following resources here for testing.

  1. Input Word document which contains a list paragraph
  2. Expected Word document which shows the desired behavior. Please create this document using MS Word.

We will then provide you code to achieve the same expected output using Aspose.Words.

Best regards,