0

vb.net コードを使用してピボット テーブルを作成しました

    pivotField1 = pivotTable.PivotFields(14)
    pivotField2 = pivotTable.PivotFields(15)
    pivotField3 = pivotTable.PivotFields(16)
    pivotField4 = pivotTable.PivotFields(17)
    pivotField5 = pivotTable.PivotFields(18)

    pivotField1.Orientation = XlPivotFieldOrientation.xlDataField
    pivotField2.Orientation = XlPivotFieldOrientation.xlDataField
    pivotField3.Orientation = XlPivotFieldOrientation.xlDataField
    pivotField4.Orientation = XlPivotFieldOrientation.xlDataField
    pivotField5.Orientation = XlPivotFieldOrientation.xlDataField
    pivotField1.Function = XlConsolidationFunction.xlSum
    pivotField2.Function = XlConsolidationFunction.xlSum
    pivotField3.Function = XlConsolidationFunction.xlSum
    pivotField4.Function = XlConsolidationFunction.xlSum
    pivotField5.Function = XlConsolidationFunction.xlSum

しかし、RowlableのSum-Valueとしてピボットテーブルに表示されますが、ColumnLabelにしたいので助けてください....

4

1 に答える 1

0

これを使用してください...役立つかもしれません:)

Dim ptSigmaRow As PivotField
For Each ptSigmaRow In ptTable.RowFields
    Dim d As String = ptSigmaRow.Name
    If ptSigmaRow.Name = "Data" Then
         ptSigmaRow.Orientation = XlPivotFieldOrientation.xlColumnField
    End If
Next
于 2013-02-27T11:41:32.747 に答える