Set ASCII Characters as Bullet Points in Word in Java

This article shows you how to set ASCII characters (special symbols) as bullet points in Word documents using Spire.Doc for Java.

import com.spire.doc.Document;
import com.spire.doc.FileFormat;
import com.spire.doc.Section;
import com.spire.doc.documents.ListStyle;
import com.spire.doc.documents.ListType;
import com.spire.doc.documents.Paragraph;

public class SetBulletPoints {

    public static void main(String[] args) {

        //Create a Document object and add a section
        Document doc = new Document();
        Section section = doc.addSection();

        //Create four list styles based on different ASCII characters
        ListStyle listStyle1 = new ListStyle(doc, ListType.Bulleted);
        listStyle1.getLevels().get(0).setBulletCharacter("\u006e");
        listStyle1.getLevels().get(0).getCharacterFormat().setFontName("Wingdings");
        listStyle1.setName("liststyle1");
        doc.getListStyles().add(listStyle1);
        ListStyle listStyle2 = new ListStyle(doc, ListType.Bulleted);
        listStyle2.getLevels().get(0).setBulletCharacter("\u0075");
        listStyle2.getLevels().get(0).getCharacterFormat().setFontName("Wingdings");
        listStyle2.setName("liststyle2");
        doc.getListStyles().add(listStyle2);
        ListStyle listStyle3 = new ListStyle(doc, ListType.Bulleted);
        listStyle3.getLevels().get(0).setBulletCharacter("\u00b2");
        listStyle3.getLevels().get(0).getCharacterFormat().setFontName("Wingdings");
        listStyle3.setName("liststyle3");
        doc.getListStyles().add(listStyle3);
        ListStyle listStyle4 = new ListStyle(doc, ListType.Bulleted);
        listStyle4 .getLevels().get(0).setBulletCharacter("\u00d8");
        listStyle4 .getLevels().get(0).getCharacterFormat().setFontName("Wingdings");
        listStyle4.setName("liststyle4");
        doc.getListStyles().add(listStyle4);

        //Add four paragraphs and apply list style separately
        Paragraph p1 = section.getBody().addParagraph();
        p1.appendText("Spire.Doc for .NET");
        p1.getListFormat().applyStyle(listStyle1.getName());
        Paragraph p2 = section.getBody().addParagraph();
        p2.appendText("Spire.PDF for .NET");
        p2.getListFormat().applyStyle(listStyle2.getName());
        Paragraph p3 = section.getBody().addParagraph();
        p3.appendText("Spire.XLS for .NET");
        p3.getListFormat().applyStyle(listStyle3.getName());
        Paragraph p4= section.getBody().addParagraph();
        p4.appendText("Spire.Presentation for .NET");
        p4.getListFormat().applyStyle(listStyle4.getName());

        //Save to file
        doc.saveToFile("SetBulletCharacter.docx", FileFormat.Docx);
    }
}

Set ASCII Characters as Bullet Points in Word in Java