public class ListTemplate
A list template value is used as a parameter into the
Aspose.Words list templates correspond to the 21 list templates available
in the Bullets and Numbering dialog box in Microsoft Word 2003. Example: Example: Example:
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.getListFormat().setList(doc.getLists().add(ListTemplate.NUMBER_ARABIC_DOT));
// Insert text at each of the 9 indent levels
for (int i = 0; i < 9; i++) {
builder.getListFormat().setListLevelNumber(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.getListFormat().setList(doc.getLists().add(ListTemplate.BULLET_DIAMONDS));
for (int i = 0; i < 9; i++) {
builder.getListFormat().setListLevelNumber(i);
builder.writeln("Level " + i);
}
// This is a way to stop list formatting
builder.getListFormat().setList(null);
doc.save(getArtifactsDir() + "Lists.SpecifyListLevel.docx");
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Create a list based on a template
List list1 = doc.getLists().add(ListTemplate.NUMBER_ARABIC_PARENTHESIS);
// Modify the formatting of the list
list1.getListLevels().get(0).getFont().setColor(Color.RED);
list1.getListLevels().get(0).setAlignment(ListLevelAlignment.RIGHT);
builder.writeln("List 1 starts below:");
// Use the first list in the document for a while
builder.getListFormat().setList(list1);
builder.writeln("Item 1");
builder.writeln("Item 2");
builder.getListFormat().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.getLists().addCopy(list1);
// We can modify the new list in any way. Including setting new start number
list2.getListLevels().get(0).setStartAt(10);
// Use the second list in the document
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");
public void outlineHeadingTemplates() throws Exception {
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
List list = doc.getLists().add(ListTemplate.OUTLINE_HEADINGS_ARTICLE_SECTION);
addOutlineHeadingParagraphs(builder, list, "Aspose.Words Outline - \"Article Section\"");
list = doc.getLists().add(ListTemplate.OUTLINE_HEADINGS_LEGAL);
addOutlineHeadingParagraphs(builder, list, "Aspose.Words Outline - \"Legal\"");
builder.insertBreak(BreakType.PAGE_BREAK);
list = doc.getLists().add(ListTemplate.OUTLINE_HEADINGS_NUMBERS);
addOutlineHeadingParagraphs(builder, list, "Aspose.Words Outline - \"Numbers\"");
list = doc.getLists().add(ListTemplate.OUTLINE_HEADINGS_CHAPTER);
addOutlineHeadingParagraphs(builder, list, "Aspose.Words Outline - \"Chapters\"");
doc.save(getArtifactsDir() + "Lists.OutlineHeadingTemplates.docx");
}
private static void addOutlineHeadingParagraphs(final DocumentBuilder builder, final List list, final String title) {
builder.getParagraphFormat().clearFormatting();
builder.writeln(title);
for (int i = 0; i < 9; i++) {
builder.getListFormat().setList(list);
builder.getListFormat().setListLevelNumber(i);
String styleName = "Heading " + Integer.toString((i + 1));
builder.getParagraphFormat().setStyleName(styleName);
builder.writeln(styleName);
}
builder.getListFormat().removeNumbers();
}
Field Summary | ||
---|---|---|
static final 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. |
||
static final int | BULLET_DISK | |
Same as BulletDefault. Corresponds to the 1st bulleted list template in the Bullets and Numbering dialog box in Microsoft Word. |
||
static final int | BULLET_CIRCLE | |
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. |
||
static final int | BULLET_SQUARE | |
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. |
||
static final int | BULLET_DIAMONDS | |
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. |
||
static final int | BULLET_ARROW_HEAD | |
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. |
||
static final int | BULLET_TICK | |
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. |
||
static final int | NUMBER_DEFAULT | |
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. |
||
static final int | NUMBER_ARABIC_DOT | |
Same as NumberDefault. Corresponds to the 1st numbered list template in the Bullets and Numbering dialog box in Microsoft Word. |
||
static final int | NUMBER_ARABIC_PARENTHESIS | |
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. |
||
static final int | NUMBER_UPPERCASE_ROMAN_DOT | |
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. |
||
static final int | NUMBER_UPPERCASE_LETTER_DOT | |
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. |
||
static final int | NUMBER_LOWERCASE_LETTER_PARENTHESIS | |
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. |
||
static final int | NUMBER_LOWERCASE_LETTER_DOT | |
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. |
||
static final int | NUMBER_LOWERCASE_ROMAN_DOT | |
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. |
||
static final 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. |
||
static final 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. |
||
static final 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. |
||
static final 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. |
||
static final 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. |
||
static final 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. |
||
static final 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 final 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 final int BULLET_DISK
Same as BulletDefault.
Corresponds to the 1st bulleted list template in the Bullets and Numbering dialog box in Microsoft Word.
public static final int BULLET_CIRCLE
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.
public static final int BULLET_SQUARE
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.
public static final int BULLET_DIAMONDS
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.
public static final int BULLET_ARROW_HEAD
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.
public static final int BULLET_TICK
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.
public static final int NUMBER_DEFAULT
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.
public static final int NUMBER_ARABIC_DOT
Same as NumberDefault.
Corresponds to the 1st numbered list template in the Bullets and Numbering dialog box in Microsoft Word.
public static final int NUMBER_ARABIC_PARENTHESIS
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.
public static final int NUMBER_UPPERCASE_ROMAN_DOT
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.
public static final int NUMBER_UPPERCASE_LETTER_DOT
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.
public static final int NUMBER_LOWERCASE_LETTER_PARENTHESIS
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.
public static final int NUMBER_LOWERCASE_LETTER_DOT
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.
public static final int NUMBER_LOWERCASE_ROMAN_DOT
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.
public static final 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 final 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 final 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 final 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 final 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 final 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 final 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.