Sets the ShowValueAs properties of a pivot table.

public SetShowValueAs(PivotTableField.ShowValueAsType showValueAs, SourceField baseField, Int32 baseItemIndex)
public Function SetShowValueAs(ByVal showValueAs As PivotTableField.ShowValueAsType, ByVal baseField As SourceField, ByVal baseItemIndex As Int32)

The type of ShowValueAs described by ShowValueAsType.

The base field for comparisons.

The index of the base item for comparisons

ExcelApplication xla = new ExcelApplication();
          Workbook wb = xla.Open(@"C:\MySpreadsheet.xlsx");
          Worksheet ws = wb.Worksheets[0];
          PivotTable pt = ws.PivotTables[0];
          DataField df = pt.DataFields[0];
          df.SetShowValueAs(PivotTableField.ShowValueAsType.Difference, pt.SourceFields[0], 0);
Dim xla As New ExcelApplication()
          Dim wb As Workbook = xla.Open("C:\MySpreadsheet.xlsx")
          Dim ws As Worksheet = wb.Worksheets(0)
          Dim pt As PivotTable = ws.PivotTables(0);
          Dim df As DataField = pt.DataFields(0)
          df.SetShowValueAs(PivotTableField.ShowValueAsType.Difference, pt.SourceFields(0), 0);