[]
Represents a line of rows or columns in a PivotTable.
An IPivotLine belongs to a row or column axis and groups the
IPivotCell objects that make up a single logical line in the PivotTable.
Use this interface to inspect the line type, access the cells in the line, and
determine the line position within the axis.
public interface IPivotLine
Public Interface IPivotLine
object[,] sourceData = {
{"Category", "Product", "Amount"},
{"Fruit", "Apple", 100},
{"Fruit", "Pear", 80},
{"Drink", "Tea", 60}
};
worksheet.Range["G1:I4"].Value = sourceData;
IPivotCache pivotCache = workbook.PivotCaches.Create(worksheet.Range["G1:I4"]);
IPivotTable pivotTable = worksheet.PivotTables.Add(pivotCache, worksheet.Range["A1"], "Sales");
pivotTable.PivotFields["Category"].Orientation = PivotFieldOrientation.RowField;
pivotTable.PivotFields["Amount"].Orientation = PivotFieldOrientation.DataField;
IPivotLine pivotLine = pivotTable.PivotRowAxis.PivotLines[0];
PivotLineType lineType = pivotLine.LineType;
| Name | Description |
|---|---|
| LineType | Gets the type of this PivotLine. |
| PivotLineCells | Gets the collection of pivot cells in this pivot line. Use this property to access the IPivotCell objects that belong to the current row or column line in a PivotTable axis. |
| Position | Gets the position of this PivotLine in its parent PivotLines collection. The returned value is the zero-based index of the PivotLine within the row or column axis that contains it. |