在Powershell中对文档的内容进行拼写检查

时间:2018-10-12 11:05:10

标签: powershell powershell-v3.0

我通过使用Powershell脚本读取文件内容来添加拼写检查吗?

此脚本可以完成我的工作,但是我想检查是否有任何外部软件包或模块可用于该外部软件包或模块,因为这样会使工作变得更容易。

$file = Get-ChildItem ./Code-Duplication/master.md
$Proofread_text = Get-Content $file.FullName
$Word = New-Object -COM Word.Application
$Document = $Word.Documents.Add()
$Textrange = $Document.Range(0)

#$english = FindLanguage("English (US)")

#$Textrange.LanguageID = $english.ID
$Textrange.InsertAfter($Proofread_text)

<#Handle misspelled words here#>
$file.Name
Write-Output "---------------"
foreach($spell_error in $textrange.SpellingErrors){
    Write-Host $spell_error.Text
}

$Document.Close(0)
$Word.Quit()

0 个答案:

没有答案