Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用Powershell在PowerPoint中创建超链接_Powershell_Hyperlink_Powerpoint - Fatal编程技术网

如何使用Powershell在PowerPoint中创建超链接

如何使用Powershell在PowerPoint中创建超链接,powershell,hyperlink,powerpoint,Powershell,Hyperlink,Powerpoint,我是powershell的新生。我正在为新的PowerPoint文件编写一些代码,并插入一些指向本地文件的超链接。但是没有可找到的示例代码。查找一个好的MS Office库,获取一些.NET代码示例并将它们重写为PuthScript脚本。@ MassZe您会考虑添加一些参考链接到您认为是好的MS Office Label.NET代码吗? If (test-path HKLM:SOFTWARE\Classes\PowerPoint.Application) { $powerPointFileNam

我是powershell的新生。我正在为新的PowerPoint文件编写一些代码,并插入一些指向本地文件的超链接。但是没有可找到的示例代码。

查找一个好的MS Office库,获取一些.NET代码示例并将它们重写为PuthScript脚本。@ MassZe您会考虑添加一些参考链接到您认为是好的MS Office Label.NET代码吗?
If (test-path HKLM:SOFTWARE\Classes\PowerPoint.Application) {
$powerPointFileName = "TestPowerPoint"
Write-Output "Microsoft PowerPoint installed. Start to create PowerPoint file:$powerPointFileName"
$PPT = New-Object -ComObject PowerPoint.Application
$PPT.Visible = [Microsoft.Office.Core.MsoTriState]::msoTrue
$slideType = "microsoft.office.interop.powerpoint.ppSlideLayout" -as [type]
$presentation = $PPT.Presentations.Add()
$newSlide = $presentation.Slides.add($presentation.Slides.Count + 1, 3)
$newSlide.Shapes.title.TextFrame.TextRange.Text ="Test Update Hyperlinks"
$newSlide.shapes.item(2).TextFrame.TextRange.Text = "Test Link 1"
$newSlide.shapes.item(2).TextFrame.TextRange.ActionSettings(1).Hyperlink.Address = "C:\readme.doc"
$newSlide.shapes.item(3).TextFrame.TextRange.Text = "Test Link 2"
$newSlide.shapes.item(3).TextFrame.TextRange.ActionSettings(1).Hyperlink.Address = "C:\test\readme.doc"

$presentation.SaveAs("C:\$powerPointFileName")
$presentation.Close()
$PPT.Quit()
$PPT = $null
Get-Process "PowerPNT" | Stop-Process -Force
[gc]::collect()
[gc]::WaitForPendingFinalizers()
} else {
Write-Output "No PowerPoint is installed. Cancel to create PowerPoint file."
}