[]
Gets or sets the display caption override for the PivotItem. A null value clears the override.
string Caption { get; set; }
Property Caption As String
Workbook workbook = new Workbook();
IWorksheet worksheet = workbook.Worksheets[0];
worksheet.Range["A1:C5"].Value = new object[,]
{
{ "Product", "Region", "Amount" },
{ "Apple", "East", 10 },
{ "Banana", "West", 20 },
{ "Carrot", "East", 30 },
{ "Date", "West", 40 }
};
IPivotCache pivotCache = workbook.PivotCaches.Create(worksheet.Range["A1:C5"]);
IPivotTable pivotTable = worksheet.PivotTables.Add(pivotCache, worksheet.Range["E1"], "PivotTable1");
pivotTable.PivotFields["Product"].Orientation = PivotFieldOrientation.RowField;
pivotTable.PivotFields["Amount"].Orientation = PivotFieldOrientation.DataField;
IPivotItem item = pivotTable.PivotFields["Product"].PivotItems["Apple"];
item.Caption = "Fresh Apple";
string caption = item.Caption;