Skip to content
本页内容

Position (属性)

返回或设置一个 int 值,它代表当前正在显示数据项时,该数据项字段中数据项的位置。

示例

python
#此示例显示包含活动单元格的数据透视表项的位置数字
def test():
    Worksheets.Item("Sheet1").Activate()
    print("The active item is in position number " + ActiveCell.PivotItem.Position)
python
#本示例将工作表 Sheet1 中第一张数据透视表的字段“name”的数据项“张三”的位置设置为第一个
def test():
    pvtItem = Worksheets.Item("Sheet1").PivotTables(1).PivotFields("name").PivotItems("张三")
    pvtItem.Position = 1