如何使用 Powershell 在 Word 中添加带有超链接的文本

问题描述 投票:0回答:1

我需要一个简单的例子来说明如何在word中添加新文本并将该文本更改为超链接

你能帮我吗?

powershell ms-word
1个回答
0
投票
$word = New-Object -ComObject Word.Application
$word.visible = $true
$document = $word.Documents.Add()          
$document.Activate()

$range = $document.content
$null = $document.HyperLinks.Add($Range, 
'https://www.google.com/',$null,$null,'This is Google')

谢谢

© www.soinside.com 2019 - 2024. All rights reserved.