WPS 加载项开发 > 文字 API 参考 > Range > 方法 > Range.ComputeStatistics 方法
返回一个 Long 类型的值,该值代表基于指定范围内容的统计值。

语法

表达式.ComputeStatistics(Statistic)

表达式   必选。一个代表 Range 对象的变量。

参数

名称 必选/可选 数据类型 说明
Statistic 必选 WdStatistic 要计算的统计值的类型。

说明

由于您选择或安装的语言支持不同(例如美国英语),上述部分常量可能无法使用。

示例

本示例显示 Report.doc 第一段中的字数和字符数。

示例代码
let myRange = Documents.Item("Report.doc").Paragraphs.Item(1).Range
let wordCount = myRange.ComputeStatistics(wdStatisticWords)
let charCount = myRange.ComputeStatistics(wdStatisticCharacters)
MsgBox("The first paragraph contains " + wordCount + " words and a total of " + charCount + " characters.")


请参阅