ListTemplateType Enumeration |
Specifies one of the predefined list formats available in Microsoft Word.
Namespace: SautinSoft.DocumentAssembly: SautinSoft.Document (in SautinSoft.Document.dll) Version: 2024.11.20
Syntax public enum ListTemplateType
Public Enumeration ListTemplateType
Members Member name | Value | Description |
---|
Bullet | 0 |
Bullet for a first level is disc.
|
BulletCircle | 1 |
Bullet for a first level is circle.
|
BulletSquare | 2 |
Bullet for a first level is square.
|
BulletDiamonds | 3 |
Bullet for a first level is diamond.
|
BulletArrow | 4 |
Bullet for a first level is arrow.
|
BulletCheckmark | 5 |
Bullet for a first level is checkmark.
|
LowerLetterWithBracket | 6 |
The number of the first level is "a)".
|
NumberWithDot | 7 |
The number of the first level is "1.".
|
NumberWithBracket | 8 |
The number of the first level is "1)".
|
UpperRomanNumberWithDot | 9 |
The number of the first level is "I.".
|
UpperLetterWithDot | 10 |
The number of the first level is "A.".
|
LowerLetterWithDot | 11 |
The number of the first level is "a.".
|
LowerRomanNumberWithDot | 12 |
The number of the first level is "i.".
|
Example See Developer Guide: How to create a simple document with ordered and unordered lists
How to create a simple document with ordered and unordered lists using C#
using SautinSoft.Document;
namespace Sample
{
class Sample
{
static void Main(string[] args)
{
SimpleLists();
}
public static void SimpleLists()
{
string documentPath = @"Lists.pdf";
DocumentCore dc = new DocumentCore();
Section s = new Section(dc);
dc.Sections.Add(s);
string[] myCollection = new string[] { "One", "Two", "Three", "Four", "Five" };
ListStyle ordList = new ListStyle("Simple Numbers", ListTemplateType.NumberWithDot);
foreach (ListLevelFormat f in ordList.ListLevelFormats)
{
f.CharacterFormat.Size = 14;
}
dc.Styles.Add(ordList);
dc.Content.Start.Insert("This is a simple ordered list:", new CharacterFormat() { Size = 14.0, FontColor = Color.Black });
int level = 0;
foreach (string listText in myCollection)
{
Paragraph p = new Paragraph(dc);
dc.Sections[0].Blocks.Add(p);
p.Content.End.Insert(listText, new CharacterFormat() { Size = 14.0, FontColor = Color.Black });
p.ListFormat.Style = ordList;
p.ListFormat.ListLevelNumber = level;
p.ParagraphFormat.SpaceAfter = 0;
}
dc.Content.End.Insert("\n\nThis is a simple bulleted list:", new CharacterFormat() { Size = 14.0, FontColor = Color.Black });
ListStyle bullList = new ListStyle("Bullets", ListTemplateType.Bullet);
dc.Styles.Add(bullList);
level = 0;
foreach (string listText in myCollection)
{
Paragraph p = new Paragraph(dc);
dc.Sections[0].Blocks.Add(p);
p.Content.End.Insert(listText, new CharacterFormat() { Size = 14.0, FontColor = Color.Black });
p.ListFormat.Style = bullList;
p.ListFormat.ListLevelNumber = level;
p.ParagraphFormat.SpaceAfter = 0;
}
dc.Save(documentPath, new PdfSaveOptions() { Compliance = PdfCompliance.PDF_A1a });
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(documentPath) { UseShellExecute = true });
}
}
}
How to create a simple document with ordered and unordered lists using VB.Net
Imports System
Imports System.IO
Imports SautinSoft.Document
Module Sample
Sub Main()
SimpleLists()
End Sub
Sub SimpleLists()
Dim documentPath As String = "Lists.pdf"
Dim dc As New DocumentCore()
Dim s As New Section(dc)
dc.Sections.Add(s)
Dim myCollection() As String = {"One", "Two", "Three", "Four", "Five"}
Dim ordList As New ListStyle("Simple Numbers", ListTemplateType.NumberWithDot)
For Each f As ListLevelFormat In ordList.ListLevelFormats
f.CharacterFormat.Size = 14
Next f
dc.Styles.Add(ordList)
dc.Content.Start.Insert("This is a simple ordered list:", New CharacterFormat() With {
.Size = 14.0,
.FontColor = Color.Black
})
Dim level As Integer = 0
For Each listText As String In myCollection
Dim p As New Paragraph(dc)
dc.Sections(0).Blocks.Add(p)
p.Content.End.Insert(listText, New CharacterFormat() With {
.Size = 14.0,
.FontColor = Color.Black
})
p.ListFormat.Style = ordList
p.ListFormat.ListLevelNumber = level
p.ParagraphFormat.SpaceAfter = 0
Next listText
dc.Content.End.Insert(vbLf & vbLf & "This is a simple bulleted list:", New CharacterFormat() With {
.Size = 14.0,
.FontColor = Color.Black
})
Dim bullList As New ListStyle("Bullets", ListTemplateType.Bullet)
dc.Styles.Add(bullList)
level = 0
For Each listText As String In myCollection
Dim p As New Paragraph(dc)
dc.Sections(0).Blocks.Add(p)
p.Content.End.Insert(listText, New CharacterFormat() With {
.Size = 14.0,
.FontColor = Color.Black
})
p.ListFormat.Style = bullList
p.ListFormat.ListLevelNumber = level
p.ParagraphFormat.SpaceAfter = 0
Next listText
dc.Save(documentPath, New PdfSaveOptions() With {.Compliance = PdfCompliance.PDF_A1a})
System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(documentPath) With {.UseShellExecute = True})
End Sub
End Module
See Also