Change font of a hyperlink

Welcome Forums General PowerShell Q&A Change font of a hyperlink

This topic contains 3 replies, has 2 voices, and was last updated by

 
Participant
2 years, 10 months ago.

  • Author
    Posts
  • #37721

    Participant
    Points: 0
    Rank: Member

    Hello Everyone,

    I insert a hyperlink in a Word file via Powershell. See code below:

    $doc.Hyperlinks.Add($selection.Range,"$SiteUrl",'',"$SiteWeb","$SiteWeb")

    But I have a little problem, the hyperlink takes a different font and size as the rest of the text that I insert the word file ...
    Do you know how I can do please?
    Thank you !

  • #37739

    Participant
    Points: 26
    Rank: Member

    Hi Florian, I've seen now two posts from you regarding manipulating word documents. I suggest you to look into these projects. They require however knowledge about programming, but with these projects you are able to manipulate docx contents in great depth.

    https://github.com/OfficeDev/Open-XML-SDK
    https://github.com/OfficeDev/Open-Xml-PowerTools

  • #37740

    Participant
    Points: 0
    Rank: Member

    Hi Richard,

    Thank you for the two links.

    I'll take a look, I have some experience in programming so it will have to go.

    Nevertheless, this is the last point I have to finish my script. After that I will have certainnement need to work in it.

    So if by chance someone knows the solution to change the font and size of a hyperlink in a word, let me know!

    Florian

  • #38050

    Participant
    Points: 0
    Rank: Member

    Solved !

    $hlink = $doc.Hyperlinks.Add($selection.Range,"$SiteUrlB",'',"$SiteWebB","$SiteWebB")
        $hlink.Range.Font.Name = 'SFR Light'
        $hlink.Range.Font.Size = 10

The topic ‘Change font of a hyperlink’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort