Skip to content

Commit

Permalink
Merge pull request #93 from EvotecIT/Hyper
Browse files Browse the repository at this point in the history
  • Loading branch information
PrzemyslawKlys authored Jan 9, 2023
2 parents f55e6bd + c83d465 commit 89c535f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal static void Example_BasicWordWithHyperLinks(string folderPath, bool ope
Console.WriteLine(document.Sections[0].ParagraphsHyperLinks.Count);
Console.WriteLine(document.ParagraphsHyperLinks.Count);
Console.WriteLine(document.Sections[0].HyperLinks.Count);
document.AddParagraph("Test HYPERLINK ").AddHyperLink(" to website?", new Uri("https://evotec.xyz"));
document.AddParagraph("Test HYPERLINK ").AddHyperLink(" to website?", new Uri("https://evotec.xyz"), true);

document.AddParagraph("Test Email Address ").AddHyperLink("Przemysław Klys", new Uri("mailto:kontakt@evotec.pl?subject=Test Subject"));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand All @@ -14,6 +14,7 @@ public static void EasyExample(string folderPath, bool openWord) {

using (WordDocument document = WordDocument.Create(filePath)) {
var para = document.AddHyperLink("Test", new Uri("https://evotec.xyz"));
var para1 = document.AddHyperLink("Test", new Uri("https://evotec.xyz"), addStyle: true);

document.Save(openWord);
Console.WriteLine("IsValid: " + document.DocumentIsValid);
Expand Down
12 changes: 6 additions & 6 deletions OfficeIMO.Word/WordHyperLink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,12 @@ public static WordParagraph AddHyperLink(WordParagraph paragraph, string text, U

// Styling for the hyperlink
if (addStyle) {
//RunProperties runPropertiesHyperLink = new RunProperties(
// new RunStyle { Val = "Hyperlink", }
// //new Underline { Val = UnderlineValues.Single }
// //new Color { ThemeColor = ThemeColorValues.Hyperlink }
//);
//run.RunProperties = runPropertiesHyperLink;
RunProperties runPropertiesHyperLink = new RunProperties(
new RunStyle { Val = "Hyperlink", },
new Color { ThemeColor = ThemeColorValues.Hyperlink, Val = "0000FF" },
new Underline { Val = UnderlineValues.Single }
);
run.RunProperties = runPropertiesHyperLink;
}

if (tooltip != "") {
Expand Down

0 comments on commit 89c535f

Please sign in to comment.