Aspose C# : How to start section numbering from a particular number (nor next default sequence continued neither restart numbering)

Dear,

I want to start a section at a particular number and not continue with the next default sequence number. Also, don’t want it to restart the numbering.

I tried following but then the whole document is affected. Sections that should start at 1 started at 7 and my section still got next default sequence number. I want only my section to start at 7, is that possible ?

List lst = doc.Lists.Add(Aspose.Words.Lists.ListTemplate.OutlineLegal); lst.ListLevels[0].NumberFormat = "\0";
lst.ListLevels[1].NumberFormat = "\0.\u0001";
lst.ListLevels[0].StartAt = 7;

For e.g. document already has sections 1, 2, 3 and 4 and I want my new section being added as 7.

  1. Head
    1.1 Sub Head

  2. Head
    2.1 Sub Head

  3. Head
    3.1 Sub Head

  4. Head
    4.1 Sub Head

"7. Head
7.1 Sub Head "

Is that possible ? Any help ?

Thanks,
Pradnya

@PradnyaR You should apply newly created List instance to the added paragraphs. For example you could use DocumentBuilder class:

List lst = doc.Lists.Add(Aspose.Words.Lists.ListTemplate.OutlineLegal);
lst.ListLevels[0].NumberFormat = "\0";
lst.ListLevels[1].NumberFormat = "\0.\u0001";
lst.ListLevels[0].StartAt = 7;

DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToDocumentEnd();
builder.Writeln();

builder.ListFormat.List = lst;
builder.ListFormat.ListLevelNumber = 0;
builder.Write("Head");
builder.Writeln();
            
builder.ListFormat.ListLevelNumber = 1;
builder.Write("Sub Head");