public class ListTemplate
extends java.lang.Object
Remarks:
A list template value is used as a parameter into the M:Aspose.Words.Lists.ListCollection.Add(Aspose.Words.Lists.ListTemplate) method.
Aspose.Words list templates correspond to the 21 list templates available in the Bullets and Numbering dialog box in Microsoft Word 2003.
Examples:
Shows how to create a document that contains all outline headings list templates.
public void outlineHeadingTemplates() throws Exception {
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
List docList = doc.getLists().add(ListTemplate.OUTLINE_HEADINGS_ARTICLE_SECTION);
addOutlineHeadingParagraphs(builder, docList, "Aspose.Words Outline - \"Article Section\"");
docList = doc.getLists().add(ListTemplate.OUTLINE_HEADINGS_LEGAL);
addOutlineHeadingParagraphs(builder, docList, "Aspose.Words Outline - \"Legal\"");
builder.insertBreak(BreakType.PAGE_BREAK);
docList = doc.getLists().add(ListTemplate.OUTLINE_HEADINGS_NUMBERS);
addOutlineHeadingParagraphs(builder, docList, "Aspose.Words Outline - \"Numbers\"");
docList = doc.getLists().add(ListTemplate.OUTLINE_HEADINGS_CHAPTER);
addOutlineHeadingParagraphs(builder, docList, "Aspose.Words Outline - \"Chapters\"");
doc.save(getArtifactsDir() + "Lists.OutlineHeadingTemplates.docx");
}
private static void addOutlineHeadingParagraphs(final DocumentBuilder builder, final List docList, final String title) {
builder.getParagraphFormat().clearFormatting();
builder.writeln(title);
for (int i = 0; i < 9; i++) {
builder.getListFormat().setList(docList);
builder.getListFormat().setListLevelNumber(i);
String styleName = "Heading " + (i + 1);
builder.getParagraphFormat().setStyleName(styleName);
builder.writeln(styleName);
}
builder.getListFormat().removeNumbers();
}
Shows how to restart numbering in a list by copying a list.
Document doc = new Document();
// A list allows us to organize and decorate sets of paragraphs with prefix symbols and indents.
// We can create nested lists by increasing the indent level.
// We can begin and end a list by using a document builder's "ListFormat" property.
// Each paragraph that we add between a list's start and the end will become an item in the list.
// Create a list from a Microsoft Word template, and customize its first list level.
List list1 = doc.getLists().add(ListTemplate.NUMBER_ARABIC_PARENTHESIS);
list1.getListLevels().get(0).getFont().setColor(Color.RED);
list1.getListLevels().get(0).setAlignment(ListLevelAlignment.RIGHT);
// Apply our list to some paragraphs.
DocumentBuilder builder = new DocumentBuilder(doc);
builder.writeln("List 1 starts below:");
builder.getListFormat().setList(list1);
builder.writeln("Item 1");
builder.writeln("Item 2");
builder.getListFormat().removeNumbers();
// We can add a copy of an existing list to the document's list collection
// to create a similar list without making changes to the original.
List list2 = doc.getLists().addCopy(list1);
list2.getListLevels().get(0).getFont().setColor(Color.BLUE);
list2.getListLevels().get(0).setStartAt(10);
// Apply the second list to new paragraphs.
builder.writeln("List 2 starts below:");
builder.getListFormat().setList(list2);
builder.writeln("Item 1");
builder.writeln("Item 2");
builder.getListFormat().removeNumbers();
doc.save(getArtifactsDir() + "Lists.RestartNumberingUsingListCopy.docx");
Shows how to work with list levels.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Assert.assertFalse(builder.getListFormat().isListItem());
// A list allows us to organize and decorate sets of paragraphs with prefix symbols and indents.
// We can create nested lists by increasing the indent level.
// We can begin and end a list by using a document builder's "ListFormat" property.
// Each paragraph that we add between a list's start and the end will become an item in the list.
// Below are two types of lists that we can create using a document builder.
// 1 - A numbered list:
// Numbered lists create a logical order for their paragraphs by numbering each item.
builder.getListFormat().setList(doc.getLists().add(ListTemplate.NUMBER_DEFAULT));
Assert.assertTrue(builder.getListFormat().isListItem());
// By setting the "ListLevelNumber" property, we can increase the list level
// to begin a self-contained sub-list at the current list item.
// The Microsoft Word list template called "NumberDefault" uses numbers to create list levels for the first list level.
// Deeper list levels use letters and lowercase Roman numerals.
for (int i = 0; i < 9; i++) {
builder.getListFormat().setListLevelNumber(i);
builder.writeln("Level " + i);
}
// 2 - A bulleted list:
// This list will apply an indent and a bullet symbol ("•") before each paragraph.
// Deeper levels of this list will use different symbols, such as "■" and "○".
builder.getListFormat().setList(doc.getLists().add(ListTemplate.BULLET_DEFAULT));
for (int i = 0; i < 9; i++) {
builder.getListFormat().setListLevelNumber(i);
builder.writeln("Level " + i);
}
// We can disable list formatting to not format any subsequent paragraphs as lists by un-setting the "List" flag.
builder.getListFormat().setList(null);
Assert.assertFalse(builder.getListFormat().isListItem());
doc.save(getArtifactsDir() + "Lists.SpecifyListLevel.docx");
| Modifier and Type | Field and Description |
|---|---|
static int |
BULLET_ARROW_HEAD
The bullet of the first level is an arrow head Wingding character.
|
static int |
BULLET_CIRCLE
The bullet of the first level is a circle.
|
static int |
BULLET_DEFAULT
Default bulleted list with 9 levels.
|
static int |
BULLET_DIAMONDS
The bullet of the first level is a 4-diamond Wingding character.
|
static int |
BULLET_DISK
Same as
BULLET_DEFAULT. |
static int |
BULLET_SQUARE
The bullet of the first level is a square.
|
static int |
BULLET_TICK
The bullet of the first level is a tick Wingding character.
|
static int |
length |
static int |
NUMBER_ARABIC_DOT
Same as
NUMBER_DEFAULT. |
static int |
NUMBER_ARABIC_PARENTHESIS
The number of the first level is "1)".
|
static int |
NUMBER_DEFAULT
Default numbered list with 9 levels.
|
static int |
NUMBER_LOWERCASE_LETTER_DOT
The number of the first level is "a.".
|
static int |
NUMBER_LOWERCASE_LETTER_PARENTHESIS
The number of the first level is "a)".
|
static int |
NUMBER_LOWERCASE_ROMAN_DOT
The number of the first level is "i.".
|
static int |
NUMBER_UPPERCASE_LETTER_DOT
The number of the first level is "A.".
|
static int |
NUMBER_UPPERCASE_ROMAN_DOT
The number of the first level is "I.".
|
static int |
OUTLINE_BULLETS
An outline lists with various bullets for different levels.
|
static int |
OUTLINE_HEADINGS_ARTICLE_SECTION
An outline list with levels linked to Heading styles.
|
static int |
OUTLINE_HEADINGS_CHAPTER
An outline list with levels linked to Heading styles.
|
static int |
OUTLINE_HEADINGS_LEGAL
An outline list with levels linked to Heading styles.
|
static int |
OUTLINE_HEADINGS_NUMBERS
An outline list with levels linked to Heading styles.
|
static int |
OUTLINE_LEGAL
An outline list with levels are numbered "1., 1.1., 1.1.1, ...".
|
static int |
OUTLINE_NUMBERS
An outline list with levels numbered "1), a), i), (1), (a), (i), 1., a., i.".
|
| Modifier and Type | Method and Description |
|---|---|
static int |
fromName(java.lang.String listTemplateName) |
static java.lang.String |
getName(int listTemplate) |
static int[] |
getValues() |
static java.lang.String |
toString(int listTemplate) |
public static int BULLET_DEFAULT
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.
public static int BULLET_DISK
Same as BULLET_DEFAULT.
Corresponds to the 1st bulleted list template in the Bullets and Numbering dialog box in Microsoft Word.
public static int BULLET_CIRCLE
The bullet of the first level is a circle. The remaining levels are same as in BULLET_DEFAULT.
Corresponds to the 2nd bulleted list template in the Bullets and Numbering dialog box in Microsoft Word.
public static int BULLET_SQUARE
The bullet of the first level is a square. The remaining levels are same as in BULLET_DEFAULT.
Corresponds to the 3rd bulleted list template in the Bullets and Numbering dialog box in Microsoft Word.
public static int BULLET_DIAMONDS
The bullet of the first level is a 4-diamond Wingding character. The remaining levels are same as in BULLET_DEFAULT.
Corresponds to the 5th bulleted list template in the Bullets and Numbering dialog box in Microsoft Word.
public static int BULLET_ARROW_HEAD
The bullet of the first level is an arrow head Wingding character. The remaining levels are same as in BULLET_DEFAULT.
Corresponds to the 6th bulleted list template in the Bullets and Numbering dialog box in Microsoft Word.
public static int BULLET_TICK
The bullet of the first level is a tick Wingding character. The remaining levels are same as in BULLET_DEFAULT.
Corresponds to the 7th bulleted list template in the Bullets and Numbering dialog box in Microsoft Word.
public static int NUMBER_DEFAULT
Default numbered list with 9 levels. Arabic numbering (1., 2., 3., ...) for the first level, lowercase 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.
public static int NUMBER_ARABIC_DOT
Same as NUMBER_DEFAULT.
Corresponds to the 1st numbered list template in the Bullets and Numbering dialog box in Microsoft Word.
public static int NUMBER_ARABIC_PARENTHESIS
The number of the first level is "1)". The remaining levels are same as in NUMBER_DEFAULT.
Corresponds to the 2nd numbered list template in the Bullets and Numbering dialog box in Microsoft Word.
public static int NUMBER_UPPERCASE_ROMAN_DOT
The number of the first level is "I.". The remaining levels are same as in NUMBER_DEFAULT.
Corresponds to the 3rd numbered list template in the Bullets and Numbering dialog box in Microsoft Word.
public static int NUMBER_UPPERCASE_LETTER_DOT
The number of the first level is "A.". The remaining levels are same as in NUMBER_DEFAULT.
Corresponds to the 4th numbered list template in the Bullets and Numbering dialog box in Microsoft Word.
public static int NUMBER_LOWERCASE_LETTER_PARENTHESIS
The number of the first level is "a)". The remaining levels are same as in NUMBER_DEFAULT.
Corresponds to the 5th numbered list template in the Bullets and Numbering dialog box in Microsoft Word.
public static int NUMBER_LOWERCASE_LETTER_DOT
The number of the first level is "a.". The remaining levels are same as in NUMBER_DEFAULT.
Corresponds to the 6th numbered list template in the Bullets and Numbering dialog box in Microsoft Word.
public static int NUMBER_LOWERCASE_ROMAN_DOT
The number of the first level is "i.". The remaining levels are same as in NUMBER_DEFAULT.
Corresponds to the 7th numbered list template in the Bullets and Numbering dialog box in Microsoft Word.
public static int OUTLINE_NUMBERS
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.
public static int OUTLINE_LEGAL
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.
public static int OUTLINE_BULLETS
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.
public static int OUTLINE_HEADINGS_ARTICLE_SECTION
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.
public static int OUTLINE_HEADINGS_LEGAL
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.
public static int OUTLINE_HEADINGS_NUMBERS
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.
public static int OUTLINE_HEADINGS_CHAPTER
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.
public static int length