Represents the number style.
Namespace: SautinSoft.DocumentAssembly: SautinSoft.Document (in SautinSoft.Document.dll) Version: 2024.12.16
Syntax Public Enumeration NumberStyle
Members Member name | Value | Description |
---|
Decimal | 0 |
Decimal number.
|
UpperRoman | 1 |
Upper Roman number.
|
LowerRoman | 2 |
Lower Roman number.
|
UpperLetter | 3 |
Upper letter.
|
LowerLetter | 4 |
Lower letter.
|
Ordinal | 5 |
Ordinal.
|
CardinalText | 6 |
Cardinal text.
|
OrdinalText | 7 |
Ordinal text.
|
DecimalZero | 8 |
Specifies that the sequence shall consist of Arabic numbering with a zero
added to numbers one through nine.
|
Chicago | 9 |
Chicago Manual of Style (*, † ...)
|
Bullet | 10 |
Bullet.
|
None | 11 |
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)
{
CustomizedLists();
}
public static void CustomizedLists()
{
string documentPath = @"CustomizedLists.docx";
DocumentCore dc = new DocumentCore();
Section s = new Section(dc);
dc.Sections.Add(s);
ListStyle myCustomList1 = new ListStyle("MyCustomList1", ListTemplateType.Bullet);
myCustomList1.ListLevelFormats[0].NumberFormat = "\x2042";
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);
ListStyle myCustomList2 = new ListStyle("MyCustomList2", ListTemplateType.NumberWithDot);
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);
dc.Save(documentPath, new DocxSaveOptions());
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
Public Shared Sub CustomizedLists()
Dim documentPath As String = "CustomizedLists.docx"
Dim dc As New DocumentCore()
Dim s As New Section(dc)
dc.Sections.Add(s)
Dim myCustomList1 As New ListStyle("MyCustomList1", ListTemplateType.Bullet)
myCustomList1.ListLevelFormats(0).NumberFormat = ChrW(&H2042).ToString()
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)
Dim myCustomList2 As New ListStyle("MyCustomList2", ListTemplateType.NumberWithDot)
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)
dc.Save(documentPath, New DocxSaveOptions())
System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(documentPath) With {.UseShellExecute = True})
End Sub
End Class
End Namespace
See Also