AddSingleLevelList
Contents
[
Hide
]ListCollection.AddSingleLevelList method
Creates a new single level list based on the predefined template and adds it to the list collection in the document.
public List AddSingleLevelList(ListTemplate listTemplate)
Examples
Shows how to create a new single level list based on the predefined template.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
ListCollection listCollection = doc.Lists;
// Creates the bulleted list from BulletCircle template.
List bulletedList = listCollection.AddSingleLevelList(ListTemplate.BulletCircle);
// Writes the bulleted list to the resulting document.
builder.Writeln("Bulleted list starts below:");
builder.ListFormat.List = bulletedList;
builder.Writeln("Item 1");
builder.Writeln("Item 2");
builder.ListFormat.RemoveNumbers();
// Creates the numbered list from NumberUppercaseLetterDot template.
List numberedList = listCollection.AddSingleLevelList(ListTemplate.NumberUppercaseLetterDot);
// Writes the numbered list to the resulting document.
builder.Writeln("Numbered list starts below:");
builder.ListFormat.List = numberedList;
builder.Writeln("Item 1");
builder.Writeln("Item 2");
doc.Save(ArtifactsDir + "Lists.AddSingleLevelList.docx");
See Also
- class List
- enum ListTemplate
- class ListCollection
- namespace Aspose.Words.Lists
- assembly Aspose.Words