-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
af0e9a1
commit dd30d63
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,30 @@ | ||
# This is just a show what can be quickly done using .NET before I get to do it's PowerShell version | ||
|
||
Clear-Host | ||
Import-Module .\PSWriteOffice.psd1 -Force | ||
|
||
$Document = New-OfficeWord -FilePath $PSScriptRoot\Documents\BasicDocumentWithHyperlinks.docx | ||
$Document.BuiltinDocumentProperties.Title = "This is title" | ||
$Document.BuiltinDocumentProperties.Subject = "This is subject aka subtitle" | ||
|
||
$null = $Document.AddHyperLink("Google", [uri] "https://www.google.com") | ||
|
||
$Null = $Document.AddHyperLink("Evotec", [uri] "https://evotec.xyz", $true, "Tooltip for hyperlink", $false) | ||
|
||
|
||
$Document.HyperLinks.Count | ||
|
||
foreach ($HyperLink in $Document.HyperLinks) { | ||
if ($HyperLink.IsEmail) { | ||
Write-Host -Object "Email: $($HyperLink.EmailAddress)" | ||
} elseif ($HyperLink.IsHttp) { | ||
Write-Host -Object "URL: $($HyperLink.Uri)" | ||
} else { | ||
Write-Host -Object "Text: $($HyperLink.Text)" | ||
} | ||
# display properties of hyerlink | ||
$HyperLink | Format-Table | ||
|
||
} | ||
|
||
Save-OfficeWord -Document $Document -Show |