From fe9f063c65a76edd36ac7e92056d05efdfb2b92c Mon Sep 17 00:00:00 2001 From: GOPINATHSF4767 Date: Wed, 13 May 2026 13:50:37 +0530 Subject: [PATCH] Added sample --- .../Apply_Characterformat_for_Hyperlink.sln | 25 ++++++++ ...Apply_Characterformat_for_Hyperlink.csproj | 20 ++++++ .../Output/Result.docx | Bin 0 -> 5505 bytes .../Output/gitkeep.txt | 1 + .../Program.cs | 57 ++++++++++++++++++ 5 files changed, 103 insertions(+) create mode 100644 Fields/Apply_Characterformat_for_Hyperlink/.NET/Apply_Characterformat_for_Hyperlink.sln create mode 100644 Fields/Apply_Characterformat_for_Hyperlink/.NET/Apply_Characterformat_for_Hyperlink/Apply_Characterformat_for_Hyperlink.csproj create mode 100644 Fields/Apply_Characterformat_for_Hyperlink/.NET/Apply_Characterformat_for_Hyperlink/Output/Result.docx create mode 100644 Fields/Apply_Characterformat_for_Hyperlink/.NET/Apply_Characterformat_for_Hyperlink/Output/gitkeep.txt create mode 100644 Fields/Apply_Characterformat_for_Hyperlink/.NET/Apply_Characterformat_for_Hyperlink/Program.cs diff --git a/Fields/Apply_Characterformat_for_Hyperlink/.NET/Apply_Characterformat_for_Hyperlink.sln b/Fields/Apply_Characterformat_for_Hyperlink/.NET/Apply_Characterformat_for_Hyperlink.sln new file mode 100644 index 000000000..d6cc12291 --- /dev/null +++ b/Fields/Apply_Characterformat_for_Hyperlink/.NET/Apply_Characterformat_for_Hyperlink.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.14.37216.2 d17.14 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apply_Characterformat_for_Hyperlink", "Apply_Characterformat_for_Hyperlink\Apply_Characterformat_for_Hyperlink.csproj", "{61A4F7A7-571E-2042-E82C-0B351C92C7E4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {61A4F7A7-571E-2042-E82C-0B351C92C7E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {61A4F7A7-571E-2042-E82C-0B351C92C7E4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {61A4F7A7-571E-2042-E82C-0B351C92C7E4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {61A4F7A7-571E-2042-E82C-0B351C92C7E4}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3F08D4D1-1A99-462D-9B46-44C9EE3AAA13} + EndGlobalSection +EndGlobal diff --git a/Fields/Apply_Characterformat_for_Hyperlink/.NET/Apply_Characterformat_for_Hyperlink/Apply_Characterformat_for_Hyperlink.csproj b/Fields/Apply_Characterformat_for_Hyperlink/.NET/Apply_Characterformat_for_Hyperlink/Apply_Characterformat_for_Hyperlink.csproj new file mode 100644 index 000000000..38b8e1e03 --- /dev/null +++ b/Fields/Apply_Characterformat_for_Hyperlink/.NET/Apply_Characterformat_for_Hyperlink/Apply_Characterformat_for_Hyperlink.csproj @@ -0,0 +1,20 @@ + + + + Exe + net8.0 + enable + enable + + + + + + + + + Always + + + + diff --git a/Fields/Apply_Characterformat_for_Hyperlink/.NET/Apply_Characterformat_for_Hyperlink/Output/Result.docx b/Fields/Apply_Characterformat_for_Hyperlink/.NET/Apply_Characterformat_for_Hyperlink/Output/Result.docx new file mode 100644 index 0000000000000000000000000000000000000000..a461b893320cbd17dc5459576c9ec2ccf696c2ff GIT binary patch literal 5505 zcmaJ_2Q*ym+8rh%I?)qCbkTc=61@{G1kr{;^v-B8m{BItMGc}v9imI3Gir1}h~6T4 zltlk0-*@lLcipW2%vxvGI%nwa6$mOtJB0vAQ9MyREb8nrwVx>zBf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q@t2Vp)90Dy=2 NJ;3xb?q8Ax{2%p4nqvR} literal 0 HcmV?d00001 diff --git a/Fields/Apply_Characterformat_for_Hyperlink/.NET/Apply_Characterformat_for_Hyperlink/Output/gitkeep.txt b/Fields/Apply_Characterformat_for_Hyperlink/.NET/Apply_Characterformat_for_Hyperlink/Output/gitkeep.txt new file mode 100644 index 000000000..5f282702b --- /dev/null +++ b/Fields/Apply_Characterformat_for_Hyperlink/.NET/Apply_Characterformat_for_Hyperlink/Output/gitkeep.txt @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Fields/Apply_Characterformat_for_Hyperlink/.NET/Apply_Characterformat_for_Hyperlink/Program.cs b/Fields/Apply_Characterformat_for_Hyperlink/.NET/Apply_Characterformat_for_Hyperlink/Program.cs new file mode 100644 index 000000000..af52d51d8 --- /dev/null +++ b/Fields/Apply_Characterformat_for_Hyperlink/.NET/Apply_Characterformat_for_Hyperlink/Program.cs @@ -0,0 +1,57 @@ +using Syncfusion.DocIO; +using Syncfusion.DocIO.DLS; +using Syncfusion.Drawing; + +namespace Apply_Characterformat_for_Hyperlink +{ + class Program + { + + static void Main(string[] args) + { + //Creates a new Word document + using (WordDocument document = new WordDocument()) + { + //Adds one section and one paragraph to the document + document.EnsureMinimal(); + // Appends a hyperlink to the last paragraph of the document + string linkUri = "https://www.syncfusion.com"; + IWField field = document.LastParagraph.AppendHyperlink(linkUri, "Syncfusion", HyperlinkType.WebLink); + // Character format for hyperlink + bool isItalic = false; + bool isUnderline = true; + bool isStrikeout = false; + bool isBold = false; + float fontSize = 12; + //Format hyperlink + IEntity entity = field; + //Iterates to sibling items until Field End + while (entity.NextSibling != null) + { + if (entity is WTextRange) + { + WTextRange textRange = entity as WTextRange; + //Apply character format for text ranges + textRange.CharacterFormat.FontName = "Verdana"; + textRange.CharacterFormat.FontSize = fontSize; + textRange.CharacterFormat.TextColor = Color.Red; + textRange.CharacterFormat.Bold = isBold; + textRange.CharacterFormat.Italic = isItalic; + textRange.CharacterFormat.UnderlineStyle = isUnderline ? UnderlineStyle.Single : UnderlineStyle.None; + textRange.CharacterFormat.Strikeout = isStrikeout; + } + else if ((entity is WFieldMark) && (entity as WFieldMark).Type == FieldMarkType.FieldEnd) + break; + //Gets next sibling item. + entity = entity.NextSibling; + } + + //Saves the Word document to the file stream. + using (FileStream outputStream = new FileStream(Path.GetFullPath(@"Output/Result.docx"), FileMode.Create, FileAccess.ReadWrite)) + { + document.Save(outputStream, FormatType.Docx); + } + } + } + } +}