机械原理前四章重写为在学练习模式(20-23:盘点+点文件+速查卡+旧版快照);新增803真正的考点大纲与重写规范;同步14-16章修改
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
param(
|
||||
[Parameter(Mandatory=$true)][string]$Src,
|
||||
[Parameter(Mandatory=$true)][string]$Out
|
||||
)
|
||||
# Convert .ppt (legacy) to .pptx via PowerPoint COM, then quit.
|
||||
# Usage: powershell -File convert_ppt.ps1 -Src "D:\...\xxx.ppt" -Out "D:\...\xxx.pptx"
|
||||
# Never modifies the source file (opened ReadOnly). Output format 24 = ppSaveAsOpenXMLPresentation.
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$ppt = $null
|
||||
$pres = $null
|
||||
try {
|
||||
$ppt = New-Object -ComObject PowerPoint.Application
|
||||
$pres = $ppt.Presentations.Open($Src, $true, $false, $false)
|
||||
$pres.SaveAs($Out, 24)
|
||||
$pres.Close()
|
||||
Write-Output ("OK: " + $Out)
|
||||
} catch {
|
||||
Write-Error ("Convert failed: " + $_.Exception.Message)
|
||||
exit 1
|
||||
} finally {
|
||||
if ($null -ne $pres) { try { $pres.Close() } catch {} }
|
||||
if ($null -ne $ppt) { try { $ppt.Quit() } catch {} }
|
||||
if ($null -ne $pres) { try { [void][System.Runtime.InteropServices.Marshal]::ReleaseComObject($pres) } catch {} }
|
||||
if ($null -ne $ppt) { try { [void][System.Runtime.InteropServices.Marshal]::ReleaseComObject($ppt) } catch {} }
|
||||
[GC]::Collect(); [GC]::WaitForPendingFinalizers()
|
||||
}
|
||||
Reference in New Issue
Block a user