com.aspose.words

Class ListFormat

  • java.lang.Object
    • com.aspose.words.ListFormat
public class ListFormat 
extends java.lang.Object

Allows to control what list formatting is applied to a paragraph.

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 List property and a particular level in the list via the ListLevelNumber property. By setting these two properties you control what bullets and numbering is applied to a paragraph.

Example:

Shows how to specify list level number when building a list using DocumentBuilder.
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");

Property Getters/Setters Summary
booleanisListItem()
True when the paragraph has bulleted or numbered formatting applied to it.
ListgetList()
void
setList(List value)
           Gets or sets the list this paragraph is a member of.
ListLevelgetListLevel()
Returns the list level formatting plus any formatting overrides applied to the current paragraph.
intgetListLevelNumber()
void
           Gets or sets the list level number (0 to 8) for the paragraph.
 
Method Summary
voidapplyBulletDefault()
Starts a new default bulleted list and applies it to the paragraph.
voidapplyNumberDefault()
Starts a new default numbered list and applies it to the paragraph.
voidlistIndent()
Increases the list level of the current paragraph by one level.
voidlistOutdent()
Decreases the list level of the current paragraph by one level.
voidremoveNumbers()
Removes numbers or bullets from the current paragraph and sets list level to zero.
 

    • Property Getters/Setters Detail

      • isListItem

        public boolean isListItem()
        
        True when the paragraph has bulleted or numbered formatting applied to it.

        Example:

        Shows how to output all paragraphs in a document that are bulleted or numbered.
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        
        builder.getListFormat().applyNumberDefault();
        builder.writeln("Numbered list item 1");
        builder.writeln("Numbered list item 2");
        builder.writeln("Numbered list item 3");
        builder.getListFormat().removeNumbers();
        
        builder.getListFormat().applyBulletDefault();
        builder.writeln("Bulleted list item 1");
        builder.writeln("Bulleted list item 2");
        builder.writeln("Bulleted list item 3");
        builder.getListFormat().removeNumbers();
        
        NodeCollection paras = doc.getChildNodes(NodeType.PARAGRAPH, true);
        for (Paragraph para : (Iterable<Paragraph>) paras) {
            if (para.getListFormat().isListItem()) {
                System.out.println(java.text.MessageFormat.format("*** A paragraph belongs to list {0}", para.getListFormat().getList().getListId()));
                System.out.println(para.getText());
            }
        }
      • getList/setList

        public List getList() / public void setList(List value)
        
        Gets or sets the list this paragraph is a member of.

        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().

        Example:

        Shows how to specify list level number when building a list using DocumentBuilder.
        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");

        Example:

        Shows how to start a numbered list, add a bulleted list inside it, then return to the numbered list.
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        
        // Create an outline list for the headings
        List outlineList = doc.getLists().add(ListTemplate.OUTLINE_NUMBERS);
        builder.getListFormat().setList(outlineList);
        builder.getParagraphFormat().setStyleIdentifier(StyleIdentifier.HEADING_1);
        builder.writeln("This is my Chapter 1");
        
        // Create a numbered list
        List numberedList = doc.getLists().add(ListTemplate.NUMBER_DEFAULT);
        builder.getListFormat().setList(numberedList);
        builder.getParagraphFormat().setStyleIdentifier(StyleIdentifier.NORMAL);
        builder.writeln("Numbered list item 1.");
        
        // Every paragraph that comprises a list will have this flag
        Assert.assertTrue(builder.getCurrentParagraph().isListItem());
        Assert.assertTrue(builder.getParagraphFormat().isListItem());
        
        // Create a bulleted list
        List bulletedList = doc.getLists().add(ListTemplate.BULLET_DEFAULT);
        builder.getListFormat().setList(bulletedList);
        builder.getParagraphFormat().setLeftIndent(72.0);
        builder.writeln("Bulleted list item 1.");
        builder.writeln("Bulleted list item 2.");
        builder.getParagraphFormat().clearFormatting();
        
        // Revert to the numbered list
        builder.getListFormat().setList(numberedList);
        builder.writeln("Numbered list item 2.");
        builder.writeln("Numbered list item 3.");
        
        // Revert to the outline list
        builder.getListFormat().setList(outlineList);
        builder.getParagraphFormat().setStyleIdentifier(StyleIdentifier.HEADING_1);
        builder.writeln("This is my Chapter 2");
        
        builder.getParagraphFormat().clearFormatting();
        
        builder.getDocument().save(getArtifactsDir() + "Lists.NestedLists.docx");
        See Also:
        ListLevelNumber, removeNumbers()
      • getListLevel

        public ListLevel getListLevel()
        
        Returns the list level formatting plus any formatting overrides applied to the current paragraph.

        Example:

        Shows how to apply custom list formatting to paragraphs when using DocumentBuilder.
        Document doc = new Document();
        
        // Create a list based on one of the Microsoft Word list templates
        List list = doc.getLists().add(ListTemplate.NUMBER_DEFAULT);
        
        // Completely customize one list level
        ListLevel listLevel = list.getListLevels().get(0);
        listLevel.getFont().setColor(Color.RED);
        listLevel.getFont().setSize(24.0);
        listLevel.setNumberStyle(NumberStyle.ORDINAL_TEXT);
        listLevel.setStartAt(21);
        listLevel.setNumberFormat("\u0000");
        
        listLevel.setNumberPosition(-36);
        listLevel.setTextPosition(144.0);
        listLevel.setTabPosition(144.0);
        
        // Customize another list level
        listLevel = list.getListLevels().get(1);
        listLevel.setAlignment(ListLevelAlignment.RIGHT);
        listLevel.setNumberStyle(NumberStyle.BULLET);
        listLevel.getFont().setName("Wingdings");
        listLevel.getFont().setColor(Color.BLUE);
        listLevel.getFont().setSize(24.0);
        listLevel.setNumberFormat("\uf0af"); // A bullet that looks like a star
        listLevel.setTrailingCharacter(ListTrailingCharacter.SPACE);
        listLevel.setNumberPosition(144.0);
        
        // Now add some text that uses the list that we created
        // It does not matter when to customize the list - before or after adding the paragraphs
        DocumentBuilder builder = new DocumentBuilder(doc);
        
        builder.getListFormat().setList(list);
        builder.writeln("The quick brown fox...");
        builder.writeln("The quick brown fox...");
        
        builder.getListFormat().listIndent();
        builder.writeln("jumped over the lazy dog.");
        builder.writeln("jumped over the lazy dog.");
        
        builder.getListFormat().listOutdent();
        builder.writeln("The quick brown fox...");
        
        builder.getListFormat().removeNumbers();
        
        builder.getDocument().save(getArtifactsDir() + "Lists.CreateCustomList.docx");
      • getListLevelNumber/setListLevelNumber

        public int getListLevelNumber() / public void setListLevelNumber(int value)
        
        Gets or sets the list level number (0 to 8) for the paragraph.

        In Word documents, lists may consist of 1 or 9 levels, numbered 0 to 8.

        Has effect only when the List property is set to reference a valid list.

        Example:

        Shows how to specify list level number when building a list using DocumentBuilder.
        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");

        Example:

        Shows how to apply default bulleted or numbered list formatting to paragraphs when using DocumentBuilder.
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        
        builder.writeln("Aspose.Words allows:");
        builder.writeln();
        
        // Start a numbered list with default formatting
        builder.getListFormat().applyNumberDefault();
        builder.writeln("Opening documents from different formats:");
        
        Assert.assertEquals(0, builder.getListFormat().getListLevelNumber());
        
        // Go to second list level, add more text
        builder.getListFormat().listIndent();
        
        Assert.assertEquals(1, builder.getListFormat().getListLevelNumber());
        
        builder.writeln("DOC");
        builder.writeln("PDF");
        builder.writeln("HTML");
        
        // Outdent to the first list level
        builder.getListFormat().listOutdent();
        
        Assert.assertEquals(0, builder.getListFormat().getListLevelNumber());
        
        builder.writeln("Processing documents");
        builder.writeln("Saving documents in different formats:");
        
        // Indent the list level again
        builder.getListFormat().listIndent();
        builder.writeln("DOC");
        builder.writeln("PDF");
        builder.writeln("HTML");
        builder.writeln("MHTML");
        builder.writeln("Plain text");
        
        // Outdent the list level again
        builder.getListFormat().listOutdent();
        builder.writeln("Doing many other things!");
        
        // End the numbered list
        builder.getListFormat().removeNumbers();
        builder.writeln();
        
        builder.writeln("Aspose.Words main advantages are:");
        builder.writeln();
        
        // Start a bulleted list with default formatting
        builder.getListFormat().applyBulletDefault();
        builder.writeln("Great performance");
        builder.writeln("High reliability");
        builder.writeln("Quality code and working");
        builder.writeln("Wide variety of features");
        builder.writeln("Easy to understand API");
        
        // End the bulleted list
        builder.getListFormat().removeNumbers();
        
        doc.save(getArtifactsDir() + "Lists.ApplyDefaultBulletsAndNumbers.docx");
        See Also:
        List
    • Method Detail

      • applyBulletDefault

        public void applyBulletDefault()
        Starts a new default bulleted list and applies it to the paragraph.

        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.

        See Also:
        List, removeNumbers(), ListLevelNumber

        Example:

        Shows how to apply default bulleted or numbered list formatting to paragraphs when using DocumentBuilder.
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        
        builder.writeln("Aspose.Words allows:");
        builder.writeln();
        
        // Start a numbered list with default formatting
        builder.getListFormat().applyNumberDefault();
        builder.writeln("Opening documents from different formats:");
        
        Assert.assertEquals(0, builder.getListFormat().getListLevelNumber());
        
        // Go to second list level, add more text
        builder.getListFormat().listIndent();
        
        Assert.assertEquals(1, builder.getListFormat().getListLevelNumber());
        
        builder.writeln("DOC");
        builder.writeln("PDF");
        builder.writeln("HTML");
        
        // Outdent to the first list level
        builder.getListFormat().listOutdent();
        
        Assert.assertEquals(0, builder.getListFormat().getListLevelNumber());
        
        builder.writeln("Processing documents");
        builder.writeln("Saving documents in different formats:");
        
        // Indent the list level again
        builder.getListFormat().listIndent();
        builder.writeln("DOC");
        builder.writeln("PDF");
        builder.writeln("HTML");
        builder.writeln("MHTML");
        builder.writeln("Plain text");
        
        // Outdent the list level again
        builder.getListFormat().listOutdent();
        builder.writeln("Doing many other things!");
        
        // End the numbered list
        builder.getListFormat().removeNumbers();
        builder.writeln();
        
        builder.writeln("Aspose.Words main advantages are:");
        builder.writeln();
        
        // Start a bulleted list with default formatting
        builder.getListFormat().applyBulletDefault();
        builder.writeln("Great performance");
        builder.writeln("High reliability");
        builder.writeln("Quality code and working");
        builder.writeln("Wide variety of features");
        builder.writeln("Easy to understand API");
        
        // End the bulleted list
        builder.getListFormat().removeNumbers();
        
        doc.save(getArtifactsDir() + "Lists.ApplyDefaultBulletsAndNumbers.docx");
      • applyNumberDefault

        public void applyNumberDefault()
        Starts a new default numbered list and applies it to the paragraph.

        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.

        See Also:
        List, removeNumbers(), ListLevelNumber

        Example:

        Shows how to apply default bulleted or numbered list formatting to paragraphs when using DocumentBuilder.
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        
        builder.writeln("Aspose.Words allows:");
        builder.writeln();
        
        // Start a numbered list with default formatting
        builder.getListFormat().applyNumberDefault();
        builder.writeln("Opening documents from different formats:");
        
        Assert.assertEquals(0, builder.getListFormat().getListLevelNumber());
        
        // Go to second list level, add more text
        builder.getListFormat().listIndent();
        
        Assert.assertEquals(1, builder.getListFormat().getListLevelNumber());
        
        builder.writeln("DOC");
        builder.writeln("PDF");
        builder.writeln("HTML");
        
        // Outdent to the first list level
        builder.getListFormat().listOutdent();
        
        Assert.assertEquals(0, builder.getListFormat().getListLevelNumber());
        
        builder.writeln("Processing documents");
        builder.writeln("Saving documents in different formats:");
        
        // Indent the list level again
        builder.getListFormat().listIndent();
        builder.writeln("DOC");
        builder.writeln("PDF");
        builder.writeln("HTML");
        builder.writeln("MHTML");
        builder.writeln("Plain text");
        
        // Outdent the list level again
        builder.getListFormat().listOutdent();
        builder.writeln("Doing many other things!");
        
        // End the numbered list
        builder.getListFormat().removeNumbers();
        builder.writeln();
        
        builder.writeln("Aspose.Words main advantages are:");
        builder.writeln();
        
        // Start a bulleted list with default formatting
        builder.getListFormat().applyBulletDefault();
        builder.writeln("Great performance");
        builder.writeln("High reliability");
        builder.writeln("Quality code and working");
        builder.writeln("Wide variety of features");
        builder.writeln("Easy to understand API");
        
        // End the bulleted list
        builder.getListFormat().removeNumbers();
        
        doc.save(getArtifactsDir() + "Lists.ApplyDefaultBulletsAndNumbers.docx");
      • listIndent

        public void listIndent()
                       throws java.lang.Exception
        Increases the list level of the current paragraph by one level.

        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.

        Example:

        Shows how to apply default bulleted or numbered list formatting to paragraphs when using DocumentBuilder.
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        
        builder.writeln("Aspose.Words allows:");
        builder.writeln();
        
        // Start a numbered list with default formatting
        builder.getListFormat().applyNumberDefault();
        builder.writeln("Opening documents from different formats:");
        
        Assert.assertEquals(0, builder.getListFormat().getListLevelNumber());
        
        // Go to second list level, add more text
        builder.getListFormat().listIndent();
        
        Assert.assertEquals(1, builder.getListFormat().getListLevelNumber());
        
        builder.writeln("DOC");
        builder.writeln("PDF");
        builder.writeln("HTML");
        
        // Outdent to the first list level
        builder.getListFormat().listOutdent();
        
        Assert.assertEquals(0, builder.getListFormat().getListLevelNumber());
        
        builder.writeln("Processing documents");
        builder.writeln("Saving documents in different formats:");
        
        // Indent the list level again
        builder.getListFormat().listIndent();
        builder.writeln("DOC");
        builder.writeln("PDF");
        builder.writeln("HTML");
        builder.writeln("MHTML");
        builder.writeln("Plain text");
        
        // Outdent the list level again
        builder.getListFormat().listOutdent();
        builder.writeln("Doing many other things!");
        
        // End the numbered list
        builder.getListFormat().removeNumbers();
        builder.writeln();
        
        builder.writeln("Aspose.Words main advantages are:");
        builder.writeln();
        
        // Start a bulleted list with default formatting
        builder.getListFormat().applyBulletDefault();
        builder.writeln("Great performance");
        builder.writeln("High reliability");
        builder.writeln("Quality code and working");
        builder.writeln("Wide variety of features");
        builder.writeln("Easy to understand API");
        
        // End the bulleted list
        builder.getListFormat().removeNumbers();
        
        doc.save(getArtifactsDir() + "Lists.ApplyDefaultBulletsAndNumbers.docx");
      • listOutdent

        public void listOutdent()
                        throws java.lang.Exception
        Decreases the list level of the current paragraph by one level.

        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.

        Example:

        Shows how to apply default bulleted or numbered list formatting to paragraphs when using DocumentBuilder.
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        
        builder.writeln("Aspose.Words allows:");
        builder.writeln();
        
        // Start a numbered list with default formatting
        builder.getListFormat().applyNumberDefault();
        builder.writeln("Opening documents from different formats:");
        
        Assert.assertEquals(0, builder.getListFormat().getListLevelNumber());
        
        // Go to second list level, add more text
        builder.getListFormat().listIndent();
        
        Assert.assertEquals(1, builder.getListFormat().getListLevelNumber());
        
        builder.writeln("DOC");
        builder.writeln("PDF");
        builder.writeln("HTML");
        
        // Outdent to the first list level
        builder.getListFormat().listOutdent();
        
        Assert.assertEquals(0, builder.getListFormat().getListLevelNumber());
        
        builder.writeln("Processing documents");
        builder.writeln("Saving documents in different formats:");
        
        // Indent the list level again
        builder.getListFormat().listIndent();
        builder.writeln("DOC");
        builder.writeln("PDF");
        builder.writeln("HTML");
        builder.writeln("MHTML");
        builder.writeln("Plain text");
        
        // Outdent the list level again
        builder.getListFormat().listOutdent();
        builder.writeln("Doing many other things!");
        
        // End the numbered list
        builder.getListFormat().removeNumbers();
        builder.writeln();
        
        builder.writeln("Aspose.Words main advantages are:");
        builder.writeln();
        
        // Start a bulleted list with default formatting
        builder.getListFormat().applyBulletDefault();
        builder.writeln("Great performance");
        builder.writeln("High reliability");
        builder.writeln("Quality code and working");
        builder.writeln("Wide variety of features");
        builder.writeln("Easy to understand API");
        
        // End the bulleted list
        builder.getListFormat().removeNumbers();
        
        doc.save(getArtifactsDir() + "Lists.ApplyDefaultBulletsAndNumbers.docx");
      • removeNumbers

        public void removeNumbers()
        Removes numbers or bullets from the current paragraph and sets list level to zero.

        Calling this method is equivalent to setting the List property to null.

        Example:

        Shows how to apply default bulleted or numbered list formatting to paragraphs when using DocumentBuilder.
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        
        builder.writeln("Aspose.Words allows:");
        builder.writeln();
        
        // Start a numbered list with default formatting
        builder.getListFormat().applyNumberDefault();
        builder.writeln("Opening documents from different formats:");
        
        Assert.assertEquals(0, builder.getListFormat().getListLevelNumber());
        
        // Go to second list level, add more text
        builder.getListFormat().listIndent();
        
        Assert.assertEquals(1, builder.getListFormat().getListLevelNumber());
        
        builder.writeln("DOC");
        builder.writeln("PDF");
        builder.writeln("HTML");
        
        // Outdent to the first list level
        builder.getListFormat().listOutdent();
        
        Assert.assertEquals(0, builder.getListFormat().getListLevelNumber());
        
        builder.writeln("Processing documents");
        builder.writeln("Saving documents in different formats:");
        
        // Indent the list level again
        builder.getListFormat().listIndent();
        builder.writeln("DOC");
        builder.writeln("PDF");
        builder.writeln("HTML");
        builder.writeln("MHTML");
        builder.writeln("Plain text");
        
        // Outdent the list level again
        builder.getListFormat().listOutdent();
        builder.writeln("Doing many other things!");
        
        // End the numbered list
        builder.getListFormat().removeNumbers();
        builder.writeln();
        
        builder.writeln("Aspose.Words main advantages are:");
        builder.writeln();
        
        // Start a bulleted list with default formatting
        builder.getListFormat().applyBulletDefault();
        builder.writeln("Great performance");
        builder.writeln("High reliability");
        builder.writeln("Quality code and working");
        builder.writeln("Wide variety of features");
        builder.writeln("Easy to understand API");
        
        // End the bulleted list
        builder.getListFormat().removeNumbers();
        
        doc.save(getArtifactsDir() + "Lists.ApplyDefaultBulletsAndNumbers.docx");

        Example:

        Shows how to remove bullets and numbering from all paragraphs in the main text of a section.
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        
        builder.getListFormat().applyNumberDefault();
        builder.writeln("Numbered list item 1");
        builder.writeln("Numbered list item 2");
        builder.writeln("Numbered list item 3");
        builder.getListFormat().removeNumbers();
        
        NodeCollection paras = doc.getChildNodes(NodeType.PARAGRAPH, true);
        
        Assert.assertEquals(3, DocumentHelper.getListItemCount(paras));
        
        for (Paragraph paragraph : doc.getFirstSection().getBody().getParagraphs())
            paragraph.getListFormat().removeNumbers();
        
        paras = doc.getChildNodes(NodeType.PARAGRAPH, true);
        
        Assert.assertEquals(0, DocumentHelper.getListItemCount(paras));