PivotGridControl.SaveLayoutToJson(Stream) Method
In This Article
Saves the Pivot Grid’s layout settings specified by the OptionsLayout property to a file in JSON format.
Namespace: DevExpress.XtraPivotGrid
Assembly: DevExpress.XtraPivotGrid.v25.1.dll
NuGet Package: DevExpress.Win.PivotGrid
#Declaration
#Parameters
Name | Type | Description |
---|---|---|
utf8json |
Stream | The layout in UTF-8 encoded JSON format. |
#Remarks
Use the RestoreLayoutFromJson method to load the layout to a file in JSON format.
string filePath = "pivotgrid-layout.json";
void Form1_Load(object sender, EventArgs e) {
if (File.Exists(filePath)) {
using (var jsonStream = File.OpenRead(filePath))
pivotGrid1.RestoreLayoutFromJson(jsonStream);
}
}
void Form1_FormClosing(object sender, FormClosingEventArgs e) {
using (var jsonStream = File.OpenWrite(filePath))
pivotGrid1.SaveLayoutToJson(jsonStream);
}
Tip
Use the Persistence Behavior or Workspace Manager component to save and restore layouts for all DevExpress UI controls simultaneously.
See Also