The pivot grid control's data, along with the full layout can be saved to a file or stream via the DevExpress.XtraPivotGrid.PivotGridControl.SavePivotGridToFile and DevExpress.XtraPivotGrid.PivotGridControl.SavePivotGridToStream methods, respectively. The PivotFileDataSource objects are used to restore the data together with the layout, and load it to the same or another pivot grid control.
To restore the data and layout, create a PivotFileDataSource object, passing the file or stream that contains pivot grid data to the constructor, and assign the created object to pivot grid's DevExpress.XtraPivotGrid.PivotGridControl.DataSource property.
Note
The PivotFileDataSource is a read-only data source.

Example
The following example shows how to save the Pivot Grid Control's data to a file, and then load it later.
To save the data the DevExpress.XtraPivotGrid.PivotGridControl.SavePivotGridToFile method is called. To restore the data, a PivotFileDataSource object is initialized and assigned to the DevExpress.XtraPivotGrid.PivotGridControl.DataSource property.
C# |
using DevExpress.Data.PivotGrid;
string filePath = "c:\\pivotData.dat";
pivotGridControl1.SavePivotGridToFile(filePath);
PivotFileDataSource ds = new PivotFileDataSource(filePath);
pivotGridControl1.DataSource = ds;
|
VB |
Imports DevExpress.Data.PivotGrid
Dim filePath As String = "c:\\pivotData.dat"
pivotGridControl1.SavePivotGridToFile(filePath)
Dim ds As PivotFileDataSource = New PivotFileDataSource(filePath)
pivotGridControl1.DataSource = ds
|
System.Object
PivotFileDataSource