Skip to main content
A newer version of this page is available. .

How to: Save PivotGridControl Data to a File and Work with It Later

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;