Skip to content

ES-919321- Add the sample Create-list-with-hanging-indent #368

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
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 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Create_list_with_hanging_indent</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</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 @@

Original file line number Diff line number Diff line change
@@ -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);
}
}
}
}
}
Loading