Skip to content

ES-959947- Add the sample List-number-format #454

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions Paragraphs/List-number-format/.NET/List-number-format.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31911.196
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "List-number-format", "List-number-format\List-number-format.csproj", "{C17B90BC-F559-456B-B189-90B53FF6CDD4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C17B90BC-F559-456B-B189-90B53FF6CDD4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C17B90BC-F559-456B-B189-90B53FF6CDD4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C17B90BC-F559-456B-B189-90B53FF6CDD4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C17B90BC-F559-456B-B189-90B53FF6CDD4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {EF357FC6-E9E5-4E3C-B932-43F727BE1DE4}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>List_number_format</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="*" />
</ItemGroup>

<ItemGroup>
<None Update="Output\.gitkeep">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

109 changes: 109 additions & 0 deletions Paragraphs/List-number-format/.NET/List-number-format/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using System.IO;


// Creates a new instance of WordDocument to work with.
using (WordDocument document = new WordDocument())
{
// Adds a new section to the document.
IWSection section = document.AddSection();
IWParagraph paragraph = section.AddParagraph();

// Adds a numbered list style with CardinalText pattern (One, Two, Three, ...).
ListStyle listStyle = document.AddListStyle(ListType.Numbered, "CardinalText");
WListLevel levelOne = listStyle.Levels[0];
levelOne.PatternType = ListPatternType.CardinalText;
levelOne.StartAt = 1;

// Adds a heading paragraph for the CardinalText list.
paragraph = section.AddParagraph();
paragraph.AppendText("List pattern Cardinal Text");

// Adds first list item using CardinalText style.
paragraph = section.AddParagraph();
paragraph.AppendText("List item 1");
paragraph.ListFormat.ApplyStyle("CardinalText");
paragraph.ListFormat.ContinueListNumbering();

// Adds second list item using CardinalText style.
paragraph = section.AddParagraph();
paragraph.AppendText("List item 2");
paragraph.ListFormat.ApplyStyle("CardinalText");
paragraph.ListFormat.ContinueListNumbering();

// Adds third list item using CardinalText style.
paragraph = section.AddParagraph();
paragraph.AppendText("List item 3");
paragraph.ListFormat.ApplyStyle("CardinalText");
paragraph.ListFormat.ContinueListNumbering();

// Adds a blank paragraph before the next list.
paragraph = section.AddParagraph();

// Adds a numbered list style with HindiLetter1 pattern.
listStyle = document.AddListStyle(ListType.Numbered, "HindiLetter1");
levelOne = listStyle.Levels[0];
levelOne.PatternType = ListPatternType.HindiLetter1;
levelOne.StartAt = 1;

// Adds a heading paragraph for the HindiLetter1 list.
paragraph = section.AddParagraph();
paragraph.AppendText("List pattern Hindi Letter");

// Adds first list item using HindiLetter1 style.
paragraph = section.AddParagraph();
paragraph.AppendText("List item 1");
paragraph.ListFormat.ApplyStyle("HindiLetter1");
paragraph.ListFormat.ContinueListNumbering();

// Adds second list item using HindiLetter1 style.
paragraph = section.AddParagraph();
paragraph.AppendText("List item 2");
paragraph.ListFormat.ApplyStyle("HindiLetter1");
paragraph.ListFormat.ContinueListNumbering();

// Adds third list item using HindiLetter1 style.
paragraph = section.AddParagraph();
paragraph.AppendText("List item 3");
paragraph.ListFormat.ApplyStyle("HindiLetter1");
paragraph.ListFormat.ContinueListNumbering();

// Adds a blank paragraph before the next list.
paragraph = section.AddParagraph();

// Adds a numbered list style with Hebrew1 pattern.
listStyle = document.AddListStyle(ListType.Numbered, "Hebrew1");
levelOne = listStyle.Levels[0];
levelOne.PatternType = ListPatternType.Hebrew1;
levelOne.StartAt = 1;

// Adds a heading paragraph for the Hebrew1 list.
paragraph = section.AddParagraph();
paragraph.AppendText("List pattern Herbrew");

// Adds first list item using Hebrew1 style.
paragraph = section.AddParagraph();
paragraph.AppendText("List item 1");
paragraph.ListFormat.ApplyStyle("Hebrew1");
paragraph.ListFormat.ContinueListNumbering();

// Adds second list item using Hebrew1 style.
paragraph = section.AddParagraph();
paragraph.AppendText("List item 2");
paragraph.ListFormat.ApplyStyle("Hebrew1");
paragraph.ListFormat.ContinueListNumbering();

// Adds third list item using Hebrew1 style.
paragraph = section.AddParagraph();
paragraph.AppendText("List item 3");
paragraph.ListFormat.ApplyStyle("Hebrew1");
paragraph.ListFormat.ContinueListNumbering();

// Create a file stream to save the document.
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Result.docx"), FileMode.Create, FileAccess.ReadWrite))
{
// Saves the Word document to the specified file stream in DOCX format.
document.Save(outputFileStream, FormatType.Docx);
}
}
Loading