Skip to content

Commit bf68006

Browse files
Modified
1 parent fe9f063 commit bf68006

1 file changed

Lines changed: 5 additions & 11 deletions

File tree

Fields/Apply_Characterformat_for_Hyperlink/.NET/Apply_Characterformat_for_Hyperlink/Program.cs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@ static void Main(string[] args)
1717
// Appends a hyperlink to the last paragraph of the document
1818
string linkUri = "https://www.syncfusion.com";
1919
IWField field = document.LastParagraph.AppendHyperlink(linkUri, "Syncfusion", HyperlinkType.WebLink);
20-
// Character format for hyperlink
21-
bool isItalic = false;
22-
bool isUnderline = true;
23-
bool isStrikeout = false;
24-
bool isBold = false;
25-
float fontSize = 12;
2620
//Format hyperlink
2721
IEntity entity = field;
2822
//Iterates to sibling items until Field End
@@ -33,12 +27,12 @@ static void Main(string[] args)
3327
WTextRange textRange = entity as WTextRange;
3428
//Apply character format for text ranges
3529
textRange.CharacterFormat.FontName = "Verdana";
36-
textRange.CharacterFormat.FontSize = fontSize;
30+
textRange.CharacterFormat.FontSize = 12;
3731
textRange.CharacterFormat.TextColor = Color.Red;
38-
textRange.CharacterFormat.Bold = isBold;
39-
textRange.CharacterFormat.Italic = isItalic;
40-
textRange.CharacterFormat.UnderlineStyle = isUnderline ? UnderlineStyle.Single : UnderlineStyle.None;
41-
textRange.CharacterFormat.Strikeout = isStrikeout;
32+
textRange.CharacterFormat.Bold = false;
33+
textRange.CharacterFormat.Italic = false;
34+
textRange.CharacterFormat.UnderlineStyle = UnderlineStyle.Single;
35+
textRange.CharacterFormat.Strikeout = false;
4236
}
4337
else if ((entity is WFieldMark) && (entity as WFieldMark).Type == FieldMarkType.FieldEnd)
4438
break;

0 commit comments

Comments
 (0)