Message-ID: <668786406.8163.1711635080207.JavaMail.web05$@web05> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_8162_1594648938.1711635080207" ------=_Part_8162_1594648938.1711635080207 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
ShowValueAs
properties of a PivotTable.=20
public SetShowValueAs(PivotTableField.ShowValue= AsType showValueAs, SourceField baseField, Int32 baseItemIndex)=20
public Function SetShowValueAs(ByVal showValueAs= As ShowValueAs.ShowValueAsType, ByVal baseField As SourceField, ByVal base= ItemIndex As Integer)=20
ExcelApplication xla =3D new ExcelApplication(); Workbook wb =3D xla.Open(@"C:\MySpr= eadsheet.xlsx"); Worksheet ws =3D wb.Worksheets[0]; PivotTable pt =3D ws.PivotTables[0]; DataField df =3D pt.DataFields[0]; df.SetShowValueAs(ShowValueAs.ShowValueA= sType.Difference, pt.SourceFields[0], 0);=20
Dim xla As New ExcelApplication() Dim wb As Workbook =3D xla.Open("C:= \MySpreadsheet.xlsx") Dim ws As Worksheet =3D wb.Worksheets(0) Dim pt As PivotTable =3D ws.PivotTables(0); Dim df As DataField =3D pt.DataFields(0) df.SetShowValueAs(ShowValueAs.ShowValueA= sType.Difference, pt.SourceFields(0), 0);=20
This property cannot be set on ValuesLabels. You can check if a PivotFie= ld is calculated field with the IsValuesLabel Property
This is the same as going to Value Field Settings > Show= values as.
When calling SetShowValueAs()
, certain ShowValueAsTypes use=
a source field as a base field and an index for one of the values in the d=
ata source column associated with the source field. The base field and valu=
e specified by the base item index are used to compute the values shown in =
the PivotTable.
Use ShowValueAs.BaseItemNext
and ShowValueAs.BaseItemPrevious=
to specify Next or Previous.