.NET Perform Word-Set Number List for Word Paragraphs in C# and Visual Basic

Now, please open any one instruction besides you and follow it step by step. OK, you find that there is a number or mark on front of every step to form a list. With the list, you feel that everything is presented very clearly and understand how to use on instrument quickly. Actually, when we writing to discuss one topic or reviews about some events, we often need to show some points with list format to enables readers to get key points quickly. This post focuses on introducing solution to set Word number list for paragraphs in C# and Visual Basic. And the screenshot blow shows result after formatting number list.

This solution is based on a .NET Word component, Spire.Doc for .NET so that we need to download and install this component on our system at the beginning. Then, set number list for specified paragraphs by following the steps.

Firstly, load the Word document we have prepared. Secondly, invoke Paragraph.ListFormat.ApplyNumberedStyle() method in a for loop to set number list format for paragraph 5 to 8. In this loop, we also can set character format and number position for current list level to make the list shown more obviously.



using Spire.Doc;

using Spire.Doc.Documents;

using System.Drawing;


namespace WordBullets


    class Program


        static void Main(string[] args)


            //Load Document

            Document doc = new Document();

            doc.LoadFromFile(@”E:\Work\Documents\WordDocuments\Microsoft Word 2013 Preview.docx”);


            //Set Bullet Style

            Section s = doc.Sections[0];


            for (int i = 5; i< 8; i++)


                Paragraph p = s.Paragraphs[i];


                p.ListFormat.CurrentListLevel.NumberPosition = -12;

                p.ListFormat.CurrentListLevel.CharacterFormat.FontName = “Calibri”;

                p.ListFormat.CurrentListLevel.CharacterFormat.FontSize = 12;

                p.ListFormat.CurrentListLevel.CharacterFormat.Bold = true;

                p.ListFormat.CurrentListLevel.CharacterFormat.TextColor = Color.Purple;



            //Save and Launch

            doc.SaveToFile(“Bullets.doc”, FileFormat.Doc);






Visual Basic

Imports Spire.Doc

Imports Spire.Doc.Documents

Imports System.Drawing


Namespace WordBullets

    Friend Class Program

        Shared Sub Main(ByVal args() As String)

            ‘Load Document

            Dim doc As New Document()

            doc.LoadFromFile(“E:\Work\Documents\WordDocuments\Microsoft Word 2013 Preview.docx”)


            ‘Set Bullet Style

            Dim s As Section = doc.Sections(0)


            For i As Integer = 5 To 7

                Dim p As Paragraph = s.Paragraphs(i)


                p.ListFormat.CurrentListLevel.NumberPosition = -12

                p.ListFormat.CurrentListLevel.CharacterFormat.FontName = “Calibri”

                p.ListFormat.CurrentListLevel.CharacterFormat.FontSize = 12

                p.ListFormat.CurrentListLevel.CharacterFormat.Bold = True

                p.ListFormat.CurrentListLevel.CharacterFormat.TextColor = Color.Purple

            Next i


            ‘Save and Launch

            doc.SaveToFile(“Bullets.doc”, FileFormat.Doc)


        End Sub

    End Class

End Namespace


Download Spire.Doc for .NET Here

P.S. The .NET Office component, Spire.Office for .NET can be used to realize this function as well.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s