Free Support Forum -

Need help with adding numbering & list levels

I am facing an issue when adding current document list style to newly added text within content controls.
The newly added text that you will find in the document is :

All Clause Types

test clause default

Effective Start Date​​​​​​​

I have attached input & expected output documents. I need the content control around “All Clause Types” to have a listlevel =2 & append numbering 1.2 to it
the content control below it to have a listlevel = 3 and append no numbering to it based on the existing list style. Could you please help me to get the desired output programmatically?


List (37.6 KB)


We are working over your query and will get back to you soon.


You can make the target Paragraph part of List by using the following code:

Document doc = new Document("D:\\List Level\\LLinput.docx");

List list = doc.Lists[0];
Paragraph targetPara = null;

foreach (Paragraph para in doc.GetChildNodes(NodeType.Paragraph, true))
    if (para.ToString(SaveFormat.Text).StartsWith("All Clause Types"))
        targetPara = para;

if (targetPara != null)
    StructuredDocumentTag sdt = targetPara.ParentNode as StructuredDocumentTag;
    sdt.LockContentControl = false;
    sdt.LockContents = false;

    targetPara.ListFormat.List = list;
    targetPara.ListFormat.ListLevelNumber = 1;

doc.Save("D:\\List Level\\18.9.docx");