Skip to content

Commit e2a8e23

Browse files
ES-959947-List-number-format
1 parent 4a924b7 commit e2a8e23

File tree

4 files changed

+154
-0
lines changed

4 files changed

+154
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.31911.196
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "List-number-format", "List-number-format\List-number-format.csproj", "{C17B90BC-F559-456B-B189-90B53FF6CDD4}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{C17B90BC-F559-456B-B189-90B53FF6CDD4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{C17B90BC-F559-456B-B189-90B53FF6CDD4}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{C17B90BC-F559-456B-B189-90B53FF6CDD4}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{C17B90BC-F559-456B-B189-90B53FF6CDD4}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {EF357FC6-E9E5-4E3C-B932-43F727BE1DE4}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<RootNamespace>List_number_format</RootNamespace>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="*" />
11+
</ItemGroup>
12+
13+
<ItemGroup>
14+
<None Update="Output\.gitkeep">
15+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
16+
</None>
17+
</ItemGroup>
18+
19+
</Project>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
using Syncfusion.DocIO;
2+
using Syncfusion.DocIO.DLS;
3+
using System.IO;
4+
5+
6+
// Creates a new instance of WordDocument to work with.
7+
using (WordDocument document = new WordDocument())
8+
{
9+
// Adds a new section to the document.
10+
IWSection section = document.AddSection();
11+
IWParagraph paragraph = section.AddParagraph();
12+
13+
// Adds a numbered list style with CardinalText pattern (One, Two, Three, ...).
14+
ListStyle listStyle = document.AddListStyle(ListType.Numbered, "CardinalText");
15+
WListLevel levelOne = listStyle.Levels[0];
16+
levelOne.PatternType = ListPatternType.CardinalText;
17+
levelOne.StartAt = 1;
18+
19+
// Adds a heading paragraph for the CardinalText list.
20+
paragraph = section.AddParagraph();
21+
paragraph.AppendText("List pattern Cardinal Text");
22+
23+
// Adds first list item using CardinalText style.
24+
paragraph = section.AddParagraph();
25+
paragraph.AppendText("List item 1");
26+
paragraph.ListFormat.ApplyStyle("CardinalText");
27+
paragraph.ListFormat.ContinueListNumbering();
28+
29+
// Adds second list item using CardinalText style.
30+
paragraph = section.AddParagraph();
31+
paragraph.AppendText("List item 2");
32+
paragraph.ListFormat.ApplyStyle("CardinalText");
33+
paragraph.ListFormat.ContinueListNumbering();
34+
35+
// Adds third list item using CardinalText style.
36+
paragraph = section.AddParagraph();
37+
paragraph.AppendText("List item 3");
38+
paragraph.ListFormat.ApplyStyle("CardinalText");
39+
paragraph.ListFormat.ContinueListNumbering();
40+
41+
// Adds a blank paragraph before the next list.
42+
paragraph = section.AddParagraph();
43+
44+
// Adds a numbered list style with HindiLetter1 pattern.
45+
listStyle = document.AddListStyle(ListType.Numbered, "HindiLetter1");
46+
levelOne = listStyle.Levels[0];
47+
levelOne.PatternType = ListPatternType.HindiLetter1;
48+
levelOne.StartAt = 1;
49+
50+
// Adds a heading paragraph for the HindiLetter1 list.
51+
paragraph = section.AddParagraph();
52+
paragraph.AppendText("List pattern Hindi Letter");
53+
54+
// Adds first list item using HindiLetter1 style.
55+
paragraph = section.AddParagraph();
56+
paragraph.AppendText("List item 1");
57+
paragraph.ListFormat.ApplyStyle("HindiLetter1");
58+
paragraph.ListFormat.ContinueListNumbering();
59+
60+
// Adds second list item using HindiLetter1 style.
61+
paragraph = section.AddParagraph();
62+
paragraph.AppendText("List item 2");
63+
paragraph.ListFormat.ApplyStyle("HindiLetter1");
64+
paragraph.ListFormat.ContinueListNumbering();
65+
66+
// Adds third list item using HindiLetter1 style.
67+
paragraph = section.AddParagraph();
68+
paragraph.AppendText("List item 3");
69+
paragraph.ListFormat.ApplyStyle("HindiLetter1");
70+
paragraph.ListFormat.ContinueListNumbering();
71+
72+
// Adds a blank paragraph before the next list.
73+
paragraph = section.AddParagraph();
74+
75+
// Adds a numbered list style with Hebrew1 pattern.
76+
listStyle = document.AddListStyle(ListType.Numbered, "Hebrew1");
77+
levelOne = listStyle.Levels[0];
78+
levelOne.PatternType = ListPatternType.Hebrew1;
79+
levelOne.StartAt = 1;
80+
81+
// Adds a heading paragraph for the Hebrew1 list.
82+
paragraph = section.AddParagraph();
83+
paragraph.AppendText("List pattern Herbrew");
84+
85+
// Adds first list item using Hebrew1 style.
86+
paragraph = section.AddParagraph();
87+
paragraph.AppendText("List item 1");
88+
paragraph.ListFormat.ApplyStyle("Hebrew1");
89+
paragraph.ListFormat.ContinueListNumbering();
90+
91+
// Adds second list item using Hebrew1 style.
92+
paragraph = section.AddParagraph();
93+
paragraph.AppendText("List item 2");
94+
paragraph.ListFormat.ApplyStyle("Hebrew1");
95+
paragraph.ListFormat.ContinueListNumbering();
96+
97+
// Adds third list item using Hebrew1 style.
98+
paragraph = section.AddParagraph();
99+
paragraph.AppendText("List item 3");
100+
paragraph.ListFormat.ApplyStyle("Hebrew1");
101+
paragraph.ListFormat.ContinueListNumbering();
102+
103+
// Create a file stream to save the document.
104+
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Result.docx"), FileMode.Create, FileAccess.ReadWrite))
105+
{
106+
// Saves the Word document to the specified file stream in DOCX format.
107+
document.Save(outputFileStream, FormatType.Docx);
108+
}
109+
}

0 commit comments

Comments
 (0)