PivotGridControl.SavePivotGridToFile(String) Method

Saves the Pivot Grid Control's data and full layout to the specified file.

Namespace: DevExpress.XtraPivotGrid

Assembly: DevExpress.XtraPivotGrid.v20.1.dll

Declaration

public void SavePivotGridToFile(
    string path
)
Public Sub SavePivotGridToFile(
    path As String
)

Parameters

Name Type Description
path String

A string that specifies the path to the file in which the control's data and layout will be saved.

Remarks

This method saves the original data that is provided by a data store to the specified file. The data can be loaded later in the same or another grid control by creating a PivotFileDataSource object, and assigning it to the PivotGridControl.DataSource property. No connection to the original data store is required.

The SavePivotGridToFile method also saves the full layout along with the data to the file. When the data is restored, the layout is restored as well, regardless of the layout settings specified by the PivotGridControl.OptionsLayout property.

NOTE

Saving PivotGrid's data to a file or stream is not supported for Server Mode and OLAP data sources.

Examples

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;
See Also