FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

1049516 - How to Create Clickable Highlighted Text in a Word Document by SushmaSF4796 · Pull Request #596 · SyncfusionExamples/DocIO-Examples · GitHub

Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .cs  (1) .csproj  (1) .sln  (1) dotfile  (1) All 4 file types selected
Only manifest files
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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-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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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_clickable_highlighted_text</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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -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();
Loading

Back | FazBrowse Home | New Git URL