Specifies one of the predefined list formats available in Microsoft Word.
[Visual Basic]
Public Enum ListTemplate
[C#]public enum ListTemplate
Remarks
A list template value is used as a parameter into the Add method.
Aspose.Words list templates correspond to the 21 list templates available in the Bullets and Numbering dialog box in Microsoft Word 2003.
Example
Shows how to specify list level number when building a list using DocumentBuilder.
[C#]
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Create a numbered list based on one of the Microsoft Word list templates and
// apply it to the current paragraph in the document builder.
builder.ListFormat.List = doc.Lists.Add(ListTemplate.NumberArabicDot);
// There are 9 levels in this list, lets try them all.
for (int i = 0; i < 9; i++)
{
builder.ListFormat.ListLevelNumber = i;
builder.Writeln("Level " + i);
}
// Create a bulleted list based on one of the Microsoft Word list templates
// and apply it to the current paragraph in the document builder.
builder.ListFormat.List = doc.Lists.Add(ListTemplate.BulletDiamonds);
// There are 9 levels in this list, lets try them all.
for (int i = 0; i < 9; i++)
{
builder.ListFormat.ListLevelNumber = i;
builder.Writeln("Level " + i);
}
// This is a way to stop list formatting.
builder.ListFormat.List = null;
builder.Document.Save(MyDir + "Lists.SpecifyListLevel Out.doc");[Visual Basic]
Dim doc As Document = New Document()
Dim builder As DocumentBuilder = New DocumentBuilder(doc)
' Create a numbered list based on one of the Microsoft Word list templates and
' apply it to the current paragraph in the document builder.
builder.ListFormat.List = doc.Lists.Add(ListTemplate.NumberArabicDot)
' There are 9 levels in this list, lets try them all.
For i As Integer = 0 To 8
builder.ListFormat.ListLevelNumber = i
builder.Writeln("Level " & i)
Next i
' Create a bulleted list based on one of the Microsoft Word list templates
' and apply it to the current paragraph in the document builder.
builder.ListFormat.List = doc.Lists.Add(ListTemplate.BulletDiamonds)
' There are 9 levels in this list, lets try them all.
For i As Integer = 0 To 8
builder.ListFormat.ListLevelNumber = i
builder.Writeln("Level " & i)
Next i
' This is a way to stop list formatting.
builder.ListFormat.List = Nothing
builder.Document.Save(MyDir & "Lists.SpecifyListLevel Out.doc")Shows how to restart numbering in a list by copying a list.
[C#]
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Create a list based on a template.
List list1 = doc.Lists.Add(ListTemplate.NumberArabicParenthesis);
// Modify the formatting of the list.
list1.ListLevels[0].Font.Color = Color.Red;
list1.ListLevels[0].Alignment = ListLevelAlignment.Right;
builder.Writeln("List 1 starts below:");
// Use the first list in the document for a while.
builder.ListFormat.List = list1;
builder.Writeln("Item 1");
builder.Writeln("Item 2");
builder.ListFormat.RemoveNumbers();
// Now I want to reuse the first list, but need to restart numbering.
// This should be done by creating a copy of the original list formatting.
List list2 = doc.Lists.AddCopy(list1);
// We can modify the new list in any way. Including setting new start number.
list2.ListLevels[0].StartAt = 10;
// Use the second list in the document.
builder.Writeln("List 2 starts below:");
builder.ListFormat.List = list2;
builder.Writeln("Item 1");
builder.Writeln("Item 2");
builder.ListFormat.RemoveNumbers();
builder.Document.Save(MyDir + "Lists.RestartNumberingUsingListCopy Out.doc");[Visual Basic]
Dim doc As Document = New Document()
Dim builder As DocumentBuilder = New DocumentBuilder(doc)
' Create a list based on a template.
Dim list1 As List = doc.Lists.Add(ListTemplate.NumberArabicParenthesis)
' Modify the formatting of the list.
list1.ListLevels(0).Font.Color = Color.Red
list1.ListLevels(0).Alignment = ListLevelAlignment.Right
builder.Writeln("List 1 starts below:")
' Use the first list in the document for a while.
builder.ListFormat.List = list1
builder.Writeln("Item 1")
builder.Writeln("Item 2")
builder.ListFormat.RemoveNumbers()
' Now I want to reuse the first list, but need to restart numbering.
' This should be done by creating a copy of the original list formatting.
Dim list2 As List = doc.Lists.AddCopy(list1)
' We can modify the new list in any way. Including setting new start number.
list2.ListLevels(0).StartAt = 10
' Use the second list in the document.
builder.Writeln("List 2 starts below:")
builder.ListFormat.List = list2
builder.Writeln("Item 1")
builder.Writeln("Item 2")
builder.ListFormat.RemoveNumbers()
builder.Document.Save(MyDir & "Lists.RestartNumberingUsingListCopy Out.doc")Creates a sample document that excercises all outline headings list templates.
[C#]
public void OutlineHeadingTemplates()
{
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
List list = doc.Lists.Add(ListTemplate.OutlineHeadingsArticleSection);
AddOutlineHeadingParagraphs(builder, list, "Aspose.Words Outline 1");
list = doc.Lists.Add(ListTemplate.OutlineHeadingsLegal);
AddOutlineHeadingParagraphs(builder, list, "Aspose.Words Outline 2");
builder.InsertBreak(BreakType.PageBreak);
list = doc.Lists.Add(ListTemplate.OutlineHeadingsNumbers);
AddOutlineHeadingParagraphs(builder, list, "Aspose.Words Outline 3");
list = doc.Lists.Add(ListTemplate.OutlineHeadingsChapter);
AddOutlineHeadingParagraphs(builder, list, "Aspose.Words Outline 4");
builder.Document.Save(MyDir + "Lists.OutlineHeadingTemplates Out.doc");
}
private static void AddOutlineHeadingParagraphs(DocumentBuilder builder, List list, string title)
{
builder.ParagraphFormat.ClearFormatting();
builder.Writeln(title);
for (int i = 0; i < 9; i++)
{
builder.ListFormat.List = list;
builder.ListFormat.ListLevelNumber = i;
string styleName = "Heading " + (i + 1).ToString();
builder.ParagraphFormat.StyleName = styleName;
builder.Writeln(styleName);
}
builder.ListFormat.RemoveNumbers();
}[Visual Basic]
Public Sub OutlineHeadingTemplates()
Dim doc As Document = New Document()
Dim builder As DocumentBuilder = New DocumentBuilder(doc)
Dim list As List = doc.Lists.Add(ListTemplate.OutlineHeadingsArticleSection)
AddOutlineHeadingParagraphs(builder, list, "Aspose.Words Outline 1")
list = doc.Lists.Add(ListTemplate.OutlineHeadingsLegal)
AddOutlineHeadingParagraphs(builder, list, "Aspose.Words Outline 2")
builder.InsertBreak(BreakType.PageBreak)
list = doc.Lists.Add(ListTemplate.OutlineHeadingsNumbers)
AddOutlineHeadingParagraphs(builder, list, "Aspose.Words Outline 3")
list = doc.Lists.Add(ListTemplate.OutlineHeadingsChapter)
AddOutlineHeadingParagraphs(builder, list, "Aspose.Words Outline 4")
builder.Document.Save(MyDir & "Lists.OutlineHeadingTemplates Out.doc")
End Sub
Private Shared Sub AddOutlineHeadingParagraphs(ByVal builder As DocumentBuilder, ByVal list As List, ByVal title As String)
builder.ParagraphFormat.ClearFormatting()
builder.Writeln(title)
For i As Integer = 0 To 8
builder.ListFormat.List = list
builder.ListFormat.ListLevelNumber = i
Dim styleName As String = "Heading " & (i + 1).ToString()
builder.ParagraphFormat.StyleName = styleName
builder.Writeln(styleName)
Next i
builder.ListFormat.RemoveNumbers()
End SubMembers
| Member Name | Description | Value |
| BulletDefault |
Default bulleted list with 9 levels. Bullet of the first level is a disc, bullet of the second level is a circle, bullet of the third level is a square. Then formatting repeats for the remaining levels.
Each level is indented to the right by 0.25" relative to the previous level.
Corresponds to the 1st bulleted list template in the Bullets and Numbering dialog box in Microsoft Word.
| 0 |
| BulletDisk |
Same as BulletDefault.
Corresponds to the 1st bulleted list template in the Bullets and Numbering dialog box in Microsoft Word.
| 0 |
| BulletCircle |
The bullet of the first level is a circle. The remaining levels are same as in BulletDefault.
Corresponds to the 2nd bulleted list template in the Bullets and Numbering dialog box in Microsoft Word.
| 1 |
| BulletSquare |
The bullet of the first level is a square. The remaining levels are same as in BulletDefault.
Corresponds to the 3rd bulleted list template in the Bullets and Numbering dialog box in Microsoft Word.
| 2 |
| BulletDiamonds |
The bullet of the first level is a 4-diamond Wingding character. The remaining levels are same as in BulletDefault.
Corresponds to the 5th bulleted list template in the Bullets and Numbering dialog box in Microsoft Word.
| 3 |
| BulletArrowHead |
The bullet of the first level is an arrow head Wingding character. The remaining levels are same as in BulletDefault.
Corresponds to the 6th bulleted list template in the Bullets and Numbering dialog box in Microsoft Word.
| 4 |
| BulletTick |
The bullet of the first level is a tick Wingding character. The remaining levels are same as in BulletDefault.
Corresponds to the 7th bulleted list template in the Bullets and Numbering dialog box in Microsoft Word.
| 5 |
| NumberDefault |
Default numbered list with 9 levels. Arabic numbering (1., 2., 3., ...) for the first level, lowecase letter numbering (a., b., c., ...) for the second level, lowercase roman numbering (i., ii., iii., ...) for the third level. Then formatting repeats for the remaining levels.
Each level is indented to the right by 0.25" relative to the previous level.
Corresponds to the 1st numbered list template in the Bullets and Numbering dialog box in Microsoft Word.
| 6 |
| NumberArabicDot |
Same as NumberDefault.
Corresponds to the 1st numbered list template in the Bullets and Numbering dialog box in Microsoft Word.
| 6 |
| NumberArabicParenthesis |
The number of the first level is "1)". The remaining levels are same as in NumberDefault.
Corresponds to the 2nd numbered list template in the Bullets and Numbering dialog box in Microsoft Word.
| 7 |
| NumberUppercaseRomanDot |
The number of the first level is "I.". The remaining levels are same as in NumberDefault.
Corresponds to the 3rd numbered list template in the Bullets and Numbering dialog box in Microsoft Word.
| 8 |
| NumberUppercaseLetterDot |
The number of the first level is "A.". The remaining levels are same as in NumberDefault.
Corresponds to the 4th numbered list template in the Bullets and Numbering dialog box in Microsoft Word.
| 9 |
| NumberLowercaseLetterParenthesis |
The number of the first level is "a)". The remaining levels are same as in NumberDefault.
Corresponds to the 5th numbered list template in the Bullets and Numbering dialog box in Microsoft Word.
| 10 |
| NumberLowercaseLetterDot |
The number of the first level is "a.". The remaining levels are same as in NumberDefault.
Corresponds to the 6th numbered list template in the Bullets and Numbering dialog box in Microsoft Word.
| 11 |
| NumberLowercaseRomanDot |
The number of the first level is "i.". The remaining levels are same as in NumberDefault.
Corresponds to the 7th numbered list template in the Bullets and Numbering dialog box in Microsoft Word.
| 12 |
| OutlineNumbers |
An outline list with levels numbered "1), a), i), (1), (a), (i), 1., a., i.".
Corresponds to the 1st outline list template in the Bullets and Numbering dialog box in Microsoft Word.
| 13 |
| OutlineLegal |
An outline list with levels are numbered "1., 1.1., 1.1.1, ...".
Corresponds to the 2nd outline list template in the Bullets and Numbering dialog box in Microsoft Word.
| 14 |
| OutlineBullets |
An outline lists with various bullets for different levels.
Corresponds to the 3rd outline list template in the Bullets and Numbering dialog box in Microsoft Word.
| 15 |
| OutlineHeadingsArticleSection |
An outline list with levels linked to Heading styles.
Corresponds to the 4th outline list template in the Bullets and Numbering dialog box in Microsoft Word.
| 16 |
| OutlineHeadingsLegal |
An outline list with levels linked to Heading styles.
Corresponds to the 5th outline list template in the Bullets and Numbering dialog box in Microsoft Word.
| 17 |
| OutlineHeadingsNumbers |
An outline list with levels linked to Heading styles.
Corresponds to the 6th outline list template in the Bullets and Numbering dialog box in Microsoft Word.
| 18 |
| OutlineHeadingsChapter |
An outline list with levels linked to Heading styles.
Corresponds to the 7th outline list template in the Bullets and Numbering dialog box in Microsoft Word.
| 19 |
Requirements
Namespace: Aspose.Words.Lists
Assembly: Aspose.Words (in Aspose.Words.dll)
See Also
Aspose.Words.Lists Namespace