We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

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 -
<!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
<w:UseFELayout/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–>

  1. <span style=“font-size:8.0pt;font-family:“Times New Roman”,“serif”;
    mso-fareast-font-family:“Times New Roman”;mso-fareast-theme-font:minor-fareast;
    color:red;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:
    AR-SA”>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,