在word文档表中搜索

时间:2016-08-03 17:07:40

标签: powershell

$SearchString = "Table Text"
$regex = [Regex]::Match($PgContent.Text, $SearchString) 
if($regex.Success)
{
    $finalName = $fileDoc.Name
    $Selection = $word.Selection
    $finalDoc.ActiveWindow.ActivePane.View.SeekView = 1
    $path = $outputPath + "TableText_" + $i + "_" + $finalName
    $finalDoc.saveas([ref]$path)
    $finalDoc.close()
}
else
{
    'ignores the content
}

这部分代码是在将文档拆分为单独的页面后寻找搜索字符串的地方。如果找到搜索字符串,则保存该页面,否则删除该页面。该代码适用于不在Word文档中表格的文本。我是否需要在PowerShell中做一些特殊的事情来搜索表格文本?

1 个答案:

答案 0 :(得分:0)

橡皮鸭终于找到了故障:搜索词实际上是不正确的(根据OP的评论)。

相关问题