Insert Bullets in Word using C#

This article explains how to insert bullets in Word using C#. It has the details to set the development environment, a list of steps, and a sample code demonstrating how to add bullet points in Word using C#. You will learn to create a new Word file, insert a list with multiple levels, add some text, and save the output file with a list.

Steps to Add Bullets in Word using C#

  1. Set the environment to use Aspose.Words for .NET to create a bullet list
  2. Create a new World file using the Document class object to add bullets
  3. Create a DocumentBuilder object for the newly created Word file
  4. Call the ListFormat.ApplyBulletDefault() method to start a bullet list
  5. Use the WriteLn() method to insert text in the list
  6. Use ListIndent() and ListOutdent() to move control to sub-items and previous parent items in the list
  7. Use RemoveNumbers() to remove the last empty bullet and save the output

These steps summarize the adding bullets in Microsoft Word using C#. You may create a new Word file, link a DocumentBuilder object with it, and start a list by calling the ListFormat.ApplyBulletDefault(), add text and set indentation inward and outward using the ListIndent() or ListOutdent() wherever required. Finally, call the RemoveNumbers() to stop the list and save the Word file.

Code to Create Bullets in Word using C#

This code snippet demonstrates adding Word document bullets using C#. We have used ApplyBulletDefault() method to start a bullet list and use ApplyNumberDefault() to start a number list. When we use WriteLn() it creates a new empty bullet at the end of the list that is why we use RemoveNumbers() to remove this empty item and stop the list in the current paragraph.

This article has guided us on how to insert bullets in Word using C#. If you want to convert an existing paragraph to bullets, refer to the article Convert paragraph into bullet points in Word using C#.

 English