From e27981fa8865cd70bb7a0665d7e3e15c15d02056 Mon Sep 17 00:00:00 2001 From: SushmaSF4796 Date: Mon, 24 Aug 2026 18:00:39 +0530 Subject: [PATCH 1/2] Added changes --- .../Create-clickable-highlighted-text.sln | 25 +++++++++++ .../Create-clickable-highlighted-text.csproj | 20 +++++++++ .../Output/.gitkeep | 1 + .../Program.cs | 41 +++++++++++++++++++ 4 files changed, 87 insertions(+) create mode 100644 Paragraphs/Create_clickable_highlighted_text/.NET/Create-clickable-highlighted-text.sln create mode 100644 Paragraphs/Create_clickable_highlighted_text/.NET/Create-clickable-highlighted-text/Create-clickable-highlighted-text.csproj create mode 100644 Paragraphs/Create_clickable_highlighted_text/.NET/Create-clickable-highlighted-text/Output/.gitkeep create mode 100644 Paragraphs/Create_clickable_highlighted_text/.NET/Create-clickable-highlighted-text/Program.cs diff --git a/Paragraphs/Create_clickable_highlighted_text/.NET/Create-clickable-highlighted-text.sln b/Paragraphs/Create_clickable_highlighted_text/.NET/Create-clickable-highlighted-text.sln new file mode 100644 index 000000000..37e70e340 --- /dev/null +++ b/Paragraphs/Create_clickable_highlighted_text/.NET/Create-clickable-highlighted-text.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-clickable-highlighted-text", "Create-clickable-highlighted-text\Create-clickable-highlighted-text.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_clickable_highlighted_text/.NET/Create-clickable-highlighted-text/Create-clickable-highlighted-text.csproj b/Paragraphs/Create_clickable_highlighted_text/.NET/Create-clickable-highlighted-text/Create-clickable-highlighted-text.csproj new file mode 100644 index 000000000..fd83762f1 --- /dev/null +++ b/Paragraphs/Create_clickable_highlighted_text/.NET/Create-clickable-highlighted-text/Create-clickable-highlighted-text.csproj @@ -0,0 +1,20 @@ + + + + Exe + net8.0 + Create_clickable_highlighted_text + enable + enable + + + + + + + + + Always + + + diff --git a/Paragraphs/Create_clickable_highlighted_text/.NET/Create-clickable-highlighted-text/Output/.gitkeep b/Paragraphs/Create_clickable_highlighted_text/.NET/Create-clickable-highlighted-text/Output/.gitkeep new file mode 100644 index 000000000..5f282702b --- /dev/null +++ b/Paragraphs/Create_clickable_highlighted_text/.NET/Create-clickable-highlighted-text/Output/.gitkeep @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Paragraphs/Create_clickable_highlighted_text/.NET/Create-clickable-highlighted-text/Program.cs b/Paragraphs/Create_clickable_highlighted_text/.NET/Create-clickable-highlighted-text/Program.cs new file mode 100644 index 000000000..79438b266 --- /dev/null +++ b/Paragraphs/Create_clickable_highlighted_text/.NET/Create-clickable-highlighted-text/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); + } + } + } + } +} From cc6c5d6d3da18bd08683055271d4785bb2c3cfec Mon Sep 17 00:00:00 2001 From: SushmaSF4796 Date: Mon, 24 Aug 2026 18:16:40 +0530 Subject: [PATCH 2/2] Added changes --- .../Program.cs | 83 +++++++++++-------- 1 file changed, 47 insertions(+), 36 deletions(-) diff --git a/Paragraphs/Create_clickable_highlighted_text/.NET/Create-clickable-highlighted-text/Program.cs b/Paragraphs/Create_clickable_highlighted_text/.NET/Create-clickable-highlighted-text/Program.cs index 79438b266..fc581d239 100644 --- a/Paragraphs/Create_clickable_highlighted_text/.NET/Create-clickable-highlighted-text/Program.cs +++ b/Paragraphs/Create_clickable_highlighted_text/.NET/Create-clickable-highlighted-text/Program.cs @@ -1,41 +1,52 @@ using Syncfusion.DocIO; using Syncfusion.DocIO.DLS; +using Syncfusion.Drawing; -namespace Create_list_with_hanging_indent +WordDocument document = new WordDocument(); +IWSection section = document.AddSection(); + +// Paragraph containing highlighted hyperlink word +IWParagraph para = section.AddParagraph(); + +para.AppendText("For detailed information, refer to "); + +IWField hyperlink = para.AppendHyperlink( + "Section5", // Bookmark name + "Section 5", // Display text + HyperlinkType.Bookmark); + + +WTextRange textRange = hyperlink.OwnerParagraph.ChildEntities[ + hyperlink.OwnerParagraph.ChildEntities.Count - 2] as WTextRange; + +if (textRange != null) +{ + textRange.CharacterFormat.HighlightColor = Color.Yellow; +} + +para.AppendText(" in this document."); + +//Add some content before destination +for (int i = 0; i < 5; i++) { - 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); - } - } - } - } + para = section.AddParagraph(); + para.AppendBookmarkStart($"Section{i}"); + para.AppendText($"Sample paragraph {i + 1}"); + para.AppendBookmarkEnd($"Section{i}"); } + +// Bookmark destination +IWParagraph destinationPara = section.AddParagraph(); + +//Bookmark start +destinationPara.AppendBookmarkStart("Section5"); + +//Destination content +destinationPara.AppendText("Section 5 - Detailed Information"); + +//Bookmark end +destinationPara.AppendBookmarkEnd("Section5"); +section.AddParagraph().AppendText("End"); +//Save document +document.Save(@"../../../Output/Output.docx", FormatType.Docx); +document.Close(); \ No newline at end of file