diff --git a/Paragraphs/Create-list-with-hanging-indent/.NET/Create-list-with-hanging-indent.sln b/Paragraphs/Create-list-with-hanging-indent/.NET/Create-list-with-hanging-indent.sln new file mode 100644 index 000000000..9c278b6bd --- /dev/null +++ b/Paragraphs/Create-list-with-hanging-indent/.NET/Create-list-with-hanging-indent.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35327.3 +MinimumVisualStudioVersion = 10.0.40219.1 +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}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {57C001A1-C538-4829-92C2-20D710656E0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {57C001A1-C538-4829-92C2-20D710656E0F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {57C001A1-C538-4829-92C2-20D710656E0F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {57C001A1-C538-4829-92C2-20D710656E0F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A30E106F-36D5-42A4-A44F-0AE880C0565D} + EndGlobalSection +EndGlobal diff --git a/Paragraphs/Create-list-with-hanging-indent/.NET/Create-list-with-hanging-indent/Create-list-with-hanging-indent.csproj b/Paragraphs/Create-list-with-hanging-indent/.NET/Create-list-with-hanging-indent/Create-list-with-hanging-indent.csproj new file mode 100644 index 000000000..403a92445 --- /dev/null +++ b/Paragraphs/Create-list-with-hanging-indent/.NET/Create-list-with-hanging-indent/Create-list-with-hanging-indent.csproj @@ -0,0 +1,20 @@ + + + + Exe + net8.0 + Create_list_with_hanging_indent + enable + enable + + + + + + + + + Always + + + diff --git a/Paragraphs/Create-list-with-hanging-indent/.NET/Create-list-with-hanging-indent/Output/.gitkeep b/Paragraphs/Create-list-with-hanging-indent/.NET/Create-list-with-hanging-indent/Output/.gitkeep new file mode 100644 index 000000000..5f282702b --- /dev/null +++ b/Paragraphs/Create-list-with-hanging-indent/.NET/Create-list-with-hanging-indent/Output/.gitkeep @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Paragraphs/Create-list-with-hanging-indent/.NET/Create-list-with-hanging-indent/Program.cs b/Paragraphs/Create-list-with-hanging-indent/.NET/Create-list-with-hanging-indent/Program.cs new file mode 100644 index 000000000..79438b266 --- /dev/null +++ b/Paragraphs/Create-list-with-hanging-indent/.NET/Create-list-with-hanging-indent/Program.cs @@ -0,0 +1,41 @@ +using Syncfusion.DocIO; +using Syncfusion.DocIO.DLS; + +namespace Create_list_with_hanging_indent +{ + internal class Program + { + static void Main(string[] args) + { + // Create a new Word document. + using (WordDocument document = new WordDocument()) + { + // Add a section to the document. + IWSection section = document.AddSection(); + + // Add a bulleted list item with a hanging indent. + IWParagraph bulletParagraph1 = section.AddParagraph(); + bulletParagraph1.ListFormat.ApplyDefBulletStyle(); + bulletParagraph1.AppendText("First").CharacterFormat.FontSize = 12; + bulletParagraph1.ParagraphFormat.FirstLineIndent = -18; // Hanging indent for bullet alignment. + + // Add a normal paragraph with a first-line indent. + IWParagraph normalParagraph = section.AddParagraph(); + normalParagraph.AppendText("Sample text with first-line indent.").CharacterFormat.FontSize = 12; + normalParagraph.ParagraphFormat.FirstLineIndent = 35; + + // Add another bulleted list item with a hanging indent. + IWParagraph bulletParagraph2 = section.AddParagraph(); + bulletParagraph2.ListFormat.ApplyDefBulletStyle(); + bulletParagraph2.AppendText("Second").CharacterFormat.FontSize = 12; + bulletParagraph2.ParagraphFormat.FirstLineIndent = -18; // Hanging indent for bullet alignment. + + // Save the document. + using (FileStream outputFileStream = new FileStream(Path.GetFullPath("Output/Result.docx"), FileMode.Create, FileAccess.Write)) + { + document.Save(outputFileStream, FormatType.Docx); + } + } + } + } +}