FieldListNumListName Property

Gets or sets the name of the abstract numbering definition used for the numbering.

Namespace:  Aspose.Words.Fields
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public string ListName { get; set; }

Property Value

Type: String
Examples
Shows how to number paragraphs with LISTNUM fields.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Insert a list num field using a document builder
FieldListNum fieldListNum = (FieldListNum)builder.InsertField(FieldType.FieldListNum, true);

// Lists start counting at 1 by default, but we can change this number at any time
// In this case, we'll do a zero-based count
fieldListNum.StartingNumber = "0";
builder.Writeln("Paragraph 1");

// Placing several list num fields in one paragraph increases the list level instead of the current number,
// in this case resulting in "1)a)i)", list level 3
builder.InsertField(FieldType.FieldListNum, true);
builder.InsertField(FieldType.FieldListNum, true);
builder.InsertField(FieldType.FieldListNum, true);
builder.Writeln("Paragraph 2");

// The list level resets with new paragraphs, so to keep counting at a desired list level, we need to set the ListLevel property accordingly
fieldListNum = (FieldListNum)builder.InsertField(FieldType.FieldListNum, true);
fieldListNum.ListLevel = "3";
builder.Writeln("Paragraph 3");

fieldListNum = (FieldListNum)builder.InsertField(FieldType.FieldListNum, true);

// Setting this property to this particular value will emulate the AUTONUMOUT field
fieldListNum.ListName = "OutlineDefault";
Assert.IsTrue(fieldListNum.HasListName);

// Start counting from 1
fieldListNum.StartingNumber = "1";
builder.Writeln("Paragraph 4");

// Our fields keep track of the count automatically, but the ListName needs to be set with each new field
fieldListNum = (FieldListNum)builder.InsertField(FieldType.FieldListNum, true);
fieldListNum.ListName = "OutlineDefault";
builder.Writeln("Paragraph 5");

Assert.AreEqual(" LISTNUM  OutlineDefault", fieldListNum.GetFieldCode());

doc.UpdateFields();
doc.Save(ArtifactsDir + "Field.LISTNUM.docx");
See Also