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..6dc6cdfa7 --- /dev/null +++ b/Paragraphs/Create_clickable_highlighted_text/.NET/Create-clickable-highlighted-text/Program.cs @@ -0,0 +1,57 @@ +using Syncfusion.DocIO; +using Syncfusion.DocIO.DLS; +using Syncfusion.Drawing; + +//Create a new Word document +WordDocument document = new WordDocument(); + +// Add a section +IWSection section = document.AddSection(); + +// Add introductory paragraph +IWParagraph para = section.AddParagraph(); +para.AppendText("Student Handbook\n\n"); +para.AppendText("For attendance rules, see "); + +// Add bookmark hyperlink +IWField hyperlink = para.AppendHyperlink("Attendance","Attendance Policy",HyperlinkType.Bookmark); + +// Highlight the hyperlink text +WTextRange textRange =hyperlink.OwnerParagraph.ChildEntities[hyperlink.OwnerParagraph.ChildEntities.Count - 2] as WTextRange; + +if (textRange != null) +{ + textRange.CharacterFormat.HighlightColor = Color.Yellow; +} + +para.AppendText("."); + +// Add some content before the destination +section.AddParagraph().AppendText("Student Code of Conduct"); +section.AddParagraph().AppendText("Examination Rules"); +section.AddParagraph().AppendText("Library Guidelines"); + +// Add bookmark destination +IWParagraph destination = section.AddParagraph(); +destination.AppendBookmarkStart("Attendance"); +destination.AppendText("Attendance Policy"); +destination.AppendBookmarkEnd("Attendance"); + +// Add attendance rules as bullet list +IWParagraph bullet1 = section.AddParagraph(); +bullet1.ListFormat.ApplyDefBulletStyle(); +bullet1.AppendText("Students must maintain at least 75% attendance."); + +IWParagraph bullet2 = section.AddParagraph(); +bullet2.ListFormat.ApplyDefBulletStyle(); +bullet2.AppendText("Students should attend all mandatory classes."); + +IWParagraph bullet3 = section.AddParagraph(); +bullet3.ListFormat.ApplyDefBulletStyle(); +bullet3.AppendText("Medical leave must be supported by valid documents."); + +// Save document +document.Save(@"../../../Output/Output.docx", FormatType.Docx); + +// Close document +document.Close(); \ No newline at end of file