Represents the memory cache for a PivotTable report. The PivotCache object is a member of the PivotCaches collection.
For a list of all members of this type, see PivotCache Members.
System.Object
Aspose.Grid.Web.Data.PivotCache
Thread Safety
Public static (Shared in Visual Basic) members of this type are
safe for multithreaded operations. Instance members are not guaranteed to be
thread-safe.
Remarks
Uses the PivotCache method to return a PivotCache object for a PivotTable report (each report has only one cache). The source data of PivotCache come from WebWorksheet, DataTable, and so on.
Example
[C#]
//On the assumption that worksheet "Sheet1" has datas, then creates a PivotTable report base on it.
WebWorksheet sourceSheet = GridWeb1.WebWorksheets["Sheet1"];
Aspose.Grid.Web.Data.WebCellArea sourceRange = new WebCellArea();
sourceRange.StartRow = 0;
sourceRange.StartColumn = 0;
sourceRange.EndRow = 10;
sourceRange.EndColumn = 5;
PivotCache cache = GridWeb1.WebWorksheets.PivotCaches.Add(sourceSheet, sourceRange);
PivotTable table = cache.CreatePivotTable();
table.PivotFields[0].Orientation = PivotFieldOrientation.RowField;
table.PivotFields[1].Orientation = PivotFieldOrientation.RowField;
table.PivotFields[2].Orientation = PivotFieldOrientation.RowField;
table.PivotFields[3].Orientation = PivotFieldOrientation.ColumnField | PivotFieldOrientation.DataField;
table.PivotFields[4].Orientation = PivotFieldOrientation.ColumnField;
table.PivotFields[5].Orientation = PivotFieldOrientation.ColumnField | PivotFieldOrientation.DataField;
table.PivotFields[3].Function = PivotFieldFunction.Count;
table.PivotFields[5].Function = PivotFieldFunction.Sum;
table.DataBind();
//Creates a PivotTable report from DataView or DataTable.
DataView dataView;//Or DataTable dataTable;
.
.
.
Sets dataView(dataTable) Value
.
.
.
PivotCache cache = GridWeb1.WebWorksheets.PivotCaches.Add(dataView);
//Or PivotCache cache = GridWeb1.WebWorksheets.PivotCaches.Add(dataTable);
PivotTable table = cache.CreatePivotTable();
table = GridWeb1.WebWorksheets.PivotTables["PivotTable1"];
table.PivotFields[0].Orientation = PivotFieldOrientation.RowField;
table.PivotFields[1].Orientation = PivotFieldOrientation.RowField;
table.PivotFields[2].Orientation = PivotFieldOrientation.ColumnField | PivotFieldOrientation.DataField;
table.DataBind();
[VB]
'On the assumption that worksheet "Sheet1" has datas, then creates a PivotTable report base on it.
Dim sourceSheet As WebWorksheet = GridWeb1.WebWorksheets("Sheet1")
Dim sourceRange As Aspose.Grid.Web.Data.WebCellArea = New WebCellArea()/
sourceRange.StartRow = 0
sourceRange.StartColumn = 0
sourceRange.EndRow = 10
sourceRange.EndColumn = 5
Dim cache As PivotCache = GridWeb1.WebWorksheets.PivotCaches.Add(sourceSheet,sourceRange)
Dim table As PivotTable = cache.CreatePivotTable()
table.PivotFields(0).Orientation = PivotFieldOrientation.RowField
table.PivotFields(1).Orientation = PivotFieldOrientation.RowField
table.PivotFields(2).Orientation = PivotFieldOrientation.RowField
table.PivotFields(3).Orientation = PivotFieldOrientation.ColumnField | PivotFieldOrientation.DataField
table.PivotFields(4).Orientation = PivotFieldOrientation.ColumnField
table.PivotFields(5).Orientation = PivotFieldOrientation.ColumnField | PivotFieldOrientation.DataField
table.PivotFields(3).Function = PivotFieldFunction.Count
table.PivotFields(5).Function = PivotFieldFunction.Sum
table.DataBind()
'Creates a PivotTable report from DataView or DataTable.
Dim dataView As DataView ' Or Dim dataTable As DataTable
.
.
Sets dataView(dataTable) Value
.
.
.
Dim cache As PivotCache = GridWeb1.WebWorksheets.PivotCaches.Add(dataView)
'Or Dim cache As PivotCache = GridWeb1.WebWorksheets.PivotCaches.Add(dataTable)
Dim table As PivotTable = cache.CreatePivotTable()
table = GridWeb1.WebWorksheets.PivotTables("PivotTable1")
table.PivotFields(0).Orientation = PivotFieldOrientation.RowField
table.PivotFields(1).Orientation = PivotFieldOrientation.RowField
table.PivotFields(2).Orientation = PivotFieldOrientation.ColumnField | PivotFieldOrientation.DataField
table.DataBind()
Requirements
Namespace: Aspose.Grid.Web.Data
Assembly: Aspose.Grid.Web (in Aspose.Grid.Web.dll)
See Also
PivotCache Members | Aspose.Grid.Web.Data Namespace