Skip to content
本页内容

PivotLines (对象)

PivotLines 对象是数据透视表中线条的集合,其中包含数据透视表中行或列上的所有线条。每个线条都是一组 PivotCells。

示例

python
#本示例显示活动工作表上数据透视表中行轴上第一条数据透视线的PivotLineCells属性第二个PivotCell对应数据透视表项的名称
def test():
    pvtLine = ActiveSheet.Range("I1").PivotTable.PivotRowAxis.PivotLines.Item(1)
    print(pvtLine.PivotLineCells.Item(2).PivotItem.Name)
python
#本示例显示活动工作表上数据透视表中列轴上数据透视线数量
def test():
    pvtLines = ActiveSheet.Range("I1").PivotTable.PivotColumnAxis.PivotLines
    print(f"列轴上数据透视线的数量:{pvtLines.Count}")