[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.IPivotField.BaseItem

BaseItem Property

BaseItem

Gets or sets the item in the base field for a custom calculation.

This property is valid only for data fields. Use this property together with BaseField and Calculation to determine which item in the base field is used by a custom calculation such as PercentOf.

Declaration
string BaseItem { get; set; }
Property BaseItem As String
Examples
object[,] sourceData = {
    {"Product", "Country", "Amount"},
    {"Bike", "Australia", 100},
    {"Bike", "Canada", 80}
};
worksheet.Range["A1:C3"].Value = sourceData;
IPivotCache pivotCache = workbook.PivotCaches.Create(worksheet.Range["A1:C3"]);
IPivotTable pivotTable = worksheet.PivotTables.Add(pivotCache, worksheet.Range["E1"]);
pivotTable.PivotFields["Product"].Orientation = PivotFieldOrientation.RowField;
pivotTable.PivotFields["Country"].Orientation = PivotFieldOrientation.ColumnField;
pivotTable.PivotFields["Amount"].Orientation = PivotFieldOrientation.DataField;
IPivotField dataField = pivotTable.DataFields["Sum of Amount"];
dataField.Calculation = PivotFieldCalculation.PercentOf;
dataField.BaseField = "Country";
dataField.BaseItem = "Australia";
string baseItem = dataField.BaseItem;