public class ListFormat
extends java.lang.Object
A paragraph in a Microsoft Word document can be bulleted or numbered. When a paragraph is bulleted or numbered, it is said that list formatting is applied to the paragraph.
You do not create objects of the ListFormat class directly. You access ListFormat as a property of another object that can have list formatting associated with it. At the moment the objects that can have list formatting are: Paragraph, Style and DocumentBuilder.
ListFormat of a Paragraph specifies what list formatting and list level is applied to that particular paragraph.
ListFormat of a Style (applicable to paragraph styles only) allows to specify what list formatting and list level is applied to all paragraphs of that particular style.
ListFormat of a DocumentBuilder provides access to the list formatting at the current cursor position inside the DocumentBuilder.
The list formatting itself is stored inside a List object that is stored separately from the paragraphs. The list objects are stored inside a ListCollection collection. There is a single ListCollection collection per Document.
The paragraphs do not physically belong to a list. The paragraphs just reference a particular list object via the getList() / setList(com.aspose.words.List) property and a particular level in the list via the getListLevelNumber() / setListLevelNumber(int) property. By setting these two properties you control what bullets and numbering is applied to a paragraph.
| Modifier and Type | Method and Description |
|---|---|
void |
applyBulletDefault()
Starts a new default bulleted list and applies it to the paragraph.
|
void |
applyNumberDefault()
Starts a new default numbered list and applies it to the paragraph.
|
List |
getList()
Gets the list this paragraph is a member of.
|
ListLevel |
getListLevel()
Returns the list level formatting plus any formatting overrides applied to the current paragraph.
|
int |
getListLevelNumber()
Gets the list level number (0 to 8) for the paragraph.
|
boolean |
isListItem()
True when the paragraph has bulleted or numbered formatting applied to it.
|
void |
listIndent()
Increases the list level of the current paragraph by one level.
|
void |
listOutdent()
Decreases the list level of the current paragraph by one level.
|
void |
removeNumbers()
Removes numbers or bullets from the current paragraph and sets list level to zero.
|
void |
setList(List value)
Sets the list this paragraph is a member of.
|
void |
setListLevelNumber(int value)
Sets the list level number (0 to 8) for the paragraph.
|
public void applyBulletDefault()
This is a shortcut method that creates a new list using the default bulleted template, applies it to the paragraph and selects the 1st list level.
public void applyNumberDefault()
This is a shortcut method that creates a new list using the default numbered template, applies it to the paragraph and selects the 1st list level.
public void removeNumbers()
Calling this method is equivalent to setting the getList() / setList(com.aspose.words.List) property to null.
public void listIndent()
throws java.lang.Exception
This method changes the list level and applies formatting properties of the new level.
In Word documents, lists may consist of up to nine levels. List formatting for each level specifies what bullet or number is used, left indent, space between the bullet and text etc.
java.lang.Exceptionpublic void listOutdent()
throws java.lang.Exception
This method changes the list level and applies formatting properties of the new level.
In Word documents, lists may consist of up to nine levels. List formatting for each level specifies what bullet or number is used, left indent, space between the bullet and text etc.
java.lang.Exceptionpublic int getListLevelNumber()
In Word documents, lists may consist of 1 or 9 levels, numbered 0 to 8.
Has effect only when the getList() / setList(com.aspose.words.List) property is set to reference a valid list.
getList(),
setList(com.aspose.words.List)public void setListLevelNumber(int value)
In Word documents, lists may consist of 1 or 9 levels, numbered 0 to 8.
Has effect only when the getList() / setList(com.aspose.words.List) property is set to reference a valid list.
value - The list level number (0 to 8) for the paragraph.getList(),
setList(com.aspose.words.List)public boolean isListItem()
boolean value.public List getList()
The list that is being assigned to this property must belong to the current document.
The list that is being assigned to this property must not be a list style definition.
Setting this property to null removes bullets and numbering from the paragraph and sets the list level number to zero. Setting this property to null is equivalent to calling removeNumbers().
getListLevelNumber(),
setListLevelNumber(int),
removeNumbers()public void setList(List value)
The list that is being assigned to this property must belong to the current document.
The list that is being assigned to this property must not be a list style definition.
Setting this property to null removes bullets and numbering from the paragraph and sets the list level number to zero. Setting this property to null is equivalent to calling removeNumbers().
value - The list this paragraph is a member of.getListLevelNumber(),
setListLevelNumber(int),
removeNumbers()public ListLevel getListLevel()