更新时间:2023-02-08 09:33:43
第二,类似这样的工作应该可以工作
Second, something like this should work
for each p in Doc.Content.Paragraphs
if (p.Range.End - p.Range.Start) > 1 then (The paragraph is not empty)
Next
您可能需要1数字,因为我不记得Word设置开始和结束点,空段落从开始到结束可能是2个字符长,而不只是一个。
You may need to play with that "1" number, because I can't recall where Word sets the start and end points, empty paragraphs may be 2 chars long from start to end, not just one.
您也可以执行
p.Range.Sentences.Count > 0
或
p.Range.Characters.Count > 0
但这些技巧通常比检查开始和结束位置要慢。
But those techniques are typically slower than checking the start and end positions.