Click or drag to resize

NumberStyle Enumeration

Represents the number style.

Namespace: SautinSoft.Document
Assembly: SautinSoft.Document (in SautinSoft.Document.dll) Version: 2024.7.18
Syntax
public enum NumberStyle
Members
Member nameValueDescription
Decimal0 Decimal number.
UpperRoman1 Upper Roman number.
LowerRoman2 Lower Roman number.
UpperLetter3 Upper letter.
LowerLetter4 Lower letter.
Ordinal5 Ordinal.
CardinalText6 Cardinal text.
OrdinalText7 Ordinal text.
DecimalZero8 Specifies that the sequence shall consist of Arabic numbering with a zero added to numbers one through nine.
Chicago9 Chicago Manual of Style (*, † ...)
Bullet10 Bullet.
None11 None.
Example

See Developer Guide: How to create customized lists

How to create customized lists using C#
using SautinSoft.Document;

namespace Sample
{
    class Sample
    {

        static void Main(string[] args)
        {
            // Get your free 100-day key here:   
            // https://sautinsoft.com/start-for-free/

            CustomizedLists();
        }

        /// <summary>
        /// How to create customized lists.
        /// </summary>
        /// <remarks>
        /// Details: https://sautinsoft.com/products/document/help/net/developer-guide/create-customized-list-in-docx-document-net-csharp-vb.php
        /// </remarks>        
        public static void CustomizedLists()
        {
            string documentPath = @"CustomizedLists.docx";

            // Let's create a new document.
            DocumentCore dc = new DocumentCore();

            // Add a new section.
            Section s = new Section(dc);
            dc.Sections.Add(s);

            // Create a new list style based on the ListTemplateType.Bullet template.
            ListStyle myCustomList1 = new ListStyle("MyCustomList1", ListTemplateType.Bullet);

            // Replace the standard bullet with the symbol ASTERISM (unicode 0x2042).
            myCustomList1.ListLevelFormats[0].NumberFormat = "\x2042";

            // Change the character formatting.
            myCustomList1.ListLevelFormats[0].CharacterFormat.FontName = "Calibri";
            myCustomList1.ListLevelFormats[0].CharacterFormat.FontColor = Color.Blue;
            dc.Styles.Add(myCustomList1);

            Paragraph a1 = new Paragraph(dc, "Asterism 1.");
            a1.ListFormat.Style = myCustomList1;
            s.Blocks.Add(a1);

            Paragraph a2 = new Paragraph(dc, "Asterism 2.");
            a2.ListFormat.Style = myCustomList1;
            a2.ParagraphFormat.SpaceAfter = 30;
            s.Blocks.Add(a2);

            // Create a new list style based on the ListTemplateType.NumberWithDot template.
            ListStyle myCustomList2 = new ListStyle("MyCustomList2", ListTemplateType.NumberWithDot);

            // Change the visual representation of the marker number on the first and second numbering levels.
            myCustomList2.ListLevelFormats[0].NumberFormat = "%1.";
            myCustomList2.ListLevelFormats[0].NumberStyle = NumberStyle.UpperRoman;
            myCustomList2.ListLevelFormats[0].TrailingCharacter = ListTrailingCharacter.Tab;
            myCustomList2.ListLevelFormats[1].NumberFormat = "%1. %2.";
            myCustomList2.ListLevelFormats[1].NumberStyle = NumberStyle.LowerLetter;
            myCustomList2.ListLevelFormats[1].TrailingCharacter = ListTrailingCharacter.Space;

            dc.Styles.Add(myCustomList2);

            Paragraph p1 = new Paragraph(dc, "First paragraph.");
            p1.ListFormat.Style = myCustomList2;
            s.Blocks.Add(p1);

            Paragraph p2 = new Paragraph(dc, "Second paragraph.");
            p2.ListFormat.Style = myCustomList2;
            s.Blocks.Add(p2);

            Paragraph p21 = new Paragraph(dc, "Sub paragraph a.");
            p21.ListFormat.Style = myCustomList2;
            p21.ListFormat.ListLevelNumber = 1;
            s.Blocks.Add(p21);

            Paragraph p22 = new Paragraph(dc, "Sub paragraph b.");
            p22.ListFormat.Style = myCustomList2;
            p22.ListFormat.ListLevelNumber = 1;
            s.Blocks.Add(p22);

            // Save our document into DOCX file.
            dc.Save(documentPath, new DocxSaveOptions());

            // Open the result for demonstration purposes.
            System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(documentPath) { UseShellExecute = true });
        }
    }
}
How to create customized lists using VB.Net
Imports SautinSoft.Document

Namespace Sample
    Friend Class Sample

        Shared Sub Main(ByVal args() As String)
            CustomizedLists()
        End Sub
        ''' Get your free 100-day key here:   
        ''' https://sautinsoft.com/start-for-free/
        ''' <summary>
        ''' How to create customized lists.
        ''' </summary>
        ''' <remarks>
        ''' Details: https://sautinsoft.com/products/document/help/net/developer-guide/create-customized-list-in-docx-document-net-csharp-vb.php
        ''' </remarks>        
        Public Shared Sub CustomizedLists()
            Dim documentPath As String = "CustomizedLists.docx"

            ' Let's create a new document.
            Dim dc As New DocumentCore()

            ' Add a new section.
            Dim s As New Section(dc)
            dc.Sections.Add(s)

            ' Create a new list style based on the ListTemplateType.Bullet template.
            Dim myCustomList1 As New ListStyle("MyCustomList1", ListTemplateType.Bullet)

            ' Replace the standard bullet with the symbol ASTERISM (unicode 0x2042).
            myCustomList1.ListLevelFormats(0).NumberFormat = ChrW(&H2042).ToString()

            ' Change the character formatting.
            myCustomList1.ListLevelFormats(0).CharacterFormat.FontName = "Calibri"
            myCustomList1.ListLevelFormats(0).CharacterFormat.FontColor = Color.Blue
            dc.Styles.Add(myCustomList1)

            Dim a1 As New Paragraph(dc, "Asterism 1.")
            a1.ListFormat.Style = myCustomList1
            s.Blocks.Add(a1)

            Dim a2 As New Paragraph(dc, "Asterism 2.")
            a2.ListFormat.Style = myCustomList1
            a2.ParagraphFormat.SpaceAfter = 30
            s.Blocks.Add(a2)

            ' Create a new list style based on the ListTemplateType.NumberWithDot template.
            Dim myCustomList2 As New ListStyle("MyCustomList2", ListTemplateType.NumberWithDot)

            ' Change the visual representation of the marker number on the first and second numbering levels.
            myCustomList2.ListLevelFormats(0).NumberFormat = "%1."
            myCustomList2.ListLevelFormats(0).NumberStyle = NumberStyle.UpperRoman
            myCustomList2.ListLevelFormats(0).TrailingCharacter = ListTrailingCharacter.Tab
            myCustomList2.ListLevelFormats(1).NumberFormat = "%1. %2."
            myCustomList2.ListLevelFormats(1).NumberStyle = NumberStyle.LowerLetter
            myCustomList2.ListLevelFormats(1).TrailingCharacter = ListTrailingCharacter.Space

            dc.Styles.Add(myCustomList2)

            Dim p1 As New Paragraph(dc, "First paragraph.")
            p1.ListFormat.Style = myCustomList2
            s.Blocks.Add(p1)

            Dim p2 As New Paragraph(dc, "Second paragraph.")
            p2.ListFormat.Style = myCustomList2
            s.Blocks.Add(p2)

            Dim p21 As New Paragraph(dc, "Sub paragraph a.")
            p21.ListFormat.Style = myCustomList2
            p21.ListFormat.ListLevelNumber = 1
            s.Blocks.Add(p21)

            Dim p22 As New Paragraph(dc, "Sub paragraph b.")
            p22.ListFormat.Style = myCustomList2
            p22.ListFormat.ListLevelNumber = 1
            s.Blocks.Add(p22)

            ' Save our document into DOCX file.
            dc.Save(documentPath, New DocxSaveOptions())

            ' Open the result for demonstration purposes.
            System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(documentPath) With {.UseShellExecute = True})
        End Sub
    End Class
End Namespace
See Also