开发者

Invalid word list returned by Word

开发者 https://www.devze.com 2023-02-17 01:45 出处:网络
In an Word addin, I\'m using this.Application.ActiveDocument.Words; to get a list of all the words in the curret document. Now when I parse this list, I found the ,, . and \\r are also in this list

In an Word addin, I'm using

this.Application.ActiveDocument.Words;

to get a list of all the words in the curret document. Now when I parse this list, I found the ,, . and \r are also in this list. Why is Word considering these words?开发者_开发百科 I also looked at the word count in the status bar and that was wrong too, as for 7 words in my document the status bar shows 9 words.


Looks like it's a feature.

from: here

Note Punctuation and paragraph marks in a document are included in the Words collection.

also found:

If SingleWord < "A" Or SingleWord > "z" Then SingleWord = "" 'Out of range?

here

which says to me you can exclude punctuation from your set by testing for 'words' less than A or greater than z.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号