corelibraries-devexpress-dot-data-dot-pivotgrid-d3c04b0c.md
The pivot grid control’s data, loaded from a file or stream.
Namespace : DevExpress.Data.PivotGrid
Assembly : DevExpress.PivotGrid.v25.2.Core.dll
NuGet Packages : DevExpress.PivotGrid.Core, DevExpress.Win.Navigation
public class PivotFileDataSource :
ITypedList,
IList,
ICollection,
IEnumerable
Public Class PivotFileDataSource
Implements ITypedList,
IList,
ICollection,
IEnumerable
The pivot grid control’s data, along with the full layout can be saved to a file or stream via the PivotGridControl.SavePivotGridToFile and 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 PivotGridControl.DataSource property.
Note
The PivotFileDataSource is a read-only data source.
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 PivotGridControl.SavePivotGridToFile method is called. To restore the data, a PivotFileDataSource object is initialized and assigned to the PivotGridControl.DataSource property.
using DevExpress.Data.PivotGrid;
string filePath = "c:\\pivotData.dat";
// Save the control's data to the file.
pivotGridControl1.SavePivotGridToFile(filePath);
//...
// Restore the saved data
PivotFileDataSource ds = new PivotFileDataSource(filePath);
pivotGridControl1.DataSource = ds;
Imports DevExpress.Data.PivotGrid
Dim filePath As String = "c:\\pivotData.dat"
' Save the control's data to the file.
pivotGridControl1.SavePivotGridToFile(filePath)
'...
' Restore the saved data
Dim ds As PivotFileDataSource = New PivotFileDataSource(filePath)
pivotGridControl1.DataSource = ds
Object PivotFileDataSource
See Also