How to create a list with a custom bullet character

Q: Hi. can you please tell me how to insert custom bullets into a list instead of using builder.ListFormat.ApplyBulletDefault? i am looking to make the bullet symbol 183. any insight would be helpful. thanks

A: It is pretty easy actually once you understand a bit about lists in Microsoft Word. Every list in a Microsoft Word document is an “object” that is stored separately from the paragraphs. Paragraphs only reference it.

Each list defines properties for the list in general and also detailed properties for each of the list level (There could be 1 or 9 levels).

Bullet character is a property of a list level.

A list is normally created from a list template - Microsoft Word defines about 20 templates. One of the ways to create a list is to call ListFormat.ApplyBulletDefault() - it creates a bulleted list based on one of the templates. If you do this, you just need to set the bullet character afterwards.

// This creates a list and applies to the current paragraph.
builder.ListFormat.ApplyBulletDefault();

// This is the way to get the list referenced by the current paragraph.
List list = builder.ListFormat.List;

// This is the way to get the current list level object.
ListLevel level = list.ListLevels[0];

// Or this single line instead of the two lines above.
ListLevel level = builder.ListFormat.ListLevel;

// Now you can modify the list level formatting, set the bullet.
level.NumberFormat = "\xb7";

Note that list formatting API was introduced in Aspose.Words 3.7, so if you don’t see types like Lists, List, ListLevel, ListTemplate etc, you need to upgrade.

There is plenty of code examples for the new lists API, for example: https://reference.aspose.com/words/net/aspose.words.lists/listlevel/properties/numberformat

Hi dere, as related to same topic i have to ask u that do you get exactly what u needed thru the code describe here in topic.

As i m facing a problem on displaying the specific bullet on my word document generated through the c# coding.

I want to display “-” but what i get the ouptput is this “dot circle”.

Cna u help me in same please,.

sulabh

plz send me reply to my id: sulabh2sampatti.com if not feel inconvinionce

Thanks

Hi,

Thank you for considering Aspose.Words. It is very easy to achieve:

DocumentBuilder builder = new DocumentBuilder();
builder.ListFormat.ApplyBulletDefault();
builder.ListFormat.ListLevel.NumberFormat = "-";
builder.Writeln("Item 1");
builder.Writeln("Item 2");
builder.Writeln("Item 3");