Back to Devexpress

PivotGridControl.RestoreLayoutFromXml(String) Method

windowsforms-devexpress-dot-xtrapivotgrid-dot-pivotgridcontrol-dot-restorelayoutfromxml-x28-system-dot-string-x29.md

latest4.2 KB
Original Source

PivotGridControl.RestoreLayoutFromXml(String) Method

SECURITY-RELATED CONSIDERATIONS

Deserializing layout settings from untrusted resources may create security issues. Review the following help topic for additional information: Safe Deserialization.

Restores a Pivot Grid Control’s layout from the specified XML file.

Namespace : DevExpress.XtraPivotGrid

Assembly : DevExpress.XtraPivotGrid.v25.2.dll

NuGet Package : DevExpress.Win.PivotGrid

Declaration

csharp
public void RestoreLayoutFromXml(
    string xmlFile
)
vb
Public Sub RestoreLayoutFromXml(
    xmlFile As String
)

Parameters

NameTypeDescription
xmlFileString

A string value specifying the path to the XML file from which Pivot Grid Control’s settings are read. If the specified file doesn’t exist, an exception is raised.

|

Remarks

Use the RestoreLayoutFromXml method to load the Pivot Grid Control’s layout which was written to a file in the XML format using the PivotGridControl.SaveLayoutToXml method.

The PivotGridControl.OptionsLayout property controls which settings should be restored from the file.

Note

When restoring a layout during a form load (for instance, in your Form.Load event handler), you may need to call the PivotGridControl.ForceInitialize method prior to the layout restoration. See this method to learn more.

Example

The code below demonstrates how the Pivot Grid Control’s layout can be saved to and then restored from an XML file.

csharp
string fileName = "c:\\XtraPivotGrid_Layout.xml";
// Saves layout to an XML file.
pivotGridControl1.SaveLayoutToXml(fileName);

// ...
// Restores the previously saved layout.
pivotGridControl1.RestoreLayoutFromXml(fileName);
vb
Dim fileName As String = "c:\XtraPivotGrid_Layout.xml"
' Saves layout to an XML file.
PivotGridControl1.SaveLayoutToXml(fileName)

' ...
' Restores the previously saved layout.
PivotGridControl1.RestoreLayoutFromXml(fileName)

See Also

SaveLayoutToXml

RestoreLayoutFromRegistry

RestoreLayoutFromStream

SaveCollapsedStateToFile(String)

SaveCollapsedStateToStream(Stream)

LoadCollapsedStateFromFile(String)

LoadCollapsedStateFromStream(Stream)

LayoutUpgrade

OptionsLayout

Save and Restore Layouts of DevExpress controls

PivotGridControl Class

PivotGridControl Members

DevExpress.XtraPivotGrid Namespace