Freigeben über


[Windows PowerShell] PowerPoint プレゼンテーションを XPS, PDF に保存する

??2??????PowerPoint ???? PDF ? XPS ??????????????????????? PowerPoint 2007 ???[Office ???] - [????????] - [PDF ??? XPS] ???????????????

????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

????????????????????????????? (filename.pptx ??) ????filename.pdf ? filename.xps ?????????????????????????????

param([string]$pptx)
$ppfile = dir $pptx

?? PowerPoint ? COM ???????????Visible ?????????????????????

$ppapp = new-object -com powerpoint.application
$ppapp.visible =
[Microsoft.Office.Core.MsoTriState]::MsoTrue
$ppdoc = $ppapp.Presentations.Open($ppfile.fullname)

???PowerPoint ??????????????? MSDN ?????????

PowerPoint Object Model Reference (??)
https://msdn.microsoft.com/en-us/library/bb265987.aspx

??????????????????

$pptypepdf = [Microsoft.Office.Interop.PowerPoint.
PpSaveAsFileType]::PpSaveAsPDF
$pptypexps = [Microsoft.Office.Interop.PowerPoint.
PpSaveAsFileType]::PpSaveAsXPS

$filenamepdf =
[IO.Path]::ChangeExtension($ppfile.FullName, ".pdf")
$filenamexps =
[IO.Path]::ChangeExtension($ppfile.FullName, ".xps")

$ppdoc.SaveAs($filenamepdf, $pptypepdf)
$ppdoc.SaveAs($filenamexps, $pptypexps)

???????????System.Io.Path ? ChangeExtensioin ?????????????Presentation.SaveAs ???????????????????????????????????? PDF ? XPS ?????????Presentation.ExportAsFixedFormat ??????????????????????????

???????????????

$ppdoc.close()
$ppapp.quit()

???????????????????????? HTML ??????????????SkyDrive ? API ??????????????????????????????

???CodePlex ???????? PowerShell Eventing ??????????????????? ppt, pptx ?????????????????? pdf, xps ?????????????????????????