WPS 加载项开发 > 表格 API 参考 > PivotField > 属性 > PivotField.AutoShowRange 属性
如果指定数据透视表字段中自动显示首项,则返回 xlTop;如果自动显示末项,则返回 xlBottomLong 类型,只读。

语法

表达式.AutoShowRange

表达式   一个代表 PivotField 对象的变量。

示例

本示例在消息框中显示“Salesman”字段的 AutoShow 参数值。

示例代码
let pi = Worksheets.Item(1).PivotTables(1).PivotFields("salesman")
if(pi.AutoShowType == xlAutomatic){
    let rn
    let r = pi.AutoShowRange
    if(r == xlTop){
        rn = "top"
    }
    else{
        rn = "bottom"
    }
    MsgBox("PivotTable report is showing " + rn + " " + pi.AutoShowCount + " items in " + pi.Name + " field by " + pi.AutoShowField)
}
else{
    MsgBox("PivotTable report is not using AutoShow for this field")
}


请参阅