Skip to content

Commit 16ce163

Browse files
Merge pull request #368 from SyncfusionExamples/ES-919321-Create-list-with-hanging-indent
ES-919321- Add the sample Create-list-with-hanging-indent
2 parents df1fcb1 + eeea511 commit 16ce163

File tree

4 files changed

+87
-0
lines changed

4 files changed

+87
-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 17
4+
VisualStudioVersion = 17.11.35327.3
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Create-list-with-hanging-indent", "Create-list-with-hanging-indent\Create-list-with-hanging-indent.csproj", "{57C001A1-C538-4829-92C2-20D710656E0F}"
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+
{57C001A1-C538-4829-92C2-20D710656E0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{57C001A1-C538-4829-92C2-20D710656E0F}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{57C001A1-C538-4829-92C2-20D710656E0F}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{57C001A1-C538-4829-92C2-20D710656E0F}.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 = {A30E106F-36D5-42A4-A44F-0AE880C0565D}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<RootNamespace>Create_list_with_hanging_indent</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="*" />
13+
</ItemGroup>
14+
15+
<ItemGroup>
16+
<None Update="Output\.gitkeep">
17+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
18+
</None>
19+
</ItemGroup>
20+
</Project>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
using Syncfusion.DocIO;
2+
using Syncfusion.DocIO.DLS;
3+
4+
namespace Create_list_with_hanging_indent
5+
{
6+
internal class Program
7+
{
8+
static void Main(string[] args)
9+
{
10+
// Create a new Word document.
11+
using (WordDocument document = new WordDocument())
12+
{
13+
// Add a section to the document.
14+
IWSection section = document.AddSection();
15+
16+
// Add a bulleted list item with a hanging indent.
17+
IWParagraph bulletParagraph1 = section.AddParagraph();
18+
bulletParagraph1.ListFormat.ApplyDefBulletStyle();
19+
bulletParagraph1.AppendText("First").CharacterFormat.FontSize = 12;
20+
bulletParagraph1.ParagraphFormat.FirstLineIndent = -18; // Hanging indent for bullet alignment.
21+
22+
// Add a normal paragraph with a first-line indent.
23+
IWParagraph normalParagraph = section.AddParagraph();
24+
normalParagraph.AppendText("Sample text with first-line indent.").CharacterFormat.FontSize = 12;
25+
normalParagraph.ParagraphFormat.FirstLineIndent = 35;
26+
27+
// Add another bulleted list item with a hanging indent.
28+
IWParagraph bulletParagraph2 = section.AddParagraph();
29+
bulletParagraph2.ListFormat.ApplyDefBulletStyle();
30+
bulletParagraph2.AppendText("Second").CharacterFormat.FontSize = 12;
31+
bulletParagraph2.ParagraphFormat.FirstLineIndent = -18; // Hanging indent for bullet alignment.
32+
33+
// Save the document.
34+
using (FileStream outputFileStream = new FileStream(Path.GetFullPath("Output/Result.docx"), FileMode.Create, FileAccess.Write))
35+
{
36+
document.Save(outputFileStream, FormatType.Docx);
37+
}
38+
}
39+
}
40+
}
41+
}

0 commit comments

Comments
 (0)